By default, the Ubuntu Server installer will set your server to use DHCP. You may want to change it to a static IP address, or else you may need to update people the server IP address when you reboot your system.

We can set static IP address & DNS nameserver in file /etc/network/interfaces. Open the file with root priority:

sudo vim /etc/network/interfaces

For the primary interface, which is usually eth0, you will see these lines:

auto eth0 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 your network.

auto eth0 iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 dns-nameservers 192.168.1.0

You also need to change eth0 parameters to eth1 or something else according to your server’s basic config.

Please pay attention to the last line of DNS nameserver settings. I think it is the best way to set the DNS settings.

If you add your DNS settings by editting resolv.conf file, it can just work well on current time. When you reboot your system, you will lose it!

Now we’ll just need to restart the networking components:

sudo /etc/init.d/networking restart

You can ping a web URL (for example, www.google.com) to check your settings. If you get the ping back info, name resolution is working.