Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»How to Configure DNS Settings on Ubuntu & LinuxMint

    How to Configure DNS Settings on Ubuntu & LinuxMint

    By RahulOctober 21, 20151 Min Read

    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
    

    dns nameserver network
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to List Manually Installed Packages in Ubuntu & Debian

    10 Bash Tricks Every Developer Should Know

    How to Validate Email Address in JavaScript

    View 3 Comments

    3 Comments

    1. Atilla Biber on January 9, 2021 12:39 pm

      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.

      Reply
    2. Atilla Biber on January 9, 2021 12:32 pm

      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

      Reply
    3. Papirous on July 11, 2016 11:53 pm

      HI.
      Then, What about the method by modify as root attributes the file /etc/resolv.conf ?

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.