Centos 7 搭建DNS正向解析和反向解析

Centos 7 ?搭建DNS正向解析和反向解析服務(wù)的三要素:安裝-配置-啟動?
1.使用yum安裝DNS?
yum ?install ?bind -y?
2.修改配置文件?
?????vi /etc/named.conf ???修改以下內(nèi)容: ?listen-on port 53 { any; }; ?allow-query ????{ any; };vi /etc/named.rfc1912.zones ???在末尾添加以下內(nèi)容:zone "hello.com" IN { ????????????????????-----正向解析 ???????type master; ???????file "hello.com.zone";};zone "80.168.192.in-addr.arpa" IN { ?-----反向解析 ???????type master; ???????file "hello.com.local";};wq ???--保存退出cd /var/named/cp -p named.localhost hello.com.zone ???---復(fù)制模板創(chuàng)建一個(gè)正向解析文件跟你 ??file "hello.com.zone",文件名要一樣;?
vi hello.com.zone ??????????---$TTL 1D@ ??????IN SOA ?hello.com. 123213123.qq.com ( ???????????????????????????????????????1 ??????; serial ???????????????????????????????????????1D ?????; refresh ???????????????????????????????????????1H ?????; retry ???????????????????????????????????????1W ?????; expire ???????????????????????????????????????3H ) ???; minimum ???????NS ?????dns.hello.com.dns ????IN A ???192.168.80.100www ????IN A ???192.168.80.101ftp ????IN A ???192.168.80.102 ?創(chuàng)建一個(gè)反向解析 ??file "hello.com.local",文件名要一樣;?
vi hello.com.local$TTL 1D@ ??????IN SOA ?hello.com. 12123123.qq.com ( ???????????????????????????????????????0 ??????; serial ???????????????????????????????????????1D ?????; refresh ???????????????????????????????????????1H ?????; retry ???????????????????????????????????????1W ?????; expire ???????????????????????????????????????3H ) ???; minimum ???????NS ?????dns.hello.com.100 ????IN PTR ?dns.hello.com.101 ????IN PTR ?www.hello.com.檢查主配置文件語法;?
named-checkconf3.啟動DNS服務(wù)?
systemctl start named?
查看DNS服務(wù)是否啟動成功 ??`netstat ?-anpt ?| grep ?named`?
?????測試DNS服務(wù) ????1.安裝nslookup命令 ????`yum ??install ?bind-utils ?-y` ????2.給網(wǎng)卡指定DNS ????`vi /etc/sysconfig/network-scripts/ifcfg-ens32 ` ????在末尾添加以下內(nèi)容:``` DNS1=192.168.80.100 ??(根據(jù)實(shí)際情況添寫DNS地址) wq ??---保存退出 ????systemc ?restart ???network ????---重新啟動網(wǎng)卡服務(wù) ?????3.使用nslookup測試正向解析和反向解析正向解析就是根據(jù)網(wǎng)址解析出ip地址?
反向解析就是根據(jù)ip地址解析出網(wǎng)址
了解更多網(wǎng)絡(luò)知識關(guān)注:http://www.vecloud.com/