配置6to4隧道示例
本举例介绍6to4隧道的配置过程。
配置注意事项
在配置过程中,需要注意以下事项:
首先创建Tunnel接口,然后才能配置Tunnel的其他参数。
在配置6to4隧道时,只需确定Tunnel的源,Tunnel的目的地址是从原始的IPv6报文的目的地址中获取的。但两个6to4隧道的源不允许相同。
在边界路由设备与6to4网络相连的接口上必须配置6to4地址,在边界路由设备与IPv4网络相连的接口上必须配置IPv4地址。为了支持路由协议,也需要配置Tunnel接口的网络地址。
操作步骤
- 配置DeviceA
# 配置IPv4/IPv6双协议栈。
<HUAWEI> system-view [~HUAWEI] sysname DeviceA [*HUAWEI] commit [~DeviceA] interface GigabitEthernet 0/1/0 [~DeviceA-GigabitEthernet0/1/0] ip address 1.1.1.1 8 [*DeviceA-GigabitEthernet0/1/0] undo shutdown [*DeviceA-GigabitEthernet0/1/0] quit [*DeviceA] interface gigabitethernet 0/2/0 [*DeviceA-GigabitEthernet0/2/0] ipv6 enable [*DeviceA-GigabitEthernet0/2/0] ipv6 address 2002:0101:0101:1::1 64 [*DeviceA-GigabitEthernet0/2/0] undo shutdown [*DeviceA-GigabitEthernet0/2/0] quit
# 配置6to4隧道。
[*DeviceA] interface Tunnel 10 [*DeviceA-Tunnel10] tunnel-protocol ipv6-ipv4 6to4 [*DeviceA-Tunnel10] ipv6 enable [*DeviceA-Tunnel10] ipv6 address 2002:0101:0101::1 64 [*DeviceA-Tunnel10] source 1.1.1.1 [*DeviceA-Tunnel10] quit
# 配置到其他6to4网络的路由。
[*DeviceA] ipv6 route-static 2002:: 16 Tunnel 10 [*DeviceA] commit
- 配置DeviceB
# 配置IPv4/IPv6双协议栈。
<HUAWEI> system-view [~HUAWEI] sysname DeviceB [*HUAWEI] commit [~DeviceB] interface GigabitEthernet 0/1/0 [~DeviceB-GigabitEthernet0/1/0] ip address 2.2.2.2 8 [*DeviceB-GigabitEthernet0/1/0] undo shutdown [*DeviceB-GigabitEthernet0/1/0] quit [*DeviceB] interface gigabitethernet 0/2/0 [*DeviceB-GigabitEthernet0/2/0] ipv6 enable [*DeviceB-GigabitEthernet0/2/0] ipv6 address 2002:0202:0202:1::1 64 [*DeviceB-GigabitEthernet0/2/0] undo shutdown [*DeviceB-GigabitEthernet0/2/0] quit
# 配置6to4隧道。
[*DeviceB] interface Tunnel 10 [*DeviceB-Tunnel10] tunnel-protocol ipv6-ipv4 6to4 [*DeviceB-Tunnel10] ipv6 enable [*DeviceB-Tunnel10] ipv6 address 2002:0202:0202::1 64 [*DeviceB-Tunnel10] source 2.2.2.2 [*DeviceB-Tunnel10] quit
# 配置到其他6to4网络的路由。
[*DeviceB] ipv6 route-static 2002:: 16 Tunnel 10 [*DeviceB] commit
说明:
Device A和Device B之间需要有一条可达的路由。在本例中两台路由设备直连,所以没有配置路由协议。
- 检查配置结果
# 在Device A上查看0/1/0的IPv6状态为UP。
[~DeviceA] display ipv6 interface Tunnel 10 Tunnel10 current state : UP IPv6 protocol current state : UP link-local address is FE80::101:101 Global unicast address(es): 2002:101:101::1, subnet is 2002:101:101::/64 Joined group address(es): FF02::1:FF01:101 FF02::1:FF00:1 FF02::2 FF02::1 MTU is 1500 bytes ND DAD is enabled, number of DAD attempts: 1. ND reachable time is 1200000 milliseconds. ND retransmit interval is 1000 milliseconds. Hosts use stateless autoconfig for addresses.
# 从Device A可以Ping通Device B的接口GE0/2/0的6to4地址。
[~DeviceA] ping ipv6 2002:0202:0202:1::1 PING 2002:202:202:1::1 : 56 data bytes, press CTRL_C to break Reply from 2002:202:202:1::1 bytes=56 Sequence=1 hop limit=64 time=37 ms Reply from 2002:202:202:1::1 bytes=56 Sequence=2 hop limit=64 time=2 ms Reply from 2002:202:202:1::1 bytes=56 Sequence=3 hop limit=64 time=8 ms Reply from 2002:202:202:1::1 bytes=56 Sequence=4 hop limit=64 time=1 ms Reply from 2002:202:202:1::1 bytes=56 Sequence=5 hop limit=64 time=2 ms ---2002:202:202:1::1 ping statistics--- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 4/9/25 ms
配置文件
DeviceA的配置文件
# sysname DeviceA # interface GigabitEthernet0/1/0 undo shutdown ip address 1.1.1.1 255.0.0.0 # interface GigabitEthernet 0/2/0 undo shutdown ipv6 enable ipv6 address 2002:101:101:1::1/64 # interface Tunnel 10 ipv6 enable ipv6 address 2002:101:101::1/64 tunnel-protocol ipv6-ipv4 6to4 source 1.1.1.1 # ipv6 route-static 2002:: 16 Tunnel 10 # return
DeviceB的配置文件
# sysname DeviceB # interface GigabitEthernet0/1/0 undo shutdown ip address 2.2.2.2 255.0.0.0 # interface GigabitEthernet0/2/0 undo shutdown ipv6 enable ipv6 address 2002:202:202:1::1/64 # interface Tunnel 10 ipv6 enable ipv6 address 2002:202:202::1/64 tunnel-protocol ipv6-ipv4 6to4 source 2.2.2.2 # ipv6 route-static 2002:: 16 Tunnel 10 # return