Setting static IP address and DNS nameserver to network interfaces
If you’re installing an Ubuntu server, and you need set to it a static IP address and some nameservers, you can use the power of bash for it :). To set a static address for an interface, eth0 for instance, you can do this:
sudo vim /etc/network/interfaces
And put in this file the lines as below:
iface lo inet loopback
iface eth0 inet static
dns-nameservers 18.104.22.168 22.214.171.124
Pay attention for two last lines, those lines will be up your interface using those DNS nameservers. With it you don’t need to set a nameservers on /etc/resolv.conf, once on Ubuntu’s boot you erase all your modifications on it.
Comparing to CentOS, the boot process doesn’t replace dns-nameservers of /etc/resolv.conf, particularly I like it, I don’t see no reasons to Ubuntu clean this file.