Installing DNS server under Linux to forward client request

  

Preparation before erection:


To set up a DNS server, you must install a software program that provides DNS service, ie bind software, use The following command can be installed:

yum install -y bind-chroot bind-utis

1. Modify the main configuration file /etc/named.conf

This server The erection is relatively simple, that is, actually use this [so-called DNS server] as a proxy to perform querying DNS information upwards. In this environment, you only need to modify the main configuration file /etc/named.conf to modify it. As follows:


After the above configuration is completed, use the following command to start the DNS service:

/etc/init.d/named start

Remember Need to check after configuration:

Check the content of /var/log/messages (very important!)

tail -n 30 /var/log/messages |  Grep named

named Whether to start successfully Check the information in /var/log/messages!

According to the above steps, you can successfully set up a simple forwarding DNS server. Let's test the DNS server:

2.Test the availability of the forwarding DNS server

1) Method 1: Use the dig command to specify the DNS server address

[root@moban ~]# dig www.google.com @127.0.0.1

After using this command: If found Google's IP, and the words "SERVER:127.0.0.1#53(127.0.0.1)" are displayed at the bottom of the output data, which means it should be successful.

The picture is as follows:


The test is successful!

2) Method 2: Use the address of the built DNS server as the DNS server address on this machine


Test as follows:


You can see that the IP address of the domain name was successfully returned, indicating that the test was successful!

It is not difficult to forward the DNS server. Just modify the main configuration file /etc/named.conf and modify it to the above configuration.


Provide the advantages of the DNS server:

There is to be explained here, because the forwarding DNS server is to hand over the client's DNS request to the upper-level DNS server set by itself. To query the DNS, so as long as the primary DNS server is stable and responsive, the performance of our own DNS server can be greatly improved.


Disadvantages of forwarding DNS servers:

Because many public DNS servers are now intelligent DNS servers, as we have above 202.96.128.86 and 202.96.128.166, this means It can return the server IP list of the corresponding operator according to the type of the client's IP address (it is telecommunications, Netcom or mobile, etc.), so that the client can reach the fastest access speed. So there is a problem here, that is, the forwarding DNS server we set up, no matter what type of carrier is used by the client that uses the forwarding DNS server, the IP address obtained by these clients when querying the IP address of the domain name. It is the type of carrier corresponding to the forwarding DNS server, which affects the speed of the client that forwards the DNS server to the website to some extent (these clients are not using the same carrier when forwarding the DNS server), so the forwarding DNS is set up. Pay particular attention to this issue when working with servers.

Copyright © Windows knowledge All Rights Reserved