Skip to Content

[Solution] Device Eth0 Does Not Seem To Be Present, Delaying Initialization Centos

[Solution] Device Eth0 Does Not Seem To Be Present, Delaying Initialization Centos

The other day I was working on a POC lab where I had to simulate a DNS server, Centos version 7 in this case in GNS3. It was for one of the nuage sdwan gns3 labs I was working on.
Took a copy of centos DNS VM from existing KVM host, added into gns3 by going to edit preferences and under Qemu VM’s.

gns3 adding qemu images

Dragged the Centos DNS server to the gns3 topology and connected to the network and powered on.

dns server in gns3

I thought I was all set but there was a small problem.

Unfortunately, the network on this DNS server wouldn’t come up.
It was throwing the error
“device eth0 does not seem to be present, delaying initialization”

when tried to bring up the interface using the command ifup eth0.

Device eth0 does not seem to be present, delaying initialization

Read also,
How To Setup NTP Server In Linux? (Centos, Rhel, Ubuntu)
How To Set Static IP On Ubuntu? (GUI and CLI)
6 Easy Steps To Configure SNMP on Redhat Linux or CentOS
How To Install And Configure SNMP on Ubuntu?

In this blog, we are going to fix this issue by following steps.

  1. Check interface status.
  2. Check the network configuration file.
  3. Verify with inactive interfaces on Linux
  4. Take a backup of Linux interface network config
  5. Modifying network configuration files in Linux
  6. Network verification

Check interface status.

That’s weird, I then ran ifconfig to see whats the network interface status and guess what?
I couldn’t find the interface under the IP configuration except for the loopback interface.

[root@dns-02 ~]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@dns-02 ~]# 

Check the network configuration file.

Well, what could be the issue I started to wonder.

Then I decided to check the network configuration folder /etc/sysconfig/network-scripts to see what’s going on there.
did ls to see the list of interfaces.

[root@dns-02 network-scripts]# ls
ifcfg-eth0		ifdown-ppp		ifup-eth	ifup-sit
ifcfg-lo		ifdown-routes	ifup-ippp	ifup-Team
ifdown			ifdown-sit		ifup-ipv6	ifup-TeamPort
ifdown-bnep		ifdown-Team		ifup-isdn	ifup-tunnel
ifdown-eth		ifdown-TeamPort	ifup-plip	ifup-wireless
ifdown-ippp		ifdown-tunnel	ifup-plusb	init.ipv6-global
ifdown-ipv6		ifup			ifup-post	network-functions
ifdown-isdn		ifup-aliases	ifup-ppp	network-functions-ipv6
ifdown-post		ifup-bnep		ifup-routes	
[root@dns-02 network-scripts]#

Found the file ifcfg-eth0 was already there, which means the configuration is present. It seems that the device and the configuration files are unable to talk for some reason.

Verify with inactive interfaces on Linux

Alright, It’s time to check the devices which are present on the device by entering the command.

ifconfig -a 

This will not only show the active devices but the inactive interfaces as well.

[root@dns-02 ~]# ifconfig -a
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 122  bytes 10080 (9.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 122  bytes 10080 (9.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@dns-02 ~]# 

When I looked into the output I could see, In this machine by default has picked up the new interface standard and picked up the device name as “ens3” instead of “eth0” So there is a mismatch between the device name and the configuration file.

Now we know what to do, it is just a matter of changing the network configuration files in /etc/sysconfig/network-scripts/ifcfg-eth0 to reflect the device name, which is ifcfg-ens3

Take a backup of Linux interface network config

Before you do anything make sure that you have taken a backup of network configurations file, that way you can restore it at any time if anything goes wrong.

To create a backup, create a directory called “backup_network” in the linux network folder by entering the command below. You can name whatever the name you like as long as you remember the folder.

Mkdir backup_network

Once you created the folder copy that network interface file ifcfg-eth0 to that backup_network folder

Cp ifcfg-eth0 backup_network

now you can make changes to the network interface configuration without any any issues. If anything goes wrong you have the backup to restore.

[root@dns-02 network-scripts]# ls
backup_network  ifdown-post      ifup-bnep   ifup-routes
ifcfg-eth0   	ifdown-ppp       ifup-eth    ifup-sit
ifcfg-lo        ifdown-routes    ifup-ippp   ifup-Team
ifdown          ifdown-sit       ifup-ipv6   ifup-TeamPort
ifdown-bnep     ifdown-Team      ifup-isdn   ifup-tunnel
ifdown-eth      ifdown-TeamPort  ifup-plip   ifup-wireless
ifdown-ippp     ifdown-tunnel    ifup-plusb  init.ipv6-global
ifdown-ipv6     ifup             ifup-post   network-functions
ifdown-isdn     ifup-aliases     ifup-ppp    network-functions-ipv6
[root@dns-02 network-scripts]# 

Modifying network configuration files in Linux

Let’s rename the file ifcfg-eth0

To rename the file move the file ifcfg-eth0 to ifcfg-ens3 (New name)

mv ifcfg-eth0 ifcfg-ens3

Once done, you no longer have the ifcfg-eth0 file in the network folder.

[root@dns-02 network-scripts]# ls
backup_network  ifdown-post      ifup-bnep   ifup-routes
ifcfg-ens3   	ifdown-ppp       ifup-eth    ifup-sit
ifcfg-lo        ifdown-routes    ifup-ippp   ifup-Team
ifdown          ifdown-sit       ifup-ipv6   ifup-TeamPort
ifdown-bnep     ifdown-Team      ifup-isdn   ifup-tunnel
ifdown-eth      ifdown-TeamPort  ifup-plip   ifup-wireless
ifdown-ippp     ifdown-tunnel    ifup-plusb  init.ipv6-global
ifdown-ipv6     ifup             ifup-post   network-functions
ifdown-isdn     ifup-aliases     ifup-ppp    network-functions-ipv6
[root@dns-02 network-scripts]# 

Change the configuration to reflect the new interface ens3.

Open the configuration file editor and make changes to the Name and Device fields.

From below

[root@dns-02 network-scripts]# cat ifcfg-ens33 
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR="192.168.1.29"
PREFIX="26"
GATEWAY="192.168.1.1"
DOMAIN="getlabsdone.com"
[root@dns-02 backup_network]#

To

[root@dns-02 network-scripts]# cat ifcfg-ens3
TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
NAME="ens3"
DEVICE="ens3"
ONBOOT="yes"
IPADDR="192.168.1.29"
PREFIX="26"
GATEWAY="192.168.1.1"
DOMAIN="getlabsdone.com"
[root@dns-02 network-scripts]#

That’s it, let’s restart the network services

Service network restart

Network verification

Now if you do ifconfig or ip addr you can see the device interface details appeared.

Ifconfig

[root@dns-02 ~]# ifconfig
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.101.8.29  netmask 255.255.255.192  broadcast 10.101.8.63
        inet6 fe80::ebd:33ff:fe04:3900  prefixlen 64  scopeid 0x20<link>
        ether 0c:bd:33:04:39:00  txqueuelen 1000  (Ethernet)
        RX packets 10715  bytes 3430245 (3.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1324  bytes 115370 (112.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 122  bytes 10080 (9.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 122  bytes 10080 (9.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@dns-02 ~]#

IP addr

[root@dns-02 network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 0c:bd:33:04:39:00 brd ff:ff:ff:ff:ff:ff
    inet 10.101.8.29/26 brd 10.101.8.63 scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::ebd:33ff:fe04:3900/64 scope link 
       valid_lft forever preferred_lft forever
[root@dns-02 network-scripts]# 

You can also start pinging the default gateway to see if it’s responding or not.

[root@dns-02 network-scripts]# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=255 time=5.28 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=255 time=2.04 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=255 time=1.09 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=255 time=3.10 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=255 time=1.05 ms
64 bytes from 192.168.1.1: icmp_seq=6 ttl=255 time=1.35 ms
64 bytes from 192.168.1.1: icmp_seq=7 ttl=255 time=1.21 ms
64 bytes from 192.168.1.1: icmp_seq=8 ttl=255 time=1.13 ms
64 bytes from 192.168.1.1: icmp_seq=9 ttl=255 time=2.24 ms
^C
--- 192.168.1.1 ping statistics ---
9 packets transmitted, 9 received, 0% packet loss, time 8014ms
rtt min/avg/max/mdev = 1.058/2.058/5.283/1.313 ms
[root@dns-02 network-scripts]# 

yes, it’s responding. which means the network is up and running.

To make sure everything works great you can verify one more thing.
Use the interface shutdown command to see if the interface goes down, and use the unshut command to bring up the interface back.

To shut the interface in linux type

ifdown esn3

To unshut interface

ifup ens3 

You can see the device came backup as well.

[root@dns-02 network-scripts]#ifup ens3 
[root@dns-02 network-scripts]# ifconfig
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.29  netmask 255.255.255.192  broadcast 192.168.1.63
        inet6 fe80::ebd:33ff:fe04:3900  prefixlen 64  scopeid 0x20<link>
        ether 0c:bd:33:04:39:00  txqueuelen 1000  (Ethernet)
        RX packets 11073  bytes 3495029 (3.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1489  bytes 136118 (132.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 122  bytes 10080 (9.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 122  bytes 10080 (9.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@dns-02 network-scripts]# 
[root@dns-02 network-scripts]# 
[root@dns-02 network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 0c:bd:33:04:39:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.29/26 brd 192.168.1.63 scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::ebd:33ff:fe04:3900/64 scope link 
       valid_lft forever preferred_lft forever
[root@dns-02 network-scripts]#