How to Configure DNS in Mikrotik?
If you are active in the internet world, you know that DNS is like a phone book. The phonebook that you receive the domain name and gives the IP address to the browser (or vice versa) so that the user’s request can be answered correctly. Configuring DNS in Mikrotik also lets your router act as a DNS server. Therefore, by purchasing a Mikrotik virtual server, you will not only improve the performance of your network, but by accessing its various features, you can use your router in multiple fields.
By configuring DNS in Mikrotik, the router acts as a DNS server that can easily translate domain addresses to IP addresses and vice versa.
For this tutorial, we have used the Winbox tool. Suppose you follow all the steps carefully and set the addresses and options according to your needs. In that case, you can be sure that you will not encounter any problems or errors in the process of configuring DNS in Mikrotik:
What does DNS do?
The same is valid for web users. When a user enters a domain name (www.example.com) in the browser bar, the browser first sends this request to the DNS server. The server returns the IP address of that domain to the browser. Then, using this IP address, the browser can communicate with the web server, receive the necessary information, and provide it to the user.
* Using the ping command, you can see the IP address of a specific domain!
Run CMD as Run as Administrator:
DNS protocol is of client-server type. In this way, the DNS Client requests the server to convert the domain name to the IP address, and the DNS Server responds to this request.
The Mikrotik router has DNS Client and DNS Server features that translate the domain address to the IP address. In addition, DNS Server converts domain names to IP addresses for all clients connected to the server itself (not the router).
So why should we use Mikrotik’s DNS server?
If you want to use the public DNS server of the ISP, you need bandwidth for every request made through the WAN connection, which you have paid for, and too many requests lead to delays.
But suppose you use your router as a DNS server by configuring DNS in Mikrotik. In that case, you can cache DNS information related to the server, save bandwidth, and quickly respond to client requests. The Mikrotik DNS server is more reliable, faster, and secure than a public one.
How to configure DNS in Mikrotik
The following steps will show you how to configure the DNS service on your MikroTik router.
1) Open inbox.
Open the Winbox program and enter the Mikrotik router’s main dashboard by entering your router’s address.
2) Go to the DNS section.
From the left menu, find the IP option and click on it. Select DNS from the corresponding submenu.
3) Complete the fields of the DNS setting window.
After clicking on DNS, the following window will open:
In the Servers section, enter the IP address of your network’s DNS server or the public DNS IP such as 8.8.8.8 and 8.8.4.4, which belongs to Google.
– If you use a dynamic server for DNS, enter its IP in the Dynamic Servers section. Otherwise, ignore this section.
– Tick the Allow Remote Request option to use your Mikrotik server as a DNS server and respond to users’ requests. Also, by activating this option, the caching feature of the router’s DNS server is started.
– Determining the maximum UDP packet size is done through the Max UDP Packet Size section.
– Using the Query Server Timeout field, you can determine the waiting time for the router to receive a response from the DNS server (in seconds).
– The Query Total Timeout field corresponds to the total waiting time you have considered for the DNS response (in seconds).
– The Cache Size field determines the cache space’s size.
– Determining the time required to cache a query before a new request is made through the Cache max TTL field.
– The amount of Cache Used is determined by the Mikrotik router itself.
4) Apply the settings.
After specifying the values of each of the fields, click Apply and then click OK.
Set DNS entry statically
Even though the DNS server receives and processes each entry, it saves the cache memory’s corresponding domain and IP address. Still, if, for any reason, you want to statically link a specific domain and IP address and store it in the DNS cache, put your Mikrotik router server, you must act as follows:
– Open Windows and click on IP to open the DNS window.
– Click on the Static button to open the DNS Static window.
– Then click on +.
– Enter the name of the desired host or domain in the Name field and then enter the corresponding IP address.
Enter static input
– The TTL section is set to 1 day, which is enough, so there is no need to change its value.
Finally, click apply and OK to save this new entry in the static DNS list.
Conclusion
Using the Mikrotik router as a DNS server brings many advantages, the most important of which is a high speed and security in responding to user requests. Configuring DNS in Mikrotik is done in a few short and simple steps, and we owe this simplicity to the simple graphic interface provided by the Winbox tool.
Thank you for staying with us until the end of the article. We hope that reading this article was helpful for you. If you have any questions or requests and need guidance, you can contact us by registering your opinion so we can answer you as soon as possible.
Frequently Asked Questions:
Can we use the terminal to configure DNS in Mikrotik?
Yes, it is enough to connect to Mikrotik using SSH or console and enter the following command:
ip dns set servers=8.8.8.8,8.8.4.4 allow-remote-requests=yes max-udp-packet-size=4096 query-server-timeout=2.000 query-total-timeout=10.000 cache-size=2048 cache-max -ttl=7d
Can other users use the DNS IP of my Mikrotik router as the DNS server IP?
Yes, but this can consume your bandwidth. You can use new firewall rules to block external DNS requests so your DNS server performance does not degrade.