一:Centos使用前需了解的
1:网卡
centos6的网卡重启方法:
service network restart
centos7的网卡重启方法:
systemctl restart network
2:防火墙
开启防火墙:systemctl start firewalld
关闭防火墙:systemctl stop firewalld
查看防火墙状态:systemctl status firewalld.service
开机自动启动:systemctl enable firewalld
关闭防火墙并设置开机不启动:systemctl disable firewalld
查看开机是否启动:chkconfig --list|grep network(RHLE6)
3、关闭安全增强性(在生产环境中一定要关闭):
vim /etc/selinux/config
或vim /etc/sysconfig/selinux
二:启动网卡服务错误
systemctl start network 启动网卡服务报错
[root@localhost home]# systemctl restart network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journal
ctl -xe" for details.
- 提示错误:
Job for network.service failed because the control process exited with error code. See “systemctl status network.service” and “journal
ctl -xe” for details
解决思路:查看错误日志
[root@localhost home]# systemctl status network.service
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2021-08-01 11:03:33 PDT; 13min ago
Docs: man:systemd-sysv-generator(8)
Process: 4841 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
CGroup: /system.slice/network.service
└─999 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-bbefb2ab-4633-33f7-b5b5-dffb4e3eb945-ens33.lease -pf /var/run/...
Aug 01 11:03:33 localhost.localdomain network[4841]: RTNETLINK answers: File exists
Aug 01 11:03:33 localhost.localdomain network[4841]: RTNETLINK answers: File exists
Aug 01 11:03:33 localhost.localdomain network[4841]: RTNETLINK answers: File exists
Aug 01 11:03:33 localhost.localdomain network[4841]: RTNETLINK answers: File exists
Aug 01 11:03:33 localhost.localdomain network[4841]: RTNETLINK answers: File exists
Aug 01 11:03:33 localhost.localdomain network[4841]: RTNETLINK answers: File exists
Aug 01 11:03:33 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
Aug 01 11:03:33 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
Aug 01 11:03:33 localhost.localdomain systemd[1]: Unit network.service entered failed state.
Aug 01 11:03:33 localhost.localdomain systemd[1]: network.service failed.
- 输入以下命令即可解决
[root@localhost zzc]# systemctl stop NetworkManager
[root@localhost zzc]# systemctl disable NetworkManager
[root@localhost zzc]#
- 再重启网卡服务,不会报错
[root@localhost home]# systemctl restart network
[root@localhost home]#