组网需求
如图 所示,设备SwitchA 作为IPv6 DNS Client 端和IPv6 DNS Server 配合,使得
SwitchA 通过域名()能够访问IP 地址为2002::1/64 的主机。
在SwitchA 上配置SwitchB 和SwitchC 的静态IPv6 DNS 表项,使得SwitchA 能够使用
域名(SwitchB 和SwitchC)对设备进行管理。
配置思路
IPv6 DNS 的配置思路如下:
1. 配置静态IPv6 DNS 表项
2. 使能DNS 域名解析功能
3. 配置IPv6 DNS 服务器的IPv6 地址
4. 配置域名后缀
数据准备
为完成此配置举例,需要准备如下数据:
l SwitchB 和SwitchC 的域名名称
l DNS 服务器的IPv6 地址
l 域名后缀
操作步骤
步骤1 配置SwitchA
# 配置静态IPv6 DNS 表项。
system-view
[SwitchA] ipv6 host SwitchB 2001::2
[SwitchA] ipv6 host SwitchC 2002::3
# 使能DNS 域名解析功能。
[SwitchA] dns resolve
# 配置DNS Server 的IP 地址。
[SwitchA] dns server ipv6 ::2
# 配置域名后缀net。
[SwitchA] dns domain net
# 配置域名后缀com。
[SwitchA] dns domain com
[SwitchA] quit
说明
若要完成对域名的解析,还需要配置SwitchA 至IPv6 DNS Server 的路由。路由的配置方法
步骤2 验证配置结果
# 在路由设备SwitchA 上执行ping ipv6 命令,可以ping 通,且对应的目的
地址为2002::1。
ping ipv6
Resolved Host ( -> 2002::1)
PING : 56 data bytes, press CTRL_C to break
Reply from 2002::1: bytes=56 Sequence=1 ttl=126 time=6 ms
Reply from 2002::1: bytes=56 Sequence=2 ttl=126 time=4 ms
Reply from 2002::1: bytes=56 Sequence=3 ttl=126 time=4 ms
Reply from 2002::1: bytes=56 Sequence=4 ttl=126 time=4 ms
Reply from 2002::1: bytes=56 Sequence=5 ttl=126 time=4 ms
--- ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 4/4/6 ms
# 在SwitchA 用display ipv6 host 命令可以查看到静态IPv6 DNS 表项中主机名和IPv6
地址的对应关系。
display ipv6 host
Host Age Flags IPv6Address (es)
SwitchB 0 static 2001::2
SwitchC 0 static 2002::3
# 在SwitchA 用display dns ipv6 dynamic-host 命令可以查看到动态缓存区中的动态IPv6
DNS 表项信息。
display dns ipv6 dynamic-host
No Domain-name Ipv6address TTL
1 2002::1 3579
说明
显示信息中的TTL 表示该表项存在的时间,单位是秒。
----结束
配置文件
l SwitchA 的配置文件
#
sysname SwitchA
#
vlan batch 100
#
ipv6
#
ipv6 host SwitchB 2001::2
ipv6 host SwitchC 2002::3
#
dns resolve
dns server ipv6 ::2
dns domain net
dns domain com
#
interface GigabitEthernet0/0/1
port hybrid pvid vlan 100
port hybrid untagged vlan 100
#
interface vlanif100
ipv6 enable
ipv6 address 2001::1/64
#
return
l SwitchB 的配置文件
#
sysname SwitchB
#
vlan batch 100 101
#
ipv6
#
interface GigabitEthernet0/0/1
port hybrid pvid vlan 101
port hybrid untagged vlan 101
#
interface GigabitEthernet0/0/2
port hybrid pvid vlan 100
port hybrid untagged vlan 100
#
interface vlanif100
ipv6 enable
ipv6 address 2002::2/64
#
interface vlanif101
ipv6 enable
ipv6 address 2001::2/64
#
return
l SwitchC 的配置文件
#
sysname SwitchC
#
vlan batch 100 101
#
ipv6
#
interface GigabitEthernet0/0/1
port hybrid pvid vlan 101
port hybrid untagged vlan 101
#
interface GigabitEthernet0/0/2
port hybrid pvid vlan 100
port hybrid untagged vlan 100
#
interface vlanif100
ipv6 enable
ipv6 address 2002::3/64
#
interface vlanif101
ipv6 enable
ipv6 address ::1/64
#
return