ipv6的 bind dns 正向解析与反向解析

正向记录 为 AAAA
反向记录 为 PTR 跟 ipv4 一样,但格式为 ip6.arpa格式

举个例子 创建随机 ipv6 ula地址

echo fd`openssl rand -hex 15|sed 's/\(..\)/&/g;s/:$//'` |awk 'BEGIN{FS=""}{for(i=1;i<=NF;i++){if(i%4==0&&i!=NF){printf $i":"}else{printf $i}}print ""}'

输出
fd35:0f63:919f:db4a:9ed9:59c3:d9d7:88cf
域名 aaa.test.com

acl OKHOSTS {localhost;localnets;fc00::/6;::1;};

正向解析 zone

zone “test.com” {
type master;
file “/etc/bind/test.com.zone”;
allow-query {
OKHOSTS;
};
allow-transfer {
OKHOSTS;
#none;
};
allow-update {
none;
};
};

在 /etc/bind/test.com.zone 文件 配置

$ORIGIN .
$TTL 86400 ; 1 day
test.com IN SOA test.com. root.test.com. (
2021112017 ; serial
86400 ; refresh (1 day)
3600 ; retry (1 hour)
604800 ; expire (1 week)
10800 ; minimum (3 hours)
)
NS root.test.com.
$TTL 3600
; 定义 aaa.test.com的AAAA记录
aaa AAAA fd35:0f63:919f:db4a:9ed9:59c3:d9d7:88cf

反向解析zone

需要 ip6.arpa格式
安装软件 ipv6calc

获取 ula前缀的 ip6.arpa格式

ipv6calc -aq fd35:0f63:919f:db4a:9ed9:59c3:d9d7:88cf|cut -c 33-63

得到 ula前缀
a.4.b.d.f.9.1.9.3.6.f.0.5.3.d.f

定义 反向解析zone

zone “a.4.b.d.f.9.1.9.3.6.f.0.5.3.d.f.ip6.arpa” {
type master;
file “/etc/bind/rev.test.com.zone”;
allow-update {none;};
allow-transfer {
OKHOSTS;
#none;
};
allow-query {OKHOSTS;};
};

获取 aaa.test.com ipv6的主机id

ipv6calc -aq fd35:0f63:919f:db4a:9ed9:59c3:d9d7:88cf|cut -c 1-31

得到
f.c.8.8.7.d.9.d.3.c.9.5.9.d.e.9

在 /etc/bind/rev.test.com.zone 配置反向ipv6记录

$ORIGIN .
$TTL 86400 ; 1 day
a.4.b.d.f.9.1.9.3.6.f.0.5.3.d.f.ip6.arpa IN SOA test.com. root.test.com. (
2021112017 ; serial
86400 ; refresh (1 day)
3600 ; retry (1 hour)
604800 ; expire (1 week)
10800 ; minimum (3 hours)
)
NS root.test.com.
$ORIGIN a.4.b.d.f.9.1.9.3.6.f.0.5.3.d.f.ip6.arpa.
#定义 aaa.test.com ipv6 ptr
f.c.8.8.7.d.9.d.3.c.9.5.9.d.e.9 PTR aaa.test.com.

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值