centos6.5iptables預設配置
1
2
3
4
5
6
7
8
9
10
11
12
13
<code># Firewall configuration written by system-config-firewall</code>
<code># Manual customization of this file is not recommended.</code>
<code>*filter</code>
<code>:INPUT ACCEPT [0:0]</code>
<code>:FORWARD ACCEPT [0:0]</code>
<code>:OUTPUT ACCEPT [0:0]</code>
<code>-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</code>
<code>-A INPUT -p icmp -j ACCEPT</code>
<code>-A INPUT -i lo -j ACCEPT</code>
<code>-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT</code>
<code>-A INPUT -j REJECT --reject-with icmp-host-prohibited</code>
<code>-A FORWARD -j REJECT --reject-with icmp-host-prohibited</code>
<code>COMMIT</code>
檢視規則
iptables -nL --line-number
插入規則
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
更改規則
iptables -R INPUT 1 -p tcp --dport 8000 -j ACCEPT
iptables -R INPUT 1 -p tcp -s 10.240.240.56 --dport 8000 -j ACCEPT
删除規則
iptables -D INPUT 6
儲存與重新開機
/etc/init.d/iptables save
/etc/init.d/iptables restart
導出與導入
cd /etc/sysconfig
iptables-save > iptablesRules
iptables-restore <iptablesRules
本文轉自 xoyabc 51CTO部落格,原文連結:http://blog.51cto.com/xoyabc/1659225,如需轉載請自行聯系原作者