DNS cache significance of the concept and its established
1.DNS meanings:
Domain Name System, the domain name system. As a domain name and IP address of a distributed database mapped to each other, enabling convenient user access to the network on the World Wide Web, is responsible for the exchange of domain names and IP addresses, DNS runs on TCP | UDP port 53
2. What is the DNS cache
DNS servers can cache received from other DNS servers to the DNS records can also be cached in the DNS client service, which as a DNS client information obtained in the course of a recent query cache method end save.
3. the role of DNS cache:
When a host to access a web page for the first time, the host DNS server to get data from a remote server, and caching; so that when the host or a host of other access, directly from the host direct access to the cache, in this way is called a cache.
Configuring the Cache
End real machine
When real machine connected wifi (outside the network), the virtual machine in the case of a real machine can be connected to the external network access function,
Real machine configured as a router, the virtual machines can access the same through the real machine:
Steps:
1) open the firewall masquerading
systemctl start firewalld.server #开启防火墙
systemctl status firewalld.server #查看防火墙状态
systemctl enable firewalld.server #设置开机自启动防火墙
firewall-cmd --list-all # View Information Services
[root@foundation14 ~]#firewall-cmd --list-all #查看服务信息
trusted (active)
target: ACCEPT
icmp-block-inversion: no
interfaces: br0 enp0s25 wlp3s0
sources:
services:
ports:
protocols:
masquerade: no #伪装功能未开启
forward-ports:
sourceports:
icmp-blocks:
rich rules:
firewall-cmd --permanent --add-masquerade # turn masquerading
content: success
[root@foundation14 ~]#firewall-cmd --permanent --add-masquerade
success
[Root @ foundation14 ~] # firewall-cmd --list-all # View Information Services
[root@foundation14 ~]#firewall-cmd --list-all #查看服务信息
trusted (active)
target: ACCEPT
icmp-block-inversion: no
interfaces: br0 enp0s25 wlp3s0
sources:
services:
ports:
protocols:
masquerade: yes #伪装功能开启
forward-ports:
sourceports:
icmp-blocks:
rich rules:
3) Turn on the system kernel routing functions:
[root@foundation14 ~]# sysctl -a | grep ip_forward #从所有系统参数中筛选ip_forward 参数
net.ipv4.ip_forward = 0 #该值为0,表示系统内核路由功能未开启
[Root @ foundation14 ~] # vim /etc/sysctl.conf # modify the file system, writes net.ipv4.ip_forward = 1
[root@foundation14 ~]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.ip_forward = 1
[root @ foundation14 ~] # sysctl -p # loading system parameter from the specified file, i.e., if not specified in the load from /etc/sysctl.conf
net.ipv4.ip_forward = 1 # System to successfully open a routing function
Server
1) Configure the network
nm-connection-editor #设置网络
Or edit files
vim /etc/sysconfig/network-scripts/ifcfg-eth0
内容:DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.114
NETMASK=255.255.255.0
GATEWAY=172.25.254.14 #设置网关为连接外网的真机IP
ping 114.114.114.114 # telecommunications dns cache server ip
View Gateway route -n #
yum install bind.x86_64 -y # install server
systemctl start named # open service
(Cat /etc/rndc.key # encrypted files) # if the service is not started up view
Note: If the service does not start up, just enter a string of characters in the keyboard to start up.
systemctl status firewalld # View the status of the firewall
systemctl stop firewalld # turn off the firewall
netstat -antlupe | grep named # View interface is opened
vim /etc/named.conf # master configuration file editing server (open interface)
content: (lines 11 and 17, edit file "the any")
18 is line editing: forwarders {114.114.114.114;}; # setting request forwarding dns to which the service area /
32 line to "yes" into "no" # dns server does not detect
Client
vim /etc/resolv.conf # ip in order to access the service side of
the contents: nameserver 172.25.254.114 # ip into the service side of ip
Test: DIG www.baidu.com