0

I have a laptop connected to a router using a wire. Today, the wired connection stopped working for no apparent reason. When I try to ping the router, I get "ping: connect: Network is unreachable". I can connect via wireless (as I do now), but not using a wire. In the network settings, I see "Cable unplugged". In an attempt to debug this error, I looked at my /etc/network/interfaces file, which contained only the following lines:

auto lo
iface lo inet loopback

ifconfig gives different results; sometimes it just gives this:

enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 70:5a:0f:d8:0a:f7  txqueuelen 1000  (Ethernet)
        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
        device interrupt 16  memory 0xe1200000-e1220000  

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 1000  (Local Loopback)
        RX packets 2678  bytes 200055 (200.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2678  bytes 200055 (200.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

and sometimes there is another segment:

enp0s31f6:avahi: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 169.254.8.252  netmask 255.255.0.0  broadcast 169.254.255.255
        ether 70:5a:0f:d8:0a:f7  txqueuelen 1000  (Ethernet)
        device interrupt 16  memory 0xe1200000-e1220000  

Following some advice on the Internet, I added the following lines to the /etc/network/interfaces file:

auto eth0
iface eth0 inet dhcp

and rebooted, but it did not help. I replaced them with this:

auto enp0s31f6
iface enp0s31f6 inet dhcp

but then, when I rebooted my laptop, it stuck during boot, so I removed them.

Rather than trial-and-error, I would be very happy to know, what is the correct content of /etc/network/interfaces in my system?

3
  • The file /etc/network/interfaces is deprecated in Ubuntu 17.10 and later in favor of Network Manager for desktop installations and netplan for servers. @Pilot6 answer is entirely correct. I suggest that you troubleshoot the driver for your ethernet. – chili555 Jan 3 at 20:48
  • @chili555 thanks. What do you mean by "troubleshoot the driver for your ethernet" - where do I start? – Erel Segal-Halevi Jan 3 at 20:54
  • Please start a new question and include: lspci -nnk | grep 0200 -A3 It will show the driver in use. Then we'll check the log to see if the driver is stumbling and if we can fix it. – chili555 Jan 3 at 21:11
2

You have the correct content of /etc/network/interfaces.

It should be

auto lo
iface lo inet loopback

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.