#服务端
[ root@server ~ ] # nmcli c modify ens32 ipv4.method manual ipv4.addresses 192.168.132.129/24 ipv4.gateway 192,168.132.2 ipv4.dns 114.114.114.114
[ root@server ~ ] # nmcli c reload
[ root@server ~ ] # nmcli c up ens32
#客户端 #记得修改ip
[root@node1 ~] # nmcli c modify ens32 ipv4.method manual ipv4.addresses 192.168.132.130/24 ipv4.gateway 192.168.132.2 ipv4.dns 114.114.114.114 [root@node1 ~] # nmcli c reload [root@node1 ~] # nmcli c up ens32//配置静态ip
[root@server ~] # vim /etc/named.conf # 需改2行 listen-on port 53 { any; }; # any为允许所有主机
... #此处不做修改 allow-query { any; };
//在服务器端修改listen-on port 53 和allow-query的P{ }中为any;
[root@server ~] # vim /etc/named.rfc1912.zones zone "openlab.com" IN { type master; file "openlab.com.zone"; # 注意:不写路径 allow-update { none; }; }//在服务端配置文件
[root@server ~] # cd /var/named
[root@server named] # cp -a named.localhost openlab.com.zone # -a 完整拷贝
[root@server named] # vim openlab.com.zone # 完整格式修改如下 $TTL 1D openlab.com. IN SOA ns.opeblab.com. admin.openlab.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum openlab.com. IN NS ns.openlab.com. ns.openlab.com. IN A 192.168.132.129 www.openlab.com. IN A 192.168.132.129 ftp.openlab.com. IN A 192.168.132.129 bbs.openlab.com. IN A 192.168.132.129 www1.openlab.com. IN CNAME www.openlab.com.
//拷贝模板文件
[root@server named] # systemctl restart named
//重启
# 编辑客户端网卡配置文件 [root@node1 ~] # vim /etc/sysconfig/network-scripts/ifcfg-ens32 dns=192.168.132.131; # dns改为服务端的IP地址
# 重启
[root@node1 ~]# nmcli c reload [root@node1 ~]# nmcli c up ens32
#客户端测试
[root@node1 ~]# nslookup www.openlab.com Server: 192.168.132.131 Address: 192.168.132.131#53
Name: www.openlab.com Address: 192.168.132.131
//测试并修改dns微服务端
[root@server named]# vim /etc/named.rfc1912.zones
zone "132.168.192.in-addr.arpa" IN { type master; file "192.168.132.arpa"; allow-update { none; }; };
//服务端操作,编辑数据配置文件,复制反向解析模版 [root@server ~] # cd /var/named
[root@server named] # cp -a named.loopback 192.168.132.arpa [root@server named] # vim 192.168.132.arpa
$TTL 1D @ IN SOA ns.openlab.com. jenny.qq.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum IN NS ns.openlab.com. ns.openlab.com. IN A 192.168.132.129 131 IN PTR ns.openlab.com. 131 IN PTR www.openlab.com. 131 IN PTR ftp.openlab.com.
//重启服务 [root@server named]# systemctl restart named