centos 7在网络管理方面做了比较大的修改,使用NetworkManager来管理网络,
使用systemctl来替换之前版本中的service和chkconfig。
1、查看系统已启用的服务。
systemctllist-unit-files | grep enabled
2、服务的启停、状态查看。
状态查看:systemctl status sshd
服务启动:systemctl start sshd
服务停止: systemctl stop sshd
服务重启: systemctl restart sshd
服务的启动、停止和重启如果服务正常都没有任何回显,详情可查看服务状态。
下图是网络服务的重启和服务状态显示。
3、服务的启用、开机自动运行、开机禁止运行,类似之前版本chkconfig命令的功能。
iptables服务改为firewalld
禁止:systemctl disable firewalld
启用:systemctl enable firewalld
网络服务由NetworkManager统一管理
禁止:systemctl disable NetworkManager
启用:systemctl enable NetworkManager
查看服务是否开机运行
systemctl is-enabledfirewalld.service
4、chkconfig命令依然存在,但是只显示用SysV方式管理的服务,以后应该慢慢会被systemctl替换,所以还是习惯systemctl的用法吧。
ssh和network服务的启用、停用。