How to Configure DNS Settings on Ubuntu & LinuxMint

To configure your system on network and access internet. You also need to configure dns server. It is necessary to access websites by their name. When we visit a website, system first search for dns server we provided in configuration file. Then query to that DNS server for providing ip address corresponding to that domain.

Setup DNS Servers

Edit network configuration file (/etc/network/interfaces) on your system and add dns servers to specific network interface. In my system network interface is named as eth1. It may change in your system, So use name accordingly.
$ sudo vi /etc/network/interfaces 
auto lo iface lo inet loopback  auto eth1 iface eth1 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 
As per above example we have added 8.8.8.8 as our dns server. If you need to add more than one dns, add them with space separated.
dns-nameservers 8.8.8.8 8.8.4.4 

Restart Network Services

After making all necessary changes, just restart networking service.
$ sudo service networking restart 
If above command doesn’t work, Use following commands. Change eth1 with your system’s interface name.
$ sudo ifdown eth0 && sudo ifup eth0 

Thanks for Visit Here

Comments