DNS
这份快速指南将引导你如何使用DNS。
安装
named.conf
1yum install bind bind-utils
2vi /etc/named.conf
named.conf
1listen-on port 53 { 127.0.0.1; any; };
2allow-query { localhost; any; };
3zone "fewbox.lan" IN {
4 type master;
5 file "fewbox.lan.zone";
6};
fewbox.lan.zone
1vi /var/named/fewbox.lan.zone
fewbox.lan.zone
1$TTL 1w
2@ IN SOA @ fewbox.lan. (
3 2 ; Serial
4 604800 ; Refresh
5 7200 ; Retry
6 604800 ; Expire
7 300 ; Minimum
8)
9@ IN NS fewbox.lan.
10@ IN A 192.168.1.188
11www IN A 192.168.1.188
12master IN A 192.168.1.111
13worker1 IN A 192.168.1.112
14worker2 IN A 192.168.1.113
15worker3 IN A 192.168.1.114
16worker4 IN A 192.168.1.115
17hybrid IN A 192.168.1.116
18dns IN A 192.168.1.117
19nginx IN A 192.168.1.118
20nfs IN A 192.168.1.119
21registry IN A 192.168.1.119
22vpn IN A 192.168.1.119
23ldap IN A 192.168.1.119
24webdav IN A 192.168.1.119
named-checkzone
1named-checkzone fewbox.lan.zone /var/named/fewbox.lan.zone
named
1systemctl enable named
2systemctl start named
firewall-cmd
1firewall-cmd --add-service=dns --permanent
2firewall-cmd --reload
other
1/etc/named.conf # bind主配置文件
2/etc/named.rfc1912.zones # 定义zone的文件
3/etc/rc.d/init.d/named # bind脚本文件
4/etc/rndc.conf # rndc配置文件
5/usr/sbin/named-checkconf # 检测/etc/named.conf文件语法
6/usr/sbin/named-checkzone # 检测zone和对应zone文件的语法
7/usr/sbin/rndc # 远程dns管理工具
8/usr/sbin/rndc-confgen # 生成rndc密钥
9/var/named/named.ca # 根解析库
10/var/named/named.localhost # 本地主机解析库
11/var/named/slaves # 从ns服务器文件夹
客户端设置
ifcfg-enp0s3 (client)
1BOOTPROTO="static"
2IPADDR=192.168.1.111
3NETMASK=255.255.255.0
4GATEWAY=192.168.1.1
5DNS1=192.168.1.117 DNS2=8.8.8.8