1.安裝bind軟件包
10年積累的網(wǎng)站制作、成都做網(wǎng)站經(jīng)驗(yàn),可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先網(wǎng)站策劃后付款的網(wǎng)站建設(shè)流程,更有環(huán)江免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
yum?install?-y?bind*
2.各配置文件路徑索引
/etc/named.conf?#主配置文件 /var/named/?#解析數(shù)據(jù)庫文件目錄 /etc/named.rfc1912.zones?#默認(rèn)的解析區(qū)域文件
3.主配置文件的修改
#以下修改只是我做改動的地方? vim?/etc/named.conf? options?{ ??????? #listen-on?port?53?{?127.0.0.1;?};?注釋掉該行表示在所有接口IP啟用53端口的監(jiān)聽 ??????? #listen-on-v6?port?53?{?::1;?};?關(guān)閉IPv6的監(jiān)聽 ??????? ?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"; ??????? ?recursing-file??"/var/named/data/named.recursing"; ???????? secroots-file???"/var/named/data/named.secroots"; ???????? #allow-query?????{?localhost;?};?允許所有主機(jī)進(jìn)行DNS查詢,默認(rèn)只允許本地查詢? zone?"example.com"?IN?{? type?master;?? file?"example.com.zone";?#如果不加絕對路徑的話,默認(rèn)會將配置文件認(rèn)為是在/var/named目錄內(nèi) ?};????????? #include?"/etc/named.rfc1912.zones";?注釋掉該行 include?"/etc/named.root.key";
4.創(chuàng)建數(shù)據(jù)庫文件
cd?/var/named/? cp?named.localhost?example.com.zone?#通過默認(rèn)的區(qū)域文件創(chuàng)建一個(gè) vim?example.com.zone? $TTL?1D @IN?SOAexample.com?dns.example.com.? ?????????????????????????????????????????????????( 0;?serial? ?????????????????????????????????????????????????1D;?refresh ?????????????????????????????????????????????????1H;?retry? ?????????????????????????????????????????????????1W;?expire? ?????????????????????????????????????????????????3H?);?minimum? @????????INNSdns.example.com.? dnsINA172.16.104.123 wwwINA172.16.104.123
5.重啟測試
systemctl?restart?named [root@localhost?named]#?systemctl?status?named?#查看一下狀態(tài)? cat?/etc/resolv.conf?#確定DNS地址? #?Generated?by?NetworkManager? nameserver?172.16.104.123??????????? [root@localhost?~]#?nslookup?www.example.com? Server:172.16.104.123? Address:172.16.104.123#53? Name:www.example.com? Address:?172.16.104.123