Setting static IP on Ubuntu Server 12.04 makes loss of external connection
ip, static, ubuntu
Solution
Ubuntu 12.04 use resolvconf (a set of scripts and hooks) instead of resolv.conf to manage DNS server. The most notable difference for the user is that any change manually done to /etc/resolv.conf will be lost as it gets overwritten next time something triggers resolvconf.
To add the static dns entries in resolv.conf file,edit `/etc/resolvconf/resolv.conf.d/base`:
Add these lines (the example below is OpenDNS’s public name servers):
nameserver 208.67.222.222
nameserver 208.67.220.220
Run this command to refresh the resolvconf setting:
sudo service resolvconf restart
To view your DNS Servers addresses, use this command:
cat /etc/resolv.conf
Problem
I have a problem with static IP under Ubuntu 12.04. With DHCP I have no problem, but when I set (under `/etc/network/interfaces`) the static address, the gateway, the subnetmask and the dns-nameservers, I have that the Server cannot connect to external world. It is able only to connect to local IP hosts. I have tried to insert the nameservers in the `/etc/resolv.conf` but every time I restart the machine, the changes are canceled. What could be the problem?