Linux服務-Bindcode
[root@cwh ~]# yum -y install bind* # 設置開機啓動 [root@cwh ~]# systemctl enable named
[root@cwh ~]# vim /etc/named.conf options { listen-on port 53 { any; };//將大括號內的內容改爲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; };//將大括號內的內容改爲any
[root@localhost ~]# vim /etc/named.rfc1912.zones //正向 zone "cwhbind.com" IN { type master; file "cwhbind.com.zone"; allow-update { none; }; }; //反向 zone "112.168.192.in-addr.arpa" IN { type master; file "112.168.192.zone"; allow-update { none; }; };
cljhfy.com.zone
和163.168.192.zone
[root@localhost named]# vim cwhbind.com.zone $TTL 1D @ IN SOA cwhbind.com. admin.cwhbind.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS www.cwhbind.com. NS ftp.cwhbind.com. A 127.0.0.1 AAAA ::1 MX 10 mx.cwhbind.com. ttl IN A 192.168.112.149 //寫配置bind的本機IP www IN A 192.168.112.149 bbs IN CNAME www mx IN A 192.168.112.149 ftp IN A 192.168.112.149 [root@localhost named]# vim 112.168.192.zone $TTL 1D @ IN SOA cwhbind.com. admin.cwhbind.com. ( 0 2H 10M 7D 1D ) NS ttl.cwhbind.com. A 127.0.0.1 AAAA ::1 149 IN PTR cwhbind.com. 149 IN PTR www.cwhbind.com. 149 IN PTR ftp.cwhbind.com. 149 IN PTR mx.cwhbind.com. //配置完成後更改屬主和屬組還有給配置文件權限 [root@localhost named]# chown named.named cwhbind.com.zone [root@localhost named]# chown named.named 112.168.192.zone [root@localhost named]# chmod 755 cwhbind.com.zone [root@localhost named]# chmod 755 112.168.192.zone //啓動服務 [root@localhost named]# systemctl start named-chroot
[root@150 ~]# cat /etc/resolv.conf # Generated by NetworkManager nameserver 192.168.112.149 //dns指向我設置好的IP [root@150 ~]# nslookup 192.168.112.149 Server: 192.168.112.149 Address: 192.168.112.149#53 149.112.168.192.in-addr.arpa name = ftp.cwhbind.com. 149.112.168.192.in-addr.arpa name = cwhbind.com. 149.112.168.192.in-addr.arpa name = mx.cwhbind.com. 149.112.168.192.in-addr.arpa name = www.cwhbind.com. [root@150 ~]# nslookup cwhbind.com Server: 192.168.112.149 Address: 192.168.112.149#53 Name: cwhbind.com Address: 127.0.0.1 [root@150 ~]# nslookup ftp.cwhbind.com Server: 192.168.112.149 Address: 192.168.112.149#53 Name: ftp.cwhbind.com Address: 192.168.112.149 [root@150 ~]# nslookup mx.cwhbind.com Server: 192.168.112.149 Address: 192.168.112.149#53 Name: mx.cwhbind.com Address: 192.168.112.149 [root@150 ~]# nslookup www.cwhbind.com Server: 192.168.112.149 Address: 192.168.112.149#53 Name: www.cwhbind.com Address: 192.168.112.149 //能夠使用