Centos7,配置防火墙,开启端口
生活随笔
收集整理的這篇文章主要介紹了
Centos7,配置防火墙,开启端口
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
此博客轉載于:http://blog.csdn.net/u013410747/article/details/61696178
1.centos7版本對防火墻進行 加強,不再使用原來的iptables,啟用firewall
1.查看已開放的端口(默認不開放任何端口) firewall-cmd --list-ports 2.開啟80端口 firewall-cmd --zone=public(作用域) --add-port=80/tcp(端口和訪問類型) --permanent(永久生效) 3.重啟防火墻 firewall-cmd --reload 4.停止防火墻 systemctl stop firewalld.service 5.禁止防火墻開機啟動 systemctl disable firewalld.service 6.刪除 firewall-cmd --zone= public --remove-port=80/tcp --permanent- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
2.centos7以下版本
1.開放80,22,8080 端口 /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT /sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT 2.保存 /etc/rc.d/init.d/iptables save 3.查看打開的端口 /etc/init.d/iptables status 4.關閉防火墻 1) 永久性生效,重啟后不會復原 開啟: chkconfig iptables on 關閉: chkconfig iptables off 2) 即時生效,重啟后復原 開啟: service iptables start 關閉: service iptables stop- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
總結
以上是生活随笔為你收集整理的Centos7,配置防火墙,开启端口的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 侧滑效果,android
- 下一篇: Centos下重要日志文件及查看方式