iptables防火牆的啟動、停止以及開啟關閉埠的操作

iptables防火牆的啟動、停止以及開啟關閉埠的操作:

CentOS 配置防火牆操作例項(啟、停、開、閉埠):

注:防火牆的基本操作命令:

查詢防火牆狀態 :

[root@localhost ~]# service   iptables status

停止防火牆 :

[root@localhost ~]# service   iptables stop

啟動防火牆 :

[root@localhost ~]# service   iptables start

重啟防火牆 :

[root@localhost ~]# service   iptables restart

永久關閉防火牆 :

[root@localhost ~]# chkconfig   iptables off

永久關閉後啟用 :

[root@localhost ~]# chkconfig   iptables on

1、檢視防火牆狀態

[root@localhost ~]# service iptables status

2、編輯/etc/sysconfig/iptables檔案。我們例項中要開啟8080埠和9990埠

用編輯器開啟/etc/sysconfig/iptables

3、依葫蘆畫瓢,我們新增8080埠和9990埠

4、儲存/etc/sysconfig/iptables檔案,並在終端執行

[root@localhost ~]# service iptables restart

5、從新檢視防火牆狀態

[root@localhost ~]# service iptables status

6、這時候,伺服器的8080和9990埠就可以對外提供服務了。

7、其他埠的開放模式就是類似如此開放模式。

shutdown -h now  ——立即關機

shutdown -h 10:53  ——到10:53關機,如果該時間小於當前時間,則到隔天

shutdown -h +10  ——10分鐘後自動關機

shutdown -r now  ——立即重啟

shutdown -r +30 ‘The System Will Reboot in 30 Mins’   ——30分鐘後重啟並併發送通知給其它線上使用者