Tutorials

Set up dns on ubuntu and debian

Table of contents:

Anonim

There are at least two different ways to configure DNS in Ubuntu and Debian. It is as simple as editing the DNS servers using the console or editing the addresses through the graphical interface.

Edit DNS by terminal

The first option that we are going to teach you is to be able to configure the DNS servers using the console.

The first thing to do is open a terminal in Ubuntu / Debain by pressing Ctrl + ALt + T or you can also do it by clicking Applications -> Accessories -> Terminal . Next you will have to edit the file settings of the DNS servers using the vi or vim command:

$ sudo vi /etc/resolv.conf

The vi or vim command is the most used to edit configuration files or create your own script and can be considered the command that all distributions bring as standard.

You will need to add the IP addresses of the DNS servers to that file. You can add the servers you want, using the command repeatedly (nameserver + IP address ), you can also, in case you don't remember it , use IP 8.8.8.8 , which belongs to a Google DNS or any of the Public DNS and free that we already indicated previously in our blog.

# DNSnameserver server configuration 8.8.8.8

These modifications must be done logged in with the root user.

Thirdly, you must restart the network interfaces so that the changes have been applied correctly, to do this you can do it like this:

# sudo /etc/init.d/networking restart

If this command will generate any type of inconvenience, you can disable and re-enable the interface that you have configured, doing it as follows.

$ sudo ifconfig eth0 down $ sudo ifconfig eth0 up

Finally we must check if there is connectivity with other computers on the network and that you have an internet connection.

$ ping 192.168.1.1

This is to check the connection to your gateway (the router).

$ ping google.com

And this to check if there is Internet connectivity.

DNS configuration by graphical interface

The second option to configure DNS in Ubuntu and Debian or any distribution is using the graphical interface .

First of all what we should do is click on system -> preferences and then go to network connections .

A tab will open where you can check the different network interfaces that the equipment has. In the tab that says wired you will see the Ethernet interfaces and where it says wireless you will see the interfaces of wireless networks. To be able to edit its properties you just have to select it and press the button that says edit.

For optimal configuration of DNS servers, you must first assign a fixed IP to the selected network interface, clicking on the IPv4 Settings tab, and then opting for the Manual Method selection in the drop-down and then clicking on add.

The netmask, address and gateway parameters must be configured with the exact values ​​of your local network. To finish, in that same window you can configure the IP of the DNS server of the network. In case you don't remember you can use IP 8.8.8.8 which is Google's DNS address.

We already have our DNS configured!

With this we conclude our tutorial on how to configure DNS in Ubuntu and Debian. For us it is very important that you share on your social networks and leave us a comment.

Tutorials

Editor's choice

Back to top button