device does not seem;RTNETLINK answers:File exists

The problem of Centos 7 server's abnormal network
Troubleshooting steps:
1. Confirm whether there is an IP address
2. Whether the network card is restarted successfully
3. Whether there is a conflicting Network & Network manger
4. Check whether the configuration file of the network card is normal
Warning: mainly look at the Log. The default Log storage location (/ var/log/messages)
(1) Check whether there is IP address
(this is not the figure above. You can see the network card information, but there is no IP address.)
Let's take a look at the log

Apr  8 10:35:20 localhost network: Bringing up interface eth0:  ERROR     : [/etc/sysconfig/network-scripts/ifup-eth] Device  has different MAC address than expected, ignoring.
Apr  8 10:35:20 localhost /etc/sysconfig/network-scripts/ifup-eth: Device  has different MAC address than expected, ignoring.
Apr  8 10:35:20 localhost network: [FAILED]
Apr  8 10:35:20 localhost systemd: network.service: control process exited, code=exited status=1
Apr  8 10:35:20 localhost systemd: Failed to start LSB: Bring up/down networking.
Apr  8 10:35:20 localhost systemd: Unit network.service entered failed state.
Apr  8 10:35:20 localhost systemd: network.service failed.

It is obvious that the MAC address is wrong. Let's see if the MAC address is correct

[root@localhost ~]# grep HAW /etc/sysconfig/network-scripts/ifcfg-eth0 
HAWDDR="I won't show you the code"

Then confirm whether the MAC address of eth0 network card is correct

[root@localhost ~]# cat /sys/class/net/eth0/address 
//Code and code

Now confirm that the MAC address is inconsistent. We will modify the network card configuration file

[root @ localhost ~] sed - I's' / MAC of the original configuration file / MAC / g 'of the current configuration file / etc / sysconfig / network scripts / ifcfg-eth0 

Restart the network card again

[root@localhost ~]# systemctl restart network

No accident and error. Let's take a look at the log information again

Apr  8 10:43:47 localhost /etc/sysconfig/network-scripts/ifup-eth: Device  does not seem to be present, delaying initialization.
Apr  8 10:43:47 localhost network: [FAILED]
Apr  8 10:43:47 localhost network: RTNETLINK answers: File exists
Apr  8 10:43:47 localhost network: RTNETLINK answers: File exists
Apr  8 10:43:47 localhost network: RTNETLINK answers: File exists
Apr  8 10:43:47 localhost network: RTNETLINK answers: File exists
Apr  8 10:43:47 localhost network: RTNETLINK answers: File exists
Apr  8 10:43:47 localhost network: RTNETLINK answers: File exists
Apr  8 10:43:47 localhost network: RTNETLINK answers: File exists
Apr  8 10:43:47 localhost network: RTNETLINK answers: File exists
Apr  8 10:43:47 localhost network: RTNETLINK answers: File exists

The error reporting is different this time. It tells us that we can't find the file (this type of error reporting has a wide range and is not easy to check. Let's check from the following points)
1. First check whether the configuration file specifies the network card name
Objects: file names
Network card configuration: NAME, DEVICE
2. Check the 70-persistent-net.rules user-defined network card information configuration file
3. Refresh network card information
(1) Check profile name

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
# Generated by dracut initrd
NAME="eth0"
HWADDR="Code"
ONBOOT=yes
NETBOOT=yes
UUID="Code"
IPV6INIT=yes
BOOTPROTO=dhcp
TYPE=Ethernet

The DEVICE name is missing here. Let's add

[root@localhost ~]# sed -i '3a/DEVICE=eth0' /etc/sysconfig/network-scripts/ifcfg-eth0

Restart service attempt

[root@localhost ~]# systemctl restart network

The service is normal
(2) Check the 70-persistent-net.rules custom network card information configuration file

[root@localhost ~]# cat /etc/udev/rules.d/70-persistent-net.rules

If you don't have this file, you can skip this step. If you have one, compare the information
(3) Refresh network card

[root@localhost ~]# ip addr flush dev eth0

Generally, you can eliminate the problem of network card configuration after finishing these tasks
If there is any problem, please check whether route, dns, DHCP server are normal, if it is a virtual machine, check whether the network card configuration of the virtual machine is normal, etc

Tags: Linux network Mac CentOS DNS

Posted on Tue, 07 Apr 2020 23:14:11 -0700 by needphphelp