Skip to content

Linux DNS - fundamental information on the subject

The DNS (Domain Name System) is an extremely important server for the functioning of the internet.

In short, it works to translate IP addresses into the domain names of a website.

When creating a website, on any operating system, it is necessary to configure the DNS for it to work correctly.

In this article, we’ll explain more about what DNS is and some different ways to configure it on Linux.

Good reading!

Understand what a DNS is and what is it for

The DNS is a server responsible for translating names into IP addresses and vice versa. This process occurs when searching for a URL in the browser.

At that moment, the request to find a particular site is sent to the DNS, which checks data, finds the page and also redirects you to the IP of the server in question.

If DNS didn’t exist, sharing a URL would be totally different from what it is today. Basically, people would have to search through IP addresses.

In other words, the URLs would be a series of numbers. The DNS is useful because it facilitates access through simpler addresses, thus eliminating the use of numbers.

In addition, the DNS allows website creators to name your URL, thus making it easier to share it among consumers.

There is an international association that provides access to all websites worldwide. ICAANN, which in Portuguese translation means Internet Corporation for the Assignment of Names and Numbers.

That is why, regardless of where you search for a URL, it will work, except in some cases of blocking in another country.

Linux DNS: after all, what is DNS in Linux?

linux dns o que éDNS is a server that needs to be configured on whatever your computer’s operating system is.

Thus, when creating a website or blog, it is necessary to configure your DNS so that it works correctly.

Linux is an open source operating system, thus allowing greater control through terminal commands.

Therefore, to configure the DNS on a Linux computer, it is necessary to follow a series of steps involving the well-known commands.

Types of DNS records in Linux

The DNS is a server that has different records, capable of adding some functions to the domain.

Many companies, for example, have a website and a blog. That way, they don’t set up a new DNS, but create a subdomain.

There are those sites that also want to add functionality, such as an email server or a File Transfer Protocol server.

For this purpose, some DNS records are available. Check out the main ones:

  • A records: associate IP addresses with domains;
  • NS (Name Server) records: locate DNS servers;
  • CNAME (Canonical Name) records: redirect to domains and subdomains;
  • PTR (Pointer) records: associate domains with IP addresses;
  • MX records (Mail Exchanger) ): perform the configuration of email accounts.

Linux DNS: understand domains and zones

Domains and zones are two terms that will be extensively covered in a Linux DNS configuration.

Before anything else, it is necessary to understand the difference between the two, as the two properties can cause confusion.

The relationship between the two terms is that any domain, such as linux.com, is stored in a zone file linux.com.txt.

There is a root domain zone, known as the Root Domain and, under it, other zones such as .com, .net, and .org.

Any zone can create others capable of storing subdomain information. In other words, linux.com belongs to the .com zone, and may include subdomains such as blog.linux.com.

When a zone is created, it is stored on a DNS server, which contains all the domains and subdomains of that zone.

Now that we have a better understanding of the relationship between zones and domains, let’s explain to you about the most used Linux DNS server.

BIND: one of the most used DNS servers on Linux

BIND (Berkeley Internet Name Domain), also called named, is a software released in the 1980s.

The BIND server is widely used on Linux servers and, therefore, it is necessary to understand more about it when working with the operating system.

It basically works by turning an ordinary server into a Linux DNS server. This can be done for both public and private internet networks, or LAN in more technical terms.

Learn how to discover Linux IP DNS (server IP)

To find out the server IP on Linux, you can use the following terminal commands:

cat /etc/resolv.conf

grep “nameserver” /etc/resolv.conf

There is still another option, which is the nmtui command.

Additionally, you can find out if the DNS is working on your Linux computer. To do this, use the dig and nslookup commands.

Learn how to set up Linux DNS

linux dns como configurarThe most common method for configuring Linux DNS is through the BIND package, which we have already explained before.

First start by opening the configuration file. To do so, type the following command:

$ sudo vi /etc/resolv.conf

Next, you need to indicate the IP address that leads to your site. So, if you have two servers with addresses 192.000.00.0 and 192.000.00.1, the command will be:

Search myisp.pt nameserver 192.000.00.0 nameserver 192.000.00.1

You then need to restart the network service from the command:

$ sudo /etc/init.d/networking restart

Then you need to run the ifconfig-a file to execute the settings according to the details of your site.

To understand more about this configuration, click on this link that we explain in more detail.

Conclusion

This article aimed to explain to you more about Linux DNS. That is, about the ways in which the DNS relates to the open source operating system.

For those who are in the learning process, understanding how to configure the DNS on Linux is essential, as it is a required activity for several Information Technology (IT) professionals. If you enjoyed the article, we also recommend reading: “How to get an LPI certification: EVERYTHING you need to know!” .