DNS分离解析技术

服务器

china IP:122.71.115.10
american IP:106.185.25.10

安装bind-chroot服务

[root@xiudaochengxian ~]# yum -y install bind-chroot
Complete!

编辑bind主配置文件

[root@xiudaochengxian ~]#vim /etc/named.conf 
 12 options {
 13         listen-on port 53 { any; };
 14         listen-on-v6 port 53 { ::1; };
 15         directory       "/var/named";
 16         dump-file       "/var/named/data/cache_dump.db";
 17         statistics-file "/var/named/data/named_stats.txt";
 18         memstatistics-file "/var/named/data/named_mem_stats.tx    t";
 19         allow-query     { any; };
 52 #zone "." IN {						#删除或注释掉根域信息(因为配置的DNS分离解析功能与DNS根服务器配置参数有冲突)
 53 #       type hint;
 54 #       file "named.ca";
 55 #};

编辑区域配置文件(手写)

[root@xiudaochengxian ~]#cd /etc/named/
[root@xiudaochengxian named]#vim /etc/named.rfc1912.zones 
  1 acl "china" { 122.71.115.0/24; };
  2 acl "american" { 106.185.25.0/24; };
  3 view "china" {
  4 match-clients {"china";};
  5 zone "xiuxian.com" {
  6 type master;
  7 file "xiuxian.com.china";
  8 };
  9 };
 10 view "american" {
 11 match-client { "american"; };
 12 zone "xiuxian.com" {
 13 type master;
 14 file "xiuxian.com.american";
 15 };
 16 };                                

通过模板文件创建出两份不同名称的区域数据文件,名称与上面区域配置文件中相对应

[root@xiudaochengxian named]#cp -a named.localhost xiuxian.com.china
[root@xiudaochengxian named]#cp -a named.localhost xiuxian.com.american

编辑这两份区域文件

china文件

[root@xiudaochengxian named]#vim xiuxian.com.china 
  1 $TTL 1D
  2 @       IN SOA  xiuxian.com. root.dingjianpeng.com. (
  3                                         0       ; serial
  4                                         1D      ; refresh
  5                                         1H      ; retry
  6                                         1W      ; expire
  7                                         3H )    ; minimum
  8         NS      ns.xiuxian.com.
  9 ns      IN A    122.71.115.10
 10 www     IN A    122.71.115.15

american

[root@xiudaochengxian named]#vim xiuxian.com.american 
  1 $TTL 1D
  2 @       IN SOA  xiuxian.com. root.dingjianpeng.com. (
  3                                         0       ; serial
  4                                         1D      ; refresh
  5                                         1H      ; retry
  6                                         1W      ; expire
  7                                         3H )    ; minimum
  8         NS      ns.xiuxian.com.
  9 ns      IN A    106.185.25.10
 10 www     IN A    106.185.25.15

重启bind服务

[root@xiudaochengxian named]#systemctl restart named

客户机

模拟china用户

在这里插入图片描述

模拟american用户

在这里插入图片描述

ping 服务器

china用户

Microsoft Windows [版本 10.0.19041.1083]
(c) Microsoft Corporation。保留所有权利。
C:\Users\xiudaochengxian>ping www.xiuxian.com
正在 Ping www.xiuxian.com [122.71.115.15]具有 32 字节的数据:
来自 122.71.115.15 的回复: 字节=32 时间<1ms TTL=128
来自 122.71.115.15 的回复: 字节=32 时间<1ms TTL=128
来自 122.71.115.15 的回复: 字节=32 时间<1ms TTL=128
来自 122.71.115.15 的回复: 字节=32 时间<1ms TTL=128

122.71.115.15 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 0ms,最长 = 0ms,平均 = 0ms

american用户

Microsoft Windows [版本 10.0.19041.1083]
(c) Microsoft Corporation。保留所有权利。
C:\Users\xiudaochengxian>ping www.xiuxian.com
正在 Ping www.xiuxian.com [106.185.25.15]具有 32 字节的数据:
来自 106.185.25.15 的回复: 字节=32 时间<1ms TTL=64
来自 106.185.25.15 的回复: 字节=32 时间=1ms TTL=64
来自 106.185.25.15 的回复: 字节=32 时间=2ms TTL=64
来自 106.185.25.15 的回复: 字节=32 时间=1ms TTL=64

106.185.25.15 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 0ms,最长 = 2ms,平均 = 1ms
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值