基本語法:
service 服務名 start | stop | restart | status
檢視服務的方法:
cd /etc/init.d/服務名 ,發現只有兩個服務保留在service
案例實操:
(1)檢視網路服務的狀態
[root@hadoop100 桌面]#service network status
(2)停止網路服務
[root@hadoop100 桌面]#service network stop
(3)啟動網路服務
[root@hadoop100 桌面]#service network start
(4)重啟網路服務
[root@hadoop100 桌面]#service network restart
基本語法
chkconfig (功能描述:檢視所有伺服器自啟配置)
chkconfig 服務名 off (功能描述:關掉指定服務的自動啟動)
chkconfig 服務名 on (功能描述:開啟指定服務的自動啟動)
chkconfig 服務名 --list (功能描述:檢視服務開機啟動狀態)
案例實操
(1)開啟/關閉iptables(防火牆)服務的自動啟動
[root@hadoop100 桌面]#chkconfig iptables on
[root@hadoop100 桌面]#chkconfig iptables off
基本語法
systemctl start | stop | restart | status 服務名
案例實操
(1)檢視防火牆服務的狀態
[root@hadoop100 桌面]# systemctl status firewalld
(2)停止防火牆服務
[root@hadoop100 桌面]# systemctl stop firewalld
(3)啟動防火牆服務
[root@hadoop100 桌面]# systemctl start firewalld
(4)重啟防火牆服務
[root@hadoop100 桌面]# systemctl restart firewalld
基本語法
systemctl list-unit-files (功能描述:檢視服務開機啟動狀態)
systemctl disable service_name (功能描述:關掉指定服務的自動啟動)
systemctl enable service_name (功能描述:開啟指定服務的自動啟動)
案例實操
(1)開啟/關閉iptables(防火牆)服務的自動啟動
[root@hadoop100 桌面]# systemctl enable firewalld.service
[root@hadoop100 桌面]# systemctl disable firewalld.service
臨時關閉防火牆
(1)檢視防火牆狀態
[root@hadoop100桌面]# systemctl status firewalld
(2)臨時關閉防火牆
[root@hadoop100桌面]# systemctl stop firewalld
開機啟動時關閉防火牆
(1)檢視防火牆開機啟動狀態
[root@hadoop100桌面]# systemctl enable firewalld.service
(2)設定開機時關閉防火牆
[root@hadoop100桌面]# systemctl disable firewalld.service
Linux防火牆設定
修改防火牆配置需要修改 etc sysconfig iptables 這個檔案,如果要開放哪個埠,在裡面新增一條 a rh firewall 1 input m state state new m tcp p tcp dport 1521 j accept 就可以了,其中 1521 是要開放的埠號,...
Linux防火牆設定
1 重啟後永久性生效 開啟 chkconfig iptables on 關閉 chkconfig iptables off 2 即時生效,重啟後失效 開啟 service iptables start 關閉 service iptables stop 需要說明的是對於linux下的其它服務都可以用以...
LINUX防火牆設定
在終端中輸入如下命令開啟防火牆 chkconfig iptables on 如閉防火牆則輸入 chkconfig iptables off 上述兩條命令均要重啟系統才能生效。如果不想通過重啟系統而即時生效的話,可以用 service 命令。缺點是重啟系統後設定會丟失。開啟了防火牆 service i...