How to Enable DNS Server on Linux by Opening Port 53(linux开启53)
To enable DNS server on Linux, you must open port 53 and allow access to the DNS server. In this tutorial, we will look at how to open port 53 and enable DNS server on Linux.
## Step 1: Check if the DNS Server is Installed
Before we enable the DNS server, we must first check if the DNS server is installed on the Linux server. To do this, open up a terminal window and enter the following command:
rpm -qa bind
This command will list all the installed packages with the name “bind”. If the packages are not found, you must install the DNS server.
## Step 2: Allow Access to the DNS Server
Once we have verified that the DNS server is installed, we need to allow access to the DNS server. To do this, we need to open port 53. To open port 53, we will use the `iptables` command. Enter the following command in the terminal window:
sudo iptables -A INPUT -p tcp --dport 53 -j ACCEPT
This command will open port 53 and allow traffic to the DNS server.
## Step 3: Enable the DNS Server
Once we have opened port 53, we need to enable the DNS server. To do this, we will use the `systemctl` command. Enter the following command in the terminal window:
sudo systemctl enable named
This command will enable the DNS server.
## Step 4: Start the DNS Server
Finally, we need to start the DNS server. To do this, enter the following command in the terminal window:
sudo systemctl start named
This command will start the DNS server and make it available for use.
## Conclusion
In this tutorial, we looked at how to enable DNS server on Linux. We looked at how to check if the DNS server is installed and how to open port 53 and enable the DNS server. Finally, we looked at how to start the DNS server. Hopefully, this tutorial was helpful and you were able to enable the DNS server on Linux.