ping: unknown host google.com in UBUNTU SERVER [duplicate]
If you're using a static IP you should also add DNS servers.
-
Edit
/etc/network/interfaces
:sudo nano /etc/network/interfaces
-
Below
iface eth0 inet static
add the following line:dns-nameservers 8.8.8.8 8.8.4.4
This will use Google's DNS servers.
-
Restart your network:
sudo /etc/init.d/networking restart
Note: as chaos says, you can also edit /etc/resolv.conf
but these changes will be overwritten on reobot.
Note2: Sometimes sudo /etc/init.d/networking restart
is not enough, but a full reboot helps.
Create a file called /etc/resolv.conf
write fill in the contents:
nameserver <ip-of-your-nameserver>
For example if your want to use googles dns-service:
nameserver 8.8.8.8
nameserver 8.8.4.4