CentOS 配置防火牆操做實例(啓、停、開、閉端口)

CentOS 配置防火牆操做實例(啓、停、開、閉端口):服務器

 

注:防火牆的基本操做命令:編輯器

查詢防火牆狀態:ide

[root@localhost ~]# service   iptables status<回車>spa

 

中止防火牆:rest

[root@localhost ~]# service   iptables stop <回車>ip

 

啓動防火牆:it

[root@localhost ~]# service   iptables start <回車>table

 

重啓防火牆:class

[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端口就能夠對外提供服務了。

七、其餘端口的開放模式就是相似如此開放模式。

相關文章
相關標籤/搜索