泛域名解析的作用,为了解决用户输入域名时,站点输入错误的问题
在服务器上进行配置:
[root@localhost ~]# cd /var/named/
[root@localhost named]# vim s.txt
.........
* A 7.7.7.7
[root@localhost named]# systemctl restart named
[root@localhost named]# systemctl stop firewalld
在客户端进行配置
[root@student ~]# echo nameserver 192.168.99.134 > /etc/resolv.conf
[root@student ~]# nslookup wwwwwwwwww.sina.com
Server: 192.168.99.134
Address: 192.168.99.134#53
Name: wwwwwwwwww.sina.com
Address: 7.7.7.7
有规律的泛域名解析
pc1.baidu.cn----->192.168.10.1
pc2.baidu.cn----->192.168.10.2
pc3.baidu.cn----->192.168.10.3
......
pc100.baidu.cn----->192.168.10.100
内置函数:$GENERATE 造数
$GENERATE 1-50 pc$ A 192.168.10.$
[root@svr7 /]# vim /var/named/s.txt
…
$GENERATE 1-100 pc$ A 192.168.10.$
[root@svr7 ~]# systemctl restart named
[root@pc207 ~]# nslookup pc1.sina.com #会出对应的IP
[root@pc207 ~]# nslookup pc2.sina.com
[root@pc207 ~]# nslookup pc100.sina.com
[root@pc207 ~]# nslookup pc101.sina.com #出现匹配的IP为7.8.9.10,因为配置文件有泛域名解析
解析记录的别名
[root@localhost ~]# vim /var/named/s.txt
Xiaopang(别名) CNAME www
[root@localhost ~]# systemctl restart named//重启服务
客户端查看
[root@student ~]# nslookup xiaopang.sina.com
Server: 192.168.99.134
Address: 192.168.99.134#53
xiaopang.baidu.com canonical name = www.sina.com.
Name: www.sina.com
Address: 192.168.99.134