轉自:https://www.cnblogs.com/wliangde/p/3803891.htmlhtml
轉自: CentOS 配置防火牆操做實例(啓、停、開、閉端口)服務器
CentOS 配置防火牆操做實例(啓、停、開、閉端口):編輯器
注:防火牆的基本操做命令:spa
查詢防火牆狀態:.net
[root@localhost ~]# service iptables status<回車>rest
中止防火牆:htm
[root@localhost ~]# service iptables stop <回車>blog
啓動防火牆:ip
[root@localhost ~]# service iptables start <回車>get
重啓防火牆:
[root@localhost ~]# service iptables restart <回車>
永久關閉防火牆:
[root@localhost ~]# chkconfig iptables off<回車>
永久關閉後啓用:
[root@localhost ~]# chkconfig iptables on<回車>
一、查看防火牆狀態
[root@localhost ~]# service iptables status<回車>
二、編輯/etc/sysconfig/iptables文件。咱們實例中要打開8080端口和9990端口
用編輯器打開/etc/sysconfig/iptables
三、依葫蘆畫瓢,咱們添加8080端口和9990端口
四、保存/etc/sysconfig/iptables文件,並在終端執行
[root@localhost ~]# service iptables restart <回車>
五、重新查看防火牆狀態
[root@localhost ~]# service iptables status<回車>
六、這時候,服務器的8080和9990端口就能夠對外提供服務了。
七、其餘端口的開放模式就是相似如此開放模式。