Example for Configuring an IPv6 over IPv4 GRE Tunnel
Networking Requirements
As shown in Figure 11-15, two IPv6 networks connect to RouterB on an IPv4 backbone network respectively through RouterA and RouterC. An IPv6 over IPv4 GRE tunnel needs to be set up between RouterA and RouterC so that hosts on the two IPv6 networks can communicate.
Configuration Roadmap
The configuration roadmap is as follows:
Configure IP addresses for physical interfaces so that devices can communicate on the IPv4 network.
Create tunnel interfaces on RouterA and RouterC, set up a GRE tunnel between them, and specify the source and destination addresses of the tunnel interfaces, so that encapsulated packets can be forwarded using OSPF routes. The source address is the IP address of the interface sending packets, and the destination address is the IP address of the interface receiving packets.
Configure static routes on RouterA and RouterC, so that traffic between PC1 and PC2 can be forwarded through the GRE tunnel. Set the destination address to the network segment connected to the peer PC and the outbound interface to the tunnel interface on the local device.
Procedure
- Configure an IP address for each physical interface.
# Configure 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
# Configure 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
# Configure 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
- Configure IPv4 static routes.
# Configure RouterA.
[RouterA] ip route-static 10.1.2.2 255.255.255.0 10.1.1.2
# Configure RouterC.
[RouterC] ip route-static 10.1.1.1 255.255.255.0 10.1.2.1
- Configure tunnel interfaces.
# Configure RouterA.
[RouterA] interface tunnel 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
# Configure 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
- Configure tunnel static routes.
# Configure RouterA.
[RouterA] ipv6 route-static fc03::1 64 tunnel 0/0/1
# Configure RouterC.
[RouterC] ipv6 route-static fc01::1 64 tunnel 0/0/1
- Verify the configuration.
# Ping the IPv4 address of RouterA from RouterC. RouterC can receive a Reply packet from RouterA.
[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
# Ping the IPv6 address of RouterA from RouterC. RouterC can receive a Reply packet from RouterA.
[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
Configuration Files
Configuration file of RouterA
# sysname RouterA # ipv6 # interface GigabitEthernet1/0/0 ip address 10.1.1.1 255.255.255.0 # interface GigabitEthernet2/0/0 ipv6 enable ipv6 address fc01::1/64 # interface Tunnel0/0/1 ipv6 enable ipv6 address fc02::1/64 tunnel-protocol gre source 10.1.1.1 destination 10.1.2.2 # ip route-static 10.1.2.0 255.255.255.0 10.1.1.2 # ipv6 route-static fc03:: 64 Tunnel0/0/1 # return
Configuration file of RouterB
# sysname RouterB # interface GigabitEthernet1/0/0 ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet2/0/0 ip address 10.1.2.1 255.255.255.0 # return
Configuration file of RouterC
# sysname RouterC # ipv6 # interface GigabitEthernet1/0/0 ip address 10.1.2.2 255.255.255.0 # interface GigabitEthernet2/0/0 ipv6 enable ipv6 address fc03::1/64 # interface Tunnel0/0/1 ipv6 enable ipv6 address fc02::2/64 tunnel-protocol gre source 10.1.2.2 destination 10.1.1.1 # ip route-static 10.1.1.0 255.255.255.0 10.1.2.1 # ipv6 route-static fc01:: 64 Tunnel0/0/1 # return