centos 对某ip开放 防火墙端口_centos 6.x 7.x防火墙开启端口范围IP地址 配置
#centos6.x#在开启防火墙的情况下打开nfsiptables-L-n#开启端口iptables-AINPUT-ptcp--dport892-jACCEPTiptables-AOUTPUT-ptcp--sport892-jACCEPTserviceiptablessaveserviceiptablesrestart#删除规则iptables--...
#centos 6.x
#在开启防火墙的情况下打开nfs
iptables -L -n
#开启端口
iptables -A INPUT -p tcp --dport 892 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 892 -j ACCEPT
service iptables save
service 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 ACCEPT
iptables -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"
更多推荐
所有评论(0)