手工放行TCP、UDP端口

如需放行单个端口,可以使用如下命令:

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

保存重启命令同上


JasonBlog

JasonBlog
请先登录后发表评论
  • 最新评论
  • 总共0条评论