~]#iptables -A INPUT -i eth0 -p tcp -m tcp --dport 23 -j ACCEPT
root@localhost ~]#iptables -A OUTPUT -o eth0 -p tcp -m tcp --sport 23 -j ACCEPT
root@localhost ~]#service iptables save
[root@localhost ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:telnet
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp spt:telnet
插入一条规则,允许NTP同步的utp 123端口
[root@openvpn ~]# iptables -I INPUT 4 -p tcp --dport 123 -j ACCEPT
插入一条规则,允许开通连续端口(-m multiport)
[root@openvpn ~]#iptables -I INPUT 4 -p tcp -m multiport --dport 5901:5903 -j ACCEPT
保存规则
[root@openvpn ~]#service iptables save
查看规则
[root@openvpn ~]#service iptables save
阅读(3148) | 评论(0) | 转发(0) |