ce--3--DNS正反向解析

一.DNS正向解析
Server配置
前置步骤

systemctl stop firewalld
setenforce 0
yum install bind -y

查看安装

[root@localhost ~]# rpm -qa | grep bind
bind-export-devel-9.11.13-3.el8.x86_64
bind-sdb-chroot-9.11.13-3.el8.x86_64
bind-license-9.11.13-3.el8.noarch
bind-libs-lite-9.11.13-3.el8.x86_64
bind-utils-9.11.13-3.el8.x86_64
rpcbind-1.2.5-7.el8.x86_64
bind-pkcs11-libs-9.11.13-3.el8.x86_64
bind-devel-9.11.13-3.el8.x86_64
bind-pkcs11-utils-9.11.13-3.el8.x86_64
bind-libs-9.11.13-3.el8.x86_64
keybinder3-0.3.2-4.el8.x86_64
bind-lite-devel-9.11.13-3.el8.x86_64
bind-pkcs11-devel-9.11.13-3.el8.x86_64
bind-chroot-9.11.13-3.el8.x86_64
bind-export-libs-9.11.13-3.el8.x86_64
bind-sdb-9.11.13-3.el8.x86_64
bind-9.11.13-3.el8.x86_64
bind-pkcs11-9.11.13-3.el8.x86_64
python3-bind-9.11.13-3.el8.noarch

配置named.conf文件

options {
        listen-on port 53 { 192.168.43.200; };
        directory       "/var/named";
        allow-transfer     { any; };
};
 
zone "openlab.com" IN {
        type master;
        file "named.openlab.com";
};

配置named.openlab.com

$TTL 1D
@       IN SOA @ root.localhost. ( 2023071200 2D 4H 1D 1D )
        IN NS dns.openlab.com.
ftp     IN A 192.168.43.200
dns IN A 192.168.43.200
www IN A 192.168.43.200
w3 IN CNAME www

重启named服务

systemctl restart named

Client配置

[root@wy ~]# vim /etc/resolv.conf
# Generated by NetworkManager
search localdomain
nameserver 192.168.43.200
~                         
[root@wy ~]# ping www.openlab.com
PING www.openlab.com (192.168.43.200) 56(84) bytes of data.
64 bytes from 192.168.43.200 (192.168.43.200): icmp_seq=1 ttl=64 time=0.451 ms
64 bytes from 192.168.43.200 (192.168.43.200): icmp_seq=2 ttl=64 time=0.368 ms
64 bytes from 192.168.43.200 (192.168.43.200): icmp_seq=3 ttl=64 time=0.445 ms
64 bytes from 192.168.43.200 (192.168.43.200): icmp_seq=4 ttl=64 time=0.528 ms
64 bytes from 192.168.43.200 (192.168.43.200): icmp_seq=5 ttl=64 time=0.435 ms
64 bytes from 192.168.43.200 (192.168.43.200): icmp_seq=6 ttl=64 time=0.397 ms
^C
--- www.openlab.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 120ms
rtt min/avg/max/mdev = 0.368/0.437/0.528/0.052 ms

二.DNS反向解析
配置named.conf文件

vim /etc/named.conf
options {
        listen-on port 53 { 192.168.43.200; };
        directory       "/var/named";
        allow-transfer     { any; };
};
zone "openlab.com" IN {
        type master;
        file "named.openlab.com";
};
zone "43.168.192.in-addr.arpa" IN {
        type master;
        file "named.192";
};
~                                

配置named.openlab.com

[root@localhost ~]# vim /var/named/named.openlab.com 
$TTL 1D
@       IN     SOA      @     root.localhost.  (
                                2023071200
                                2D
                                4H
                                1D
                                1D )
        IN      NS      dns.openlab.com.
dns     IN      A       192.168.43.142
www     IN      A       192.168.10.100
ftp     IN      A       192.168.10.200
w3      IN      CNAME   www
~                              

配置named.192

[root@localhost ~]# vim /var/named/named.192
$TTL 1D
@	IN	SOA	@	root.localhost. (
				2023071200
				2D
				4H
				1D
				1D )
@	IN	NS	dns.openlab.com.
142	IN	PTR     dns.openlab.com.
100	IN	PTR	www.openlab.com.
200	IN	PTR     ftp.openlab.com.

重启服务

systemctl restart named


 

你可能感兴趣的:(excel)