当前位置:网站首页>DNS分离解析的实现方法详解
DNS分离解析的实现方法详解
2022-07-25 10:30:00 【星哥玩云】
DNS的分离解析,是指根据不同的客户端提供不同的域名解析记录。来自不同地址的客户机请求解析同一域名时,为其提供不同的解析结果。也就是内外网客户请求访问相同的域名时,能解析出不同的IP地址,实现负载均衡。
实验环境:
DNS服务器:RedHat 6.5系统 外网IP地址是12.0.0.1 内网IP地址是192.168.10.1 内网客户机:Windows 7系统 IP地址是192.168.10.10 外网客户机:Windows 7系统 IP地址是12.0.0.10
实验前提:DNS服务器需要有双网卡,安装bind软件
系统默认安装一个网卡,再添加一个网卡,用ifconfig命令查看
重启网络服务
ifconfig命令查看内外网IP的设置
Yum安装bind软件
实验步骤:
第1步: 修改bind服务程序的主配置文件(/etc/named.conf)
将监听端口和允许查询主机参数设置为any。由于配置的DNS分离解析的实现方法详解功能与DNS根服务器配置参数有冲突,需要将根域信息删除。
vim /etc/named.conf #编辑主配置文件options { listen-on port 53 { any; }; #设置监听的地址和端口 listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; allow-query { any; }; #允许使用DNS服务的地址 recursion yes;
-
zone "." IN { #删除根域信息 type hint; file "named.ca"; };
第2步:编辑区域配置文件(/etc/named.rfc1912.zone)
由于区域配置文件是为不同的客户机地址启用不同的zone区域设置,各自使用独立的数据文件,所以要把配置文件中原有的数据清空。
主要使用“”配置语句和”配置选项,根据不同的客户端地址对“benet.com”域的查询对应到不同的数据文件,从而得到不同的解析结果。
第3步:建立区域数据配置文件(/var/named)
分别通过模板文件创建出两个不同的区域数据文件,对应内外网的客户端域名请求,名称应与上面的区域配置文件指定的名称一致。
cd /var/named #切换目录
cp -p named.localhost benet.com.zone.lan #保留文件的属性,建立内网用户数据文件
cp -p named.localhost benet.com.zone.wan #保留文件的属性,建立外网用户数据文件vim /var/named/benet.com.zone.lan #编辑内网用户数据文件
$TTL 1D
@ IN SOA benet.com. admin.benet.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS benet.com.
A 192.168.10.1 #服务器内网IP地址
www IN A 192.168.10.80 #内网地址记录(www.benet.com)
mail IN A 192.168.10.25 #内网地址记录(mail.benet.com)vim benet.com.zone.wan #编辑外网用户数据文件
$TTL 1D
@ IN SOA benet.com. admin.benet.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS benet.com.
A 12.0.0.1 #服务器外网IP地址
www IN A 12.0.0.20 #外网地址记录(www.benet.com)
mail IN A 12.0.0.45 #外网地址记录(mail.benet.com)第4步:启动named服务
service named start第5步:关掉防火墙
service iptables stop第6步:验证结果
内网客户机将DNS地址设置为服务器的内网IP,外网客户机将DNS地址设置为服务器的外网IP,然后使用nslookup命令解析域名。
边栏推荐
- txt转csv文件,隔行出现空行
- 新能源销冠宏光MINIEV,有着怎样的产品力?
- Understand the life cycle and route jump of small programs
- Hcip experiment (03)
- From the perspective of open source, analyze the architecture design of SAP classic ERP that will not change in 30 years
- Ue4.26 source code version black screen problem of client operation when learning Wan independent server
- Learn NLP with Transformer (Chapter 3)
- HCIP(12)
- MySQL master-slave replication and read-write separation
- Learn NLP with Transformer (Chapter 8)
猜你喜欢

HCIP (01)

Hcip experiment (03)

From the perspective of open source, analyze the architecture design of SAP classic ERP that will not change in 30 years

Learn NLP with Transformer (Chapter 5)

Flask framework -- flask caching

NowCoderTOP7-11——持续更新ing

A troubleshooting record of DirectShow playback problems

【flask高级】结合源码解决flask经典报错:Working outside of application context

Implementation of recommendation system collaborative filtering in spark

100W!
随机推荐
redis 哨兵,高可用的执行者
MLX90640 红外热成像仪测温模块开发笔记(五)
STM32CubeMX学习记录--安装配置与使用
[递归] 938. 二叉搜索树的范围和
Nowcodertop1-6 - continuous updating
一文读懂小程序的生命周期和路由跳转
史上最全的立创元器件封装库导入AD详细教程(一直白嫖一直爽)
[flask advanced] combined with the source code, explain the operation mechanism of flask (in and out of the stack)
机智云物联网平台 STM32 ESP8266-01S 简单无线控灯
Learn NLP with Transformer (Chapter 3)
MySQL master-slave replication and read-write separation
Openstack Skyline 组件安装
C# Newtonsoft. Jason advanced usage
The most detailed MySQL index analysis (mind map is attached at the end of the article)
tensorflow入门
100W了!
企业实践开源的动机
Openstack skyline component installation
Esp8266 uses drv8833 drive board to drive N20 motor
mysql高级语句(一)(总有一个人的出现,让你的生活不再继续糟糕)