Ubuntu Linux Configure DNS Name Servers IP Address via Terminal

To change existing name server IP address or to configure DNS name server IP address under Ubuntu Linux/Debian Linux, to configure DNS name resolution under Ubuntu Linux, you need to edit /etc/resolv.conf file under Debian/Ubuntu Linux to set Name server IP address that the resolver should query. Up to 3 name server internet IP address can be defined. If there are multiple servers, the resolver library queries them in the order listed.

To edit the dns address, type the following command, enter:
$ sudo vi /etc/resolv.conf

edit-dns-on-ubuntu

Or You can use gedit/nano text editor as follows:
$ sudo nano /etc/resolv.conf

Now enter your desired name server address as follows:
restart-network-ubuntu

Now save the above and restart the network as follows:
$ sudo /etc/init.d/networking restart
edit-dns-ubuntu

Thats it.

Leave a Reply