正向解析脚本
#!/bin/bashyum install bind -y //安装解析工具包//修改主配置文件sed -i '13s/127.0.0.1/192.168.17.156/' /etc/named.conf //把解析主配置文件第13行的IP地址换成192.168.17.156sed -i '21s/localhost/any/' /etc/named.conf //把主配置文件的21行localhost换成any//添加内容到区域配置文件sed -i '24azone "cwq.com" IN {/n type master;/n file "cwq.com.zone";/n allow-update { none; };/n };' /etc/named.rfc1912.zones//区域配置文件24行后面加入域名cd /var/named cp -p named.localhost cwq.com.zone //复制模板到我们自己设置的数据区域配置文件//配置数据区域配置文件sed -i '2s/@/cwq.com/2' cwq.com.zone sed -i '2s/rname.invalid./admin.cwq.com/' cwq.com.zonesed -i '8s/@/cwq.com./' cwq.com.zonesed -i '9s/127.0.0.1/192.168.17.156/' cwq.com.zonesed -i '10aIN MX 10 mail.cwq.com./nwww IN A 192.168.100.99/nftp IN A 192.168.100.88' cwq.com.zonesystemctl stop firewalld.service //关闭防火墙setenforce 0 //关闭增强功能systemctl start named //开启解析服务echo "nameserver 192.168.17.156" >/etc/resolv.conf //把你自己的Ip地址加入解析配置文件
最后只要输入hosts www.cwq.com就能解析出地址192.168.17.156
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持武林网。
新闻热点
疑难解答