bind 的使用

配置dns (根据鸟哥的方法 http://linux.vbird.org/linux_server/0350dns.php#server_settings ):

作为一个phper ,今天弄了下bind,虽然还是一知半解的,但是还是记录下来,希望以后能帮助到自己

1. 先安装 bind

yum install bind bind-utils bind-libs

2. 配置 /etc/named.conf

options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
allow-query-cache { any;};

allow-transfer { none; };

recursion yes;

};

zone "." IN {
type hint;
file "named.ca";
};
zone "daming.com" IN {
type master;
file "named.daming.com";
};
zone "31.168.192.in-addr.arpa" IN {
type master;
file "named.192.168.31";
};

3. 创建,配置 /var/named/named.daming.com

$TTL 600
@ IN SOA master.daming.com. admin.daming.com. (
2011080401 3H 15M 1W 1D ) ; 與上面是同一行
@ IN NS master.daming.com. ; DNS 伺服器名稱
master.daming.com. IN A 192.168.31.100 ; DNS 伺服器 IP
@ IN MX 10 www.daming.com. ; 領域名稱的郵件伺服器

www.daming.com. IN A 192.168.31.100
linux.daming.com. IN CNAME www.daming.com.
ftp.daming.com. IN CNAME www.daming.com.

slave.daming.com. IN A 192.168.31.165
clientlinux.daming.com. IN A 192.168.31.200

4. 创建,配置 /var/named/named.192.168.31

$TTL 600
@ IN SOA master.daming.com. admin.daming.com. (
2011080401 3H 15M 1W 1D )
@ IN NS master.daming.com.
100 IN PTR master.daming.com. ; 將原本的 A 改成 PTR 的標誌而已

100 IN PTR www.daming.com. ; 這些是特定的 IP 對應
165 IN PTR slave.daming.com.
20 IN PTR clientlinux.daming.com

5. 重启 named 服务,查看状态

# systemctl restart named
# systemctl status named


6. 进行测试

# dig master.daming.com
# dig www.daming.com

原文地址:https://www.cnblogs.com/zeopean/p/bind.html