My internet connection has gone suddenly and I find my /etc/network/interfaces is completely empty, I can't ping my router and ifconfig for eth0 shows no ip address or broadcast address, I tried network manager but it can't find a network, I tried adding eth0 to ip4 with its address and dns address. I'm completely stumped. The last thing I did before I rebooted to find no connection was run this command for sound
sudo alsa force-reloadI don't know if that could've caused, I'm at a loss, if anyone knows the correct way of getting a connection back from scratch I'd be euphoric
thanks
I've got to the stage where if I open etc/network/interface from the command line it's completely blank but if I open the file manually its populated but i can't edit it because it's read only even if I log into root, I'm not sure if there are two files but I can't find a way of finding out their directory addresses, sorry for my lack of knowledge, I guess there's an easy way, I guess the proper one has moved, how can I change permissions if root won't let me and get it back into its proper place
2 Answers
For Desktop versions of Ubuntu (which use NetworkManager) the /etc/network/interfaces file should contain only the following loopback interface definition:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopbackIf your /etc/network/interfaces file is really completely empty, then paste the above into it, save and reboot.
Try
ifconfig eth0 IP_ADDRESS netmask 255.255.255.0 upto see if the network interface is actually available to the system. Just because it is not showing inside the /etc/network/interfaces it does not mean it is gone. Routers usually have some standard IP address like 192.168.1.1, 192.168.2.1 etc. You can also check its manual too see the details if you have not changed the configuration that is. ;)
I stumbled upon a similar problem here. Although its in a virtual environment it might be able to help you. You can also see a very basic structure of such file and fill the rest as you see fit.
As for the empty file I'm not sure how this happened. Upon shutdown system might have crashed (go figure why...) and data loss might have occurred, which in your case is unfortunate since this very important file has turned into garbage.
2