Centos 防火墙开启关闭、端口开放

一.Centos 6

1.防火墙开启关闭

[root@xuyj~] service iptables restart/start/stop

2.端口开放

#以8080端口为例
[root@xuyj~] /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT  #写入修改
[root@xuyj~] /etc/init.d/iptables save   #保存修改
[root@xuyj~] service iptables restart    #重启防火墙,修改生效

二.Centos 7

1.防火墙开启关闭

[root@xuyj~] systemctl restart/start/stop firewalld.service

2.端口开放

#permanent 为永久
[root@xuyj~] firewall-cmd --zone=public --add-port=8388/tcp --permanen

猜你喜欢

转载自www.cnblogs.com/xuyj/p/10702639.html
今日推荐