- 问题:配置静态ip后发现重启不了网卡
[root@localhost ~]# systemctl restart network
Job for network.service failed because the control process exited with error code.
See "systemctl status network.service" and "journalctl -xe" for details.
- 首先再次确认了网卡配置是没有问题的,也并没有发现有手误敲错了单词
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens33
UUID=f8506572-64e6-4f3d-b4c3-b7b47514f185
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.20.11
NETMASK=255.255.255.0
PREFIX=24
GATEWAY=192.168.20.2
DNS1=114.114.114.114
根据提示输入systemctl status network.service命令后出现如下错误信息:
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since 三 2021-06-23 22:01:47 CST; 1min 16s ago
Docs: man:systemd-sysv-generator(8)
Process: 4681 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
CGroup: /system.slice/network.service
└─1192 /sbin/dhclient -H mini1 -1 -q -lf /var/lib/dhclient/dhclient--ens33.lease -pf /v...
6月 23 22:01:47 mini1 network[4681]: RTNETLINK answers: File exists
6月 23 22:01:47 mini1 network[4681]: RTNETLINK answers: File exists
6月 23 22:01:47 mini1 network[4681]: RTNETLINK answers: File exists
6月 23 22:01:47 mini1 network[4681]: RTNETLINK answers: File exists
6月 23 22:01:47 mini1 network[4681]: RTNETLINK answers: File exists
6月 23 22:01:47 mini1 network[4681]: RTNETLINK answers: File exists
6月 23 22:01:47 mini1 systemd[1]: network.service: control process exited, code=exited status=1
6月 23 22:01:47 mini1 systemd[1]: Failed to start LSB: Bring up/down networking.
6月 23 22:01:47 mini1 systemd[1]: Unit network.service entered failed state.
6月 23 22:01:47 mini1 systemd[1]: network.service failed.
做法如下
和 NetworkManager 服务有冲突,直接关闭 NetworkManger 服务就好了, systemctl stop NetworkManager 。
[root@localhost ~]# systemctl stop NetworkManager
[root@localhost ~]# systemctl restart network
发现成功
[root@localhost ~]# ping www.baidu.com //也能够上网了
PING www.a.shifen.com (36.152.44.96) 56(84) bytes of data.
64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=1 ttl=128 time=4.74 ms
64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=2 ttl=128 time=4.84 ms
64 bytes from 36.152.44.96 (36.152.44.96): icmp_seq=3 ttl=128 time=5.00 ms