Linux运维~2.DNS——5.DNS双向解析

双向解析:
三台电脑
内网客户ip:1.1.1.48
外网客户IP:172.25.254.48

DNS服务器:eth0 172.25.54.148
                        eth1    1.1.1.148

编辑name.conf
 50 /*
 51 zone "." IN {
 52         type hint;
 53         file "named.ca";
 54 };
 55 */


57 view localnet {
 58         match-clients { 1.1.1.0/24; };
 59         zone "." IN {
 60                 type hint;
 61                 file "named.ca";
 62         };
 63 include "/etc/named.rfc1912.local"; 内网配置文件
 64 };
 65
 66 view internet {
 67         match-clients { any; };
 68         zone "." IN {
 69                 type hint;
 70                 file "named.ca";
 71         };
 72 include "/etc/named.rfc1912.zones";外网配置文件
 73 };
 74
 75 #include "/etc/named.rfc1912.zones";
 76 #include "/etc/named.root.key";
 77

cp -p /etc/named.rfc1912.zones /etc/named.rfc1912.local
创建内网配置文件
修改指向
vim /etc/named.rfc1912.local
 25 zone "westos.com" IN {
 26         type master;
 27         file "westos.com.local";
 28         allow-update { none; };
 29 };

 

cd /var/named/

 cp -p westos.com.zone westos.com.local
创建内网DNS
$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       1.1.1.100
www             CNAME   music.a
music.a         A       1.1.1.8
music.a         A       1.1.1.9
hello           A       1.1.1.8
westos.com.     MX 10   1.1.1.111.

测试:
外网dig
dig www.westos.com
;; ANSWER SECTION:
www.westos.com.        86400    IN    CNAME    music.a.westos.com.
music.a.westos.com.    86400    IN    A    172.25.254.8
music.a.westos.com.    86400    IN    A    172.25.254.9

内网dig
;; ANSWER SECTION:
www.westos.com.        86400    IN    CNAME    music.a.westos.com.
music.a.westos.com.    86400    IN    A    1.1.1.8
music.a.westos.com.    86400    IN    A    1.1.1.9

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值