If the Ubuntu Server installer
has set your server to use DHCP, you will want to change it to a static IP
address so that people can actually use it.
Changing this setting without a GUI
will require some text editing, but thatís classic Linux, right?
Letís open up the /etc/network/interfaces
file. Iím going to use nano, but you can choose a different editor
sudo nano /etc/network/interfaces
For the primary interface, which is
usually eth0, you will see these lines:
iface eth0 inet dhcp
As you can see, itís using DHCP
right now. We are going to change dhcp to static, and then there are a number
of options that should be added below it. Obviously youíd customize this to
iface eth0 inet static
dns-servers 192.168.1.11 192.168.1.12 126.96.36.199 188.8.131.52
Now weíll just need to restart the
sudo /etc/init.d/networking restart
If setting the DNS does not work in the Interfaces then try the suggestion below:
Keep it mind that Ubuntu appends a tail file to the resolv.conf file that it generates.
sudo nano /etc/resolvconf/resolv.conf.d/tail
Which will open a blank resolv.conf.d file in the nano text editor. You will need to place your DNS server address on the first line of this file and remember to end the line with a carriage return (hit enter) as seen below:
Editing the tail file instead of the actual resolv.conf file will prevent your change from being lost upon a system reboot.
You will need to run sudo
resolvconf -u to activate the change. You should be able to ping google.com after this.