Skip to content

How to Configure DNS Settings on Ubuntu & LinuxMint

How to Configure DNS Settings on Ubuntu & LinuxMint. This tutorial will help you to how to configure dns server settings on Ubuntu, Debian and LinuxMint

Category
Networking
Covers
DNS, Linux Mint, Ubuntu
On this page

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

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

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

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top