centos7 set up dns server dnsmasq
DNS server is a domain name server that provides the DNS server.
DNS works and the process is divided into the following steps:
Step one: The client asked domain name resolution request, and the request is sent to the local domain name server.
Step Two: When the local domain name server receives the request, it first check the local cache, if the record entry, the local name server directly to the results of the query returns.
Step 3: If the local cache does not have the record, the local domain name server directly to the request sent to the root name servers, root name servers and then back to the local domain name server a primary domain (the root of the subdomain) queried address of the server.
Step four: local server and then return to step up the domain name server sends a request, and then query the server to accept the request of its own cache, if there is no such record, the address associated with lower levels of the domain name server is returned.
Step five: Repeat Step Four until you find the correct record.
Step Six: The local domain name server to save the results returned to the cache, in order to prepare for the next use, and will also return the results to the client.
installation
- A selected network of machines, install this program dnsmasq
- Then start the application
- Let him boot from the start
- Configuration
1. Select a machine within the network, the installation program dnsmasq
yum install -y dnsmasq
2. Then start the application
systemctl start dnsmasq
3. let him boot from the start
systemctl enable dnsmasq
4. Other modifications network machines provided dns
There are two ways to modify
- Modify the DNS settings of the network card
echo 'DNS1=XXX.XXX.XXX.XXX'>> /etc/sysconfig/netwrok-scripts/ifcfg-XXX
/etc/init.d/network restart
- modify
/etc/resolv.conf
increasenameserver
Install nscd management dns cache
yum install -y nscd
systemctl start nscd
systemctl enable nscd
Refresh Cache
systemctl restart nscd
dig command to test dns
# 安装dig工具
yum install -y net-tools
dig XXX.cn @XXX.XXX.XXX.XXX
Adding DNS
Simply modify the machine above the installation of dnsmasq /etc/hosts
can best refresh the cache