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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容