Set A Static DNS Server Address From The Terminal In Ubuntu 13.10 Saucy Salamander

Gateway

It is not immediately obvious how to set a static DNS server address from the command line in Ubuntu 13.10 Saucy Salamander. In the Desktop version of Ubuntu, you can of course use the graphical Network Manager to assign a static DNS server. In the Server version, things are a little more complicated. This post will explain how to use the resolvconf utility to set a static address for the DNS server. (In this example, we will assume your DNS server has an address of 192.168.1.100.)

First, log into Ubuntu, and then navigate to this directory:

 /etc/resolvconf/resolv.conf.d

Once you are in the appropriate directory, use this command to launch the vi text editor:

 sudo vi /etc/resolvconf/resolv.conf.d/head

This will open up resolvconf’s head text file in vi. Once vi has launched, press the INSERT key to switch vi to edit mode, and then enter the following line:

 nameserver 192.168.1.100

Then hit the ESC key to switch vi back to command mode, and type this command to save the edited text file and then quit vi:

 :wq

Once vi exits, type this command:

 sudo resolvconf -u

The resolvconf utility will then read the head file and set the static DNS server address you entered.

-JM