linux放火牆配置檔案位於/etc/sysconfig/iptables
內容示例如下:
# firewall configuration written by system-config-firewall
# manual customization of this file is not recommended.
*filter
:input accept [0:0]
:forward accept [0:0]
:output accept [0:0]
:rh-firewall-1-input - [0:0]
-a input -j rh-firewall-1-input
-a rh-firewall-1-input -i lo -j accept
-a rh-firewall-1-input -p icmp --icmp-type any -j accept
-a rh-firewall-1-input -p 50 -j accept
-a rh-firewall-1-input -p 51 -j accept
-a rh-firewall-1-input -p udp --dport 5353 -d 224.0.0.251 -j accept
-a rh-firewall-1-input -p udp -m udp --dport 631 -j accept
-a rh-firewall-1-input -p tcp -m tcp --dport 631 -j accept
-a rh-firewall-1-input -m state --state established,related -j accept
-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 21 -j accept
-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 22 -j accept
-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 80 -j accept
-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 3306 -j accept
-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 443 -j accept
-a rh-firewall-1-input -j reject --reject-with icmp-host-prohibited
-a forward -j reject --reject-with icmp-host-prohibited
commit
要開啟某新埠,仿照80哪行拷貝一行,然後將80修改成想開啟的埠號,3306哪行是示例。
修改完畢後,使用命令
#/etc/init.d/iptables restart
重啟放火牆服務。
Linux防火牆配置
重啟後生效 開啟 chkconfig iptables on 關閉 chkconfig iptables off 2 即時生效,重啟後失效 開啟 service iptables start 關閉 service iptables stop 需要說明的是對於linux下的其它服務都可以用以上命令執行...
linux 防火牆配置
把tcp的80埠配置為允許任何ip訪問 iptables i input ptcp dport 80 j accept 上面第三步的方法只是臨時生效的,只要你重啟了虛擬機器或者說重啟了linux,就必須重新設定才可以訪問,解決辦法如下 在命令列下輸入 vi etc selinux config 修改...
linux 防火牆配置
防火牆配置 centos 7預設使用的是firewall作為防火牆,這裡改為iptables防火牆。firewall操作 service firewalld status 檢視防火牆狀態 disabled 表明 已經禁止開啟啟動 enable 表示開機自啟,inactive 表示防火牆關閉狀態 ac...