I just installed Ubuntu Server yesterday on my old laptop. I can't ping externally or my router. To start, I figured out that instead of "eth0" I have "em1", and I got it so I now see em1 in ifconfig.
/etc/networks/interfaces
auto em1
iface em1 inet loopback
address 192.168.1.120
netmask 255.0.0.0
network 192.168.1.1
broadcast 192.168.1.255
When I ping my router, I get "Destination Host Unreachable"
And when I ping google.com, I get "Unknown host google.com"
And when I ping a computer on this network, I get "Network is unreachable"
I took note of my computer that is connected to this network properly, so I changed /etc/networks/interfaces to
auto em1
iface em1 inet loopback
address 192.168.1.120
gateway 10.0.0.1
netmask 255.255.255.0
network 192.168.1.1
broadcast 192.168.1.255
Now I can't see the IP4 address in ifconfig and it says "Network is unreachable" when I ping the router.
Is there something I'm missing? I don't have much experience with networking.
edit 1
Thanks! After some changes I am able to ping my router and 8.8.8.8. Another problem I had was my router's gateway was actually 10.0.0.1, I forgot because I'm used to 192.168.1.1. For some reason though I have to assign a temporary IP via command line, shouldn't that file do that automatically?
Also, while I can ping 8.8.8.8, I can't ping google.com, even after adding it in the interfaces file. nsloopup isn't working either, it times out.
ip route
default via 10.0.0.1 dev em1
10.0.0.0/24 dev em1 proto kernel scope link src 10.0.0.10
edit 2
spelling error, now I can ping google 😀
Best Answer
You shouldn't have messed with the pre-existing
lo
(loopback) interface: you need to revert that toand then add your external static interface, for example
(these are not necessarily correct for your network: you will need to verify). You will also likely need to add at least one DNS nameserver e.g. to use Google's public DNS servers
Alternatively, if your router supports DHCP address reservation you might want to use that instead - it's arguably simpler, especially for home networks.