尚硅谷大数据技术之Linux (新)第5章 网络配置和系统管理操作

5.4 关闭防火墙

5.4.1 service 后台服务管理

  1. 1.基本语法

service  服务名 start (功能描述:开启服务)

service  服务名 stop (功能描述:关闭服务)

service  服务名 restart (功能描述:重新启动服务)

service  服务名 status (功能描述:查看服务状态)

  1. 2.经验技巧

查看服务的方法:/etc/init.d/服务名

[root@hadoop100 init.d]# pwd

/etc/init.d

[root@hadoop100 init.d]# ls -al

  1. 3.案例实操

(1)查看网络服务的状态

[root@hadoop100 桌面]#service network status

(2)停止网络服务

[root@hadoop100 桌面]#service network stop

(3)启动网络服务

[root@hadoop100 桌面]#service network start

(4)重启网络服务

[root@hadoop100 桌面]#service network restart

(5)查看系统中所有的后台服务

[root@hadoop100 桌面]#service --status-all

5.4.2 chkconfig 设置后台服务的自启配置

  1. 1.基本语法

chkconfig     (功能描述:查看所有服务器自启配置)

chkconfig 服务名 off   (功能描述:关掉指定服务的自动启动)

chkconfig 服务名 on   (功能描述:开启指定服务的自动启动)

chkconfig 服务名 --list (功能描述:查看服务开机启动状态)

  1. 2.案例实操

(1)关闭iptables服务的自动启动

[root@hadoop100 桌面]#chkconfig iptables off

(2)开启iptables服务的自动启动

[root@hadoop100 桌面]#chkconfig iptables on

5.4.3 进程运行级别

Linux进程运行级别,如图1-102所示

5.4.4 关闭防火墙

  1. 1.临时关闭防火墙

(1)查看防火墙状态

[root@hadoop100桌面]# service iptables status

(2)临时关闭防火墙

[root@hadoop100桌面]# service iptables stop

2.开机启动时关闭防火墙

(1)查看防火墙开机启动状态

[root@hadoop100桌面]#chkconfig iptables --list

(2)设置开机时关闭防火墙

[root@hadoop100桌面]#chkconfig iptables off