發布時間: 2018-03-09 10:11:44
配置IPv6 over IPv4
GRE隧道示例
組網需求
如圖1,兩個IPv6網絡分別通過RouterA和RouterC與IPv4網絡中的RouterB連接,客戶希望在RouterA和RouterC之間配置IPv6 over IPv4 GRE隧道,使兩個IPv6網絡可以互通。
圖1 配置IPv6 over IPv4 GRE隧道組網圖
配置思路
配置IPv6 over IPv4
GRE隧道的思路如下:
配置物理接口的IP地址,使設備可以和IPv4網絡通信。
在RouterA和RouterC上創建Tunnel接口,配置GRE隧道,指定Tunnel的源地址和目的地址,使報文封裝后可以通過路由轉發。注意Tunnel的源地址是發出報文的物理接口IP地址,目的地址是接收報文的物理接口IP地址。
為使PC1和PC2之間的流量通過GRE隧道傳輸,RouterA和RouterC上配置靜態路由,以對端PC所在網段為目的地址,出接口為本端配置的Tunnel接口。
操作步驟
配置各物理接口的IP地址
# 配置RouterA。
<Huawei>system-view
[Huawei] sysname RouterA
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0]ip address 10.1.1.1 255.255.255.0
[RouterA-GigabitEthernet1/0/0]quit
[RouterA] ipv6
[RouterA] interface gigabitethernet 2/0/0
[RouterA-GigabitEthernet2/0/0]ipv6 enable
[RouterA-GigabitEthernet2/0/0]ipv6 address fc01::1 64
[RouterA-GigabitEthernet2/0/0]quit
# 配置RouterB。
<Huawei>system-view
[Huawei] sysname RouterB
[RouterB] interface gigabitethernet 1/0/0
[RouterB-GigabitEthernet1/0/0] ip address 10.1.1.2 255.255.255.0
[RouterB-GigabitEthernet1/0/0]quit
[RouterB] interface gigabitethernet 2/0/0
[RouterB-GigabitEthernet2/0/0]ip address 10.1.2.1 255.255.255.0
[RouterB-GigabitEthernet2/0/0]quit
# 配置RouterC。
<Huawei>system-view
[Huawei] sysname RouterC
[RouterC] interface gigabitethernet 1/0/0
[RouterC-GigabitEthernet1/0/0]ip address 10.1.2.2 255.255.255.0
[RouterC-GigabitEthernet1/0/0]quit
[RouterC] ipv6
[RouterC] interface gigabitethernet 2/0/0
[RouterC-GigabitEthernet2/0/0]ipv6 enable
[RouterC-GigabitEthernet2/0/0]ipv6 address fc03::1 64
[RouterC-GigabitEthernet2/0/0]quit
配置IPV4靜態路由
# 配置RouterA。
[RouterA] ip route-static 10.1.2.2 255.255.255.0 10.1.1.2
# 配置RouterC。
[RouterC] ip route-static 10.1.1.1 255.255.255.0 10.1.2.1
配置Tunnel接口
# 配置RouterA。
[RouterA] interfacetunnel 0/0/1
[RouterA-Tunnel0/0/1]tunnel-protocol gre
[RouterA-Tunnel0/0/1]ipv6 enable
[RouterA-Tunnel0/0/1]ipv6 address fc02::1 64
[RouterA-Tunnel0/0/1]source 10.1.1.1
[RouterA-Tunnel0/0/1]destination 10.1.2.2
[RouterA-Tunnel0/0/1]quit
# 配置RouterC。
[RouterC] interface tunnel 0/0/1
[RouterC-Tunnel0/0/1]tunnel-protocol gre
[RouterC-Tunnel0/0/1]ipv6 enable
[RouterC-Tunnel0/0/1]ipv6 address fc02::2 64
[RouterC-Tunnel0/0/1]source 10.1.2.2
[RouterC-Tunnel0/0/1]destination 10.1.1.1
[RouterC-Tunnel0/0/1]quit
配置Tunnel的靜態路由
# 配置RouterA。
[RouterA] ipv6 route-static fc03::1 64 tunnel 0/0/1
# 配置RouterC。
[RouterC] ipv6 route-static fc01::1 64 tunnel 0/0/1
檢查配置結果
# 在RouterC上Ping
RouterA的IPv4地址,可收到返回的報文。
[RouterC] ping 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=84 ms
Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=27 ms
Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=25 ms
Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=3 ms
Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=24 ms
--- 10.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 3/32/84 ms
# 在RouterC上Ping
RouterA的IPv6地址,可收到返回的報文。
[RouterC] ping ipv6 fc01::1
PING fc01::1 : 56 data bytes, press CTRL_C to break
Reply from fc01::1
bytes=56 Sequence=1 hop limit=64 time = 28 ms
Reply from fc01::1
bytes=56 Sequence=2 hop limit=64 time = 27 ms
Reply from fc01::1
bytes=56 Sequence=3 hop limit=64 time = 26 ms
Reply from fc01::1
bytes=56 Sequence=4 hop limit=64 time = 27 ms
Reply from fc01::1
bytes=56 Sequence=5 hop limit=64 time = 26 ms
--- fc01::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip
min/avg/max = 26/26/28 ms