How To Set Google DNS On Your Linux Computer (Terminal)

Modified on: Mon, 17 Oct, 2016 at 2:01 PM


Linux (Terminal)


This page will guide you through the setup process on a Linux computer using the built-in terminal, which is available on almost all versions and distributions of Linux.

If you are using Ubuntu and would like to set Google DNS via its Unity desktop environment, kindly refer our instructions here:


How To Set Google DNS On Your Linux Computer (Ubuntu)


  1. Go to your Terminal and type in sudo bash . This will give you super user privilege.


  2. Once you have the super user (administrator) access, type in the command below to back up your network configuration file.

    cp /etc/resolv.conf /etc/resolv.orig

    1.png



  3. Next, type in the command below to remove the resolv.conf file.

    rm /etc/resolv.conf

    2.png



  4. Now, type in the command below one at a time.

    echo "nameserver 8.8.8.8" > /etc/resolv.conf

    3.png


    echo "nameserver 8.8.4.4" >> /etc/resolv.conf

    4.png



  5. Finally, type in the command below.

    cat /etc/resolv.conf

    If the set up was successful , it will display the Google DNS that you've specified earlier.

    5.png





If you wish to set a custom DNS on a different device or system, please refer to our article here:


How to Set Google DNS on your device / system

If you have any problems or need further assistance, please email us at support@my-private-network.co.uk. We'll get back to you as soon as possible and try to help.


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.