centos 6.x 7.x防火墙如何开启端口范围IP地址及进行配置,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
#centos 6.x#在开启防火墙的情况下打开nfsiptables -L -n#开启端口iptables -A INPUT -p tcp --dport 892 -j ACCEPTiptables -A OUTPUT -p tcp --sport 892 -j ACCEPTservice iptables saveservice iptables restart#删除规则iptables --delete OUTPUT 3#查看该台机器的端口范围cat /proc/sys/net/ipv4/ip_local_port_range#开启端口范围开启防火墙iptables -A INPUT -s 192.168.75.132 -p tcp --dport 1000:60000 -j ACCEPTiptables -A INPUT -s 192.168.75.132 -p tcp --dport 1000:60000 -j ACCEPT#centos7.x为某个ip打开端口范围firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='192.168.75.128' protocol='tcp' port port='1000-60000' accept" firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='192.168.75.129' accept"firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='192.168.75.128' accept"firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='192.168.75.130' accept"#查看公共区域开放的端口firewall-cmd --zone=public --list-all#重新加载配置firewall-cmd --reload开放端口范围firewall-cmd --permanent --zone=public --add-port=1000-60000/tcp#删除规则firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.75.129" port protocol='tcp' port='1000-60000' accept"firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.75.128" port protocol='tcp' port='1000-60000' accept"firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.75.130" port protocol='tcp' port='1000-60000' accept"
看完上述内容,你们掌握centos 6.x 7.x防火墙如何开启端口范围IP地址及进行配置的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注编程网行业资讯频道,感谢各位的阅读!