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.

Advertisement

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
Share.

3 Comments

  1. On Linux Mint, try this:
    resolvectl dns (interface_name) (ip_of_dns_server)
    where (interface_name) is the name for your network card (you can use “ifconfig” to get it)
    and (ip_of_dns_server) is the IP address of the DNS server you want your system to use.
    For me, the command was:
    resolvectl dns wlp0s20f3 8.8.8.8

    Note: In the previous comment, I used angle brackets to denote the parts to replace in the command, but they were stripped out, so I’m reposting the comment, using parentheses instead.

  2. On Linux Mint, try this:
    resolvectl dns
    where is the name for your network card (you can use “ifconfig” to get it)
    and is the IP address of the DNS server you want your system to use.
    For me, the command was:
    resolvectl dns wlp0s20f3 8.8.8.8

Exit mobile version