Device eth0 doesnt exist but network is up!

Issues related to configuring your network
Post Reply
nix99
Posts: 20
Joined: 2014/03/31 05:04:08

Device eth0 doesnt exist but network is up!

Post by nix99 » 2019/01/14 09:02:18

Hi.

I have a script running for long time and suddenly it started giving error :

"Device "eth0" does not exist."

network is up and when I restart it I dont get errors "service network restart"

also, ifcfg-eth? are there and syslog isnt showing any errors

more over, using command like:

ip -o -4 a | awk '$2 == "eth0" { gsub(//.*/, "", $4); print $4 }'

ip addr show dev eth0 scope global | grep "inet\b" | cut -d/ -f 1 | egrep -o "([[:digit:]]{1,3}[.]{1}){3}[[:digit:]]{1,3}"

ip -f inet a show eth0|grep -oP "(?<=inet ).+(?=/)"

all above are reporting the ip addresses without errors.

but the command is giving "device eth0 doesnt exist is:

"ip addr show ${net_interface} | grep -Eo '\<[[:digit:]]{1,3}(.[[:digit:]]{1,3}){3}>' | head -1"

what could cause it not to work suddenly?

Thank you.

Whoever
Posts: 1065
Joined: 2013/09/06 03:12:10

Re: Device eth0 doesnt exist but network is up!

Post by Whoever » 2019/01/14 16:06:47

What does the following show:

Code: Select all

ifconfig -a

nix99
Posts: 20
Joined: 2014/03/31 05:04:08

Re: Device eth0 doesnt exist but network is up!

Post by nix99 » 2019/01/14 17:41:15

Thanks for the reply

# ifconfig -a (changed the IPs)

eth0 Link encap:Ethernet HWaddr C8:60:00:DF:60:58
inet addr:1.2.3.4 Bcast:1.2.3.7 Mask:255.255.255.224
inet6 addr: fe81::ca60:ff:feef:848/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:239844 errors:0 dropped:0 overruns:0 frame:0
TX packets:340845 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26694190 (25.4 MiB) TX bytes:69307720 (66.0 MiB)

eth0:1 Link encap:Ethernet HWaddr C8:60:00:DF:60:58
inet addr:1.2.3.5 Bcast:1.2.3.7 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:2 Link encap:Ethernet HWaddr C8:60:00:DF:60:58
inet addr:1.2.3.6 Bcast:1.2.3.7 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:114304 errors:0 dropped:0 overruns:0 frame:0
TX packets:114304 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:39595988 (37.7 MiB) TX bytes:39595988 (37.7 MiB)

tyler2016
Posts: 13
Joined: 2019/02/07 16:06:54
Contact:

Re: Device eth0 doesnt exist but network is up!

Post by tyler2016 » 2019/03/11 10:51:29

Where is your script setting the $net_interface variable? Can you post the output of the command it is using? What are you trying to do by getting that interface's IP address?

Post Reply