CentOS 配置防火墻操作實(shí)例(啟、停、開、閉端口):
注:防火墻的基本操作命令:
查詢防火墻狀態(tài):
[root@localhost ~]# service iptables status<回車>
停止防火墻:
[root@localhost ~]# service iptables stop <回車>
啟動(dòng)防火墻:
[root@localhost ~]# service iptables start <回車>
重啟防火墻:
[root@localhost ~]# service iptables restart <回車>
永久關(guān)閉防火墻:
[root@localhost ~]# chkconfig iptables off<回車>
永久關(guān)閉后啟用:
[root@localhost ~]# chkconfig iptables on<回車>
1、查看防火墻狀態(tài)
[root@localhost ~]# service iptables status<回車>
2、編輯/etc/sysconfig/iptables文件。我們實(shí)例中要打開8080端口和9990端口
用編輯器打開/etc/sysconfig/iptables
3、依葫蘆畫瓢,我們添加8080端口和9990端口
4、保存/etc/sysconfig/iptables文件,并在終端執(zhí)行
[root@localhost ~]# service iptables restart <回車>
5、從新查看防火墻狀態(tài)
[root@localhost ~]# service iptables status<回車>
6、這時(shí)候,服務(wù)器的8080和9990端口就可以對(duì)外提供服務(wù)了。
7、其他端口的開放模式就是類似如此開放模式。
聯(lián)系客服