DNS设定(一)

网友投稿 314 2022-10-28


DNS设定(一)

###dns设定####在开始之前先设定好网络服务环境client设定vim /etc/resolv.conf    ##编辑配置文件nameserver 172.25.254.109    ##添加服务端server设定yum install bind -y    ##安装bind服务systemctl status named     ##查看rpm -qc bindsystemctl enable named    ##开机自启systemctl start named     ##开启服务firewall-cmd --permanent --add-service=dns   ##永久添加dns服务firewall-cmd --reloadnetstat -antulpe | grep named            ##查看开放端口vim /etc/name.conf listen-on port 53 { any; };             ##设定开放端口。any表示对所有的interface都开放 allow-query     { any; };               ##回答所有人提问 forwarders      {172.25.254.250;};dnssec-validation no;systemctl restart named

####正向解析######正向解析就是将域名解析为ipvim /etc/name.conf##删除forwarders      {172.25.254.250;};vim /etc/named.rfc1912.zones    ##进入配置文件zone "westos.com" IN {        type master;        file "westos.com.zone";        allow-update { none; };};cd /var/named/  cp -p named.localhost westos.com.zone  ##带权限复制vim westos.com.zone $TTL 1D@       IN SOA dns.westos.com. root.westos.com. (                                        0       ; serial                                        1D      ; refresh                                        1H      ; retry                                        1W      ; expire                                        3H )    ; minimum        NS      dns.westos.com.dns     A       172.25.254.109A       172.25.254.251~ ##@表示的是zone 如果不加.表示自动补充域名。systemctl restart named                 ##重启服务

####反向解析####vim /etc/named.rfc1912.zoneszone "254.25.172.in-addr.arpa" IN {        type master;        file "westos.com.ptr";        allow-update { none; };};

cd /var/named/cp -p named.loopback westos.com.ptrvim westos.com.ptr$TTL 1D@       IN SOA  dns.westos.com. root.westos.com. (                                        0       ; serial                                        1D      ; refresh                                        1H      ; retry                                        1W      ; expire                                        3H )    ; minimum        NS      dns.westos.com.        A       172.25.254.109109     PTR     westos.com.110     PTR     hello.com.~               ####双向解析####cd /var/named          cp -p westos.com.zone westos.com.inter  ##加权限复制文件vim westos.com.inter ##编辑外网配置文件$TTL 1D@       IN SOA dns.westos.com. root.westos.com. (                                        0       ; serial                                        1D      ; refresh                                        1H      ; retry                                        1W      ; expire                                        3H )    ; minimum                NS      dns.westos.com.dns             A       172.25.0.109A       172.25.0.251A       172.25.0.252bbs             CNAME   westos.com.westos.com.     MX 1    172.25.0.109~      ##将所有的网段改为0网段cp -p /etc/named.rfc1912.zones /etc/named.rfc1912.zones.intervim /etc/named.rfc1912.zones.inter zone "westos.com" IN {        type master;        file "westos.com.inter";        allow-update { none; };};vim /etc/named.conf     ##编辑主配置文件/*zone "." IN {        type hint;        file "named.ca";};

include "/etc/named.rfc1912.zones";include "/etc/named.root.key";*/        ##注销view localnet{            match-clients {172.25.254.109; };zone "." IN {        type hint;        file "named.ca";};include "/etc/named.rfc1912.zones";};   ##添加内网客户端 (可以man 5 named.conf)view internet{            match-clients {any; };zone "." IN {        type hint;        file "named.ca";};include "/etc/named.rfc1912.zones.inter";};     ##添加外网客户端systemctl restart named                 ##重启服务


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:当今医疗行业如何使用API市场?
下一篇:手动启动与开机自动启动网卡的两种方式
相关文章

 发表评论

暂时没有评论,来抢沙发吧~