iptables 使用总结

1. 增加tcp协议的端口是:

iptables -A INPUT -p tcp -m tcp --dport 要开放的端口 -j ACCEPT
 

 

2. 增加udp协议的端口是

iptables -A INPUT -p udp -m udp --dport 要开放的端口 -j ACCEPT
这样添加以后仅仅是临时有效,服务器或者iptables重启后就失效了
如果要永久保存的话:
service iptables save
就能保存啦!
这个时候可以执行
cat /etc/sysconfig/iptables
来查看是不是成功保存了!

 

 

posted on 2019-10-11 21:21  小小鸟儿!  阅读(239)  评论(0编辑  收藏  举报