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?