iptables in Linux

iptables

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@master tmp]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.1 (Santiago)
[root@master tmp]# service iptables start
iptables: No config file. [WARNING]
[root@master tmp]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination

Chain FORWARD (policy ACCEPT)
num target prot opt source destination

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination

[root@master tmp]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
1
2
3
4
5
6
7
8
9
10
vim /etc/sysconfig/iptables

-- 永久性生效,重启后不会复原
chkconfig iptables on #开启

chkconfig iptables off #关闭

-- 即时生效,重启后复原
service iptables stop --停止
service iptables start --启动

[!NOTE]

Reference

https://blog.51cto.com/13677371/2094355
http://www.zsythink.net/archives/1199/
https://www.cnblogs.com/alimac/p/5848372.html