掌握 IPv6v4 的静态 NAT-PT 配置
拓扑图:
配置各路由器的IPv4地址和IPv6地址,测试互连可达
在R1和R3上配置静态路由,主要目的是描述到达未知网络需要将数据包发到NAT-PT设备进行V6V4地址转换
这里可以配置默认路由:
R1(config)#ipv6 route ::/0 2001:ab1:0:1::2
R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1
在R2上配置NAT-PT进行v4到v6和v6到v4的转换:
R2(config)#ipv6 unicast-routing ----->启用IPv6路由功能
R2(config)#int s1/0
R2(config-if)#ipv6 nat ----->启用此接口的IPv6 NAT功能
R2(config-if)#exit
R2(config)#int s1/1
R2(config-if)#ipv6 nat
R2(config-if)#exit
R2(config)#ipv6 nat v4v6 source 192.168.1.2 2001:db1:0:1::2 ---->配置v4主机到v6主机的映射
R2(config)#ipv6 nat v6v4 source 2001:ab1:0:1::1 192.168.2.10 ---->配置v6主机到v4主机的映射
R2(config)#ipv6 nat prefix 2001:db1:0:1::/96 ---->RFC文档规定,被转换后v6地址前缀为/96
查看转换关系表:
R2#show ipv6 nat translations
Prot IPv4 source IPv6 source
IPv4 destination IPv6 destination
--- --- ---
192.168.1.2 2001:DB1:0:1::2
--- 192.168.2.10 2001:AB1:0:1::1
--- ---
在R1和R3上测试,地址转换:
R1#ping 2001:db1:0:1::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB1:0:1::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/32/104 ms
R3#ping 192.168.2.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.10, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/43/92 ms
在R2上查看地址转换情况:
R2#debug ipv6 nat
IPv6 NAT-PT debugging is on
R2#
*Apr 16 14:55:39.135: IPv6 NAT: icmp src (2001:AB1:0:1::1) -> (192.168.2.10), dst (2001:DB1:0:1::2) -> (192.168.1.2)
*Apr 16 14:55:39.203: IPv6 NAT: src (192.168.1.2) -> (2001:DB1:0:1::2), dst (192.168.2.10) -> (2001:AB1:0:1::1)
一切正常。