Linux DNS分离解析与构建智能DNS服务器

Linux DNS分离解析与构建智能DNS服务器,第1张

概述一 构建DNS分离解析 方法一 : [[email protected] ~]# vim /etc/named.conf  [[email protected] ~]# cd /var/named/ [[email protected] named]# vim crushlinux.zheng.wan [[email protected] named]# chgrp named crushlinu

一 构建DNS分离解析

方法一 :

[[email protected] ~]# vim /etc/named.conf 

[[email protected] ~]# cd /var/named/

[[email protected] named]# vim crushlinux.zheng.wan

[[email protected] named]# chgrp named crushlinux.zheng.*   //授予权限

[[email protected] named]# systemctl restart named

测试

 

 出现这则成功

方法二 : 修改主配置文件

方法三: 修改主配置文件并创建两个新的文件

[[email protected] ~]# vim /var/named/wan.txt

 

[[email protected] ~]# vim /etc/named.conf

1:这是链接文件所在的位置  若是lan.txt 在/etc/named/lan.txt   

则 是 include “/etc/named/lan.txt”

2: 同上

3:这个  lan   是 lan.txt中  acl  所指的   名

4:同上

二:构建智能DNS域名解析服务器

 [[email protected] named]# vim /etc/named.conf 

网通用户ip地址是 172.16.1.2

电信用户ip地址是 172.16.1.3

[[email protected] ~]# cd /var/named/

[[email protected] named]# vim crushlinux.zheng.wangtong

 

//www.crushlinux.com  的ip地址 172.16.1.12是网通缓存服务器

//172.16.1.13  是电信缓存服务器地址

[[email protected] named]# chgrp named crushlinux.zheng.*    //赋予wangtong,dianxin 权限   赋予到named组中

[email protected] named]# systemctl restart named

实验

 

 模拟网通用户

 

 模拟电信用户

成功

方法二

完事

三 

获取不同运营商的IP地址范围   脚本执行

[[email protected] ~]# vim ispip.sh

#!/bin/bash

 

url="http://ispip.clang.cn/"

for i in chinatelecom unicom_cnc cmcc crtc cernet othernet

do

         wget $url$i.HTML -O /tmp/$i.txt

         sed -n ‘/^[0-9]/ s/<br>/;/gp‘ /tmp/$i.txt | sed "1iacl $i {" | sed ‘$a};‘ > /var/named/$i.txt

done

[[email protected] ~]# chmod +x ispip.sh

 

[[email protected] ~]# bash ispip.sh  //执行脚本    前提是 虚拟机能上网

[[email protected] named]# vim chinatelecom.txt

这是某 电信或网通用户的网段

https://github.com/clangcn/everyday-update-cn-isp-ip

根据APNIC的最新IP地址列表及whois信息,每日0点(北京时间)生成的各主要运营商IP地址段。

 

中国电信 IP地址段:(http://ispip.clang.cn/chinatelecom.html)

中国联通(网通)IP地址段:(http://ispip.clang.cn/unicom_cnc.html)

中国移动 IP地址段:(http://ispip.clang.cn/cmcc.html)

中国铁通 IP地址段:(http://ispip.clang.cn/crtc.html)

中国教育网 IP地址段:(http://ispip.clang.cn/cernet.html)

中国其他ISP IP地址段:(http://ispip.clang.cn/othernet.html)

总结

以上是内存溢出为你收集整理的Linux DNS分离解析与构建智能DNS服务器全部内容,希望文章能够帮你解决Linux DNS分离解析与构建智能DNS服务器所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1022304.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存