Linux DNS: Essential Information You Need to Know
DNS (Domain Name System) is an extremely important server for the internet to work.
In summary, it works to translate IP addresses to the domain names of a website.
When creating a website, on any operating system, you need to configure DNS for it to work correctly.
In this article, we will explain more about what DNS is and some different ways to configure it on Linux.
Happy reading!
Understand what DNS is and what it's for
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 specific site is sent to DNS, which verifies data, finds the page, and redirects you to the IP of the server in question.
If DNS didn't exist, sharing a URL would be completely different from what it is today. Basically, people would have to search through IP addresses.
In other words, URLs would be a series of numbers. DNS is useful for making access easier through simpler addresses, eliminating the use of number sequences.
Furthermore, DNS enables website creators to name their URL, making it simpler to share among consumers.
There is an international association that manages access to all worldwide websites. ICANN, which stands for Internet Corporation for Assigned Names and Numbers.
This is why, regardless of where you search for a URL, it will work, except in some cases of blocking in another country.
Linux DNS: what is DNS on Linux after all?

DNS is a server that needs to be configured on whatever operating system your computer uses.
That way, when creating a website or blog, you need to configure your DNS for it to work correctly.
Linux is an open-source operating system, allowing greater control through terminal commands.
Therefore, to configure DNS on a Linux computer, you need to follow a series of steps involving the well-known commands.
Types of DNS records on Linux
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 configure a new DNS, but create a subdomain.
There are also sites that want to add functionalities, such as an email server or a File Transfer Protocol server.
For this, some DNS records are available. Check out the main ones:
- A Records: associate IP addresses to domains;
- NS (Name Server) Records: locate DNS servers;
- CNAME (Canonical Name) Records: redirect to domains and subdomains;
- PTR (Pointer) Records: associate domains to IP addresses;
- MX (Mail Exchanger) Records: perform email account configuration.
DNS Linux: understand domains and zones
Domains and zones are two terms that will be widely discussed 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, for example, linux.com is stored in a zone file linux.com.txt.
There is a root domain zone, known as Root Domain, and below 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 can accommodate subdomains such as blog.linux.com.
When a zone is created, it is stored on a DNS server, which contains all domains and subdomains of that zone.
Now that we better understand the relationship between zone and domains, let us explain 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 software released in the 1980s.
The BIND server is widely used on Linux servers and, therefore, it is necessary to learn more about it when working with the operating system.
It works, basically, by turning a common server into a Linux DNS server. This can be done for both public and private internet network, or LAN in more technical terms.
Learn how to find Linux IP DNS (server IP)
To find the server IP on Linux, you can use the following terminal commands:
cat /etc/resolv.conf
grep "nameserver" /etc/resolv.conf
There is also another option, which is the nmtui command.
Additionally, you can check if DNS is working on your Linux computer. For this, use the dig and nslookup commands.
Learn how to configure Linux DNS

The most common method to configure Linux DNS is through the BIND package, which we explained earlier.
First, start by opening the configuration file. To do this, type the following command:
$ sudo vi /etc/resolv.conf
Then, it is necessary to indicate the IP address that leads to your website. So, if you have two servers at addresses 192.000.00.0 and 192.000.00.1, the command will be:
search meuisp.pt nameserver 192.000.00.0 nameserver 192.000.00.1
You then need to restart the network service using the command:
$ sudo /etc/init.d/networking restart
Then you need to run the ifconfig-a file to execute the settings according to your site details.
To learn more about this configuration, click this link where we explain it in more detail.
Conclusion
This article aimed to better explain Linux DNS. In other words, about the ways DNS relates to the open-source operating system.
For those who are in the learning process, understanding how to configure DNS on Linux is essential, as it is an activity required for many Information Technology (IT) professionals.
If you enjoyed the article, we also recommend reading: "How to get LPI certification: EVERYTHING you need to know!".
That was just one piece. The course teaches the whole path — from your first command to exam day.