如需放行单个端口,可以使用如下命令:
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport {port.no} -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport {port.no} -j ACCEPT
然后,使用如下命令
/etc/init.d/iptables save
/etc/init.d/iptables restart
保存并重启防火墙;
或者使用如下命令
service iptables save
service iptables restart
如需放行端口段,可以使用如下命令:
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport {port.startno:endno} -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport {port.startno:endno} -j ACCEPT
保存重启命令同上
本文为Jason原创文章,转载无需和我联系,但请注明来自JasonBlog jasontech.top