GRE over IPv6 tunnel configuration example
Network requirements
Two IPv4 subnets Group 1 and Group 2 are connected to an IPv6 network. Create a GRE over IPv6 tunnel between Switch A and Switch B, so that the two IPv4 subnets can communicate with each other through the GRE tunnel over the IPv6 network.
Figure 98: Network diagram
Configuration procedure
Before the configuration, make sure that Switch A and Switch B are reachable to each other.
Configure Switch A:
<SwitchA> system-view
# Enable IPv6.
[SwitchA] ipv6
# Configure interface VLAN-interface 100.
[SwitchA] vlan 100 [SwitchA-vlan100] port GigabitEthernet 1/0/1 [SwitchA-vlan100] quit [SwitchA] interface vlan-interface 100 [SwitchA-Vlan-interface100] ip address 10.1.1.1 255.255.255.0 [SwitchA-Vlan-interface100] quit
# Configure interface VLAN-interface 101, the physical interface of the tunnel.
[SwitchA] vlan 101 [SwitchA-vlan101] port GigabitEthernet 1/0/2 [SwitchA-vlan101] quit [SwitchA] interface vlan-interface 101 [SwitchA-Vlan-interface101] ipv6 address 2002::1:1 64 [SwitchA-Vlan-interface101] quit
# Create service loopback group 1, and configure the service type as tunnel.
[SwitchA] service-loopback group 1 type tunnel
# Add port GigabitEthernet 1/0/3 to service loopback group 1, and disable STP, NDP, and LLDP on the port.
[SwitchA] interface GigabitEthernet 1/0/3 [SwitchA-GigabitEthernet1/0/3] undo stp enable [SwitchA-GigabitEthernet1/0/3] undo ndp enable [SwitchA-GigabitEthernet1/0/3] undo lldp enable [SwitchA-GigabitEthernet1/0/3] port service-loopback group 1 [SwitchA-GigabitEthernet1/0/3] quit
# Create a tunnel interface Tunnel0.
[SwitchA] interface tunnel 0
# Configure an IPv4 address for the tunnel interface Tunnel0.
[SwitchA-Tunnel0] ip address 10.1.2.1 255.255.255.0
# Configure the tunnel encapsulation mode as GRE over IPv6.
[SwitchA-Tunnel0] tunnel-protocol gre ipv6
# Configure the source address of the tunnel interface Tunnel0 as the IP address of interface VLAN-interface 101.
[SwitchA-Tunnel0] source 2002::1:1
# Configure the destination address of the tunnel interface Tunnel0 as the IP address of interface VLAN-interface 101 on Switch B.
[SwitchA-Tunnel0] destination 2001::2:1
# Apply service loopback group 1 to the tunnel in tunnel interface view.
[SwitchA-Tunnel0] service-loopback-group 1 [SwitchA-Tunnel0] quit
# Configure a static route from Switch A through the tunnel interface Tunnel0 to Group 2.
[SwitchA] ip route-static 10.1.3.0 255.255.255.0 tunnel 0
Configure Switch B:
<SwitchB> system-view
# Enable IPv6.
[SwitchB] ipv6
# Configure interface VLAN-interface 100.
[SwitchB] vlan 100 [SwitchB-vlan100] port GigabitEthernet 1/0/1 [SwitchB-vlan100] quit [SwitchB] interface vlan-interface 100 [SwitchB-Vlan-interface100] ip address 10.1.3.1 255.255.255.0 [SwitchB-Vlan-interface100] quit
# Configure interface VLAN-interface 101, the physical interface of the tunnel.
[SwitchB] vlan 101 [SwitchB-vlan101] port GigabitEthernet 1/0/2 [SwitchB-vlan101] quit [SwitchB] interface vlan-interface 101 [SwitchB-Vlan-interface101] ipv6 address 2001::2:1 64 [SwitchB-Vlan-interface101] quit
# Create service loopback group 1, and configure the service type as tunnel.
[SwitchB] service-loopback group 1 type tunnel
# Add port GigabitEthernet 1/0/3 to service loopback group 1, and disable STP, NDP, and LLDP on the port.
[SwitchB] interface GigabitEthernet 1/0/3 [SwitchB-GigabitEthernet1/0/3] undo stp enable [SwitchB-GigabitEthernet1/0/3] undo ndp enable [SwitchB-GigabitEthernet1/0/3] undo lldp enable [SwitchB-GigabitEthernet1/0/3] port service-loopback group 1 [SwitchB-GigabitEthernet1/0/3] quit
# Create a tunnel interface Tunnel0.
[SwitchB] interface tunnel 0
# Configure an IPv4 address for the tunnel interface Tunnel0.
[SwitchB-Tunnel0] ip address 10.1.2.2 255.255.255.0
# Configure the tunnel encapsulation mode as GRE over IPv6.
[SwitchB-Tunnel0] tunnel-protocol gre ipv6
# Configure the source address of the tunnel interface Tunnel0 as the IP address of interface VLAN-interface 101.
[SwitchB-Tunnel0] source 2001::2:1
# Configure the destination address of the tunnel interface Tunnel0 as the IP address of interface VLAN-interface 101 on Switch A.
[SwitchB-Tunnel0] destination 2002::1:1
# Apply service loopback group 1 to the tunnel in tunnel interface view.
[SwitchB-Tunnel0] service-loopback-group 1 [SwitchB-Tunnel0] quit
# Configure a static route from Switch B through the tunnel interface Tunnel0 to Group 1.
[SwitchB] ip route-static 10.1.1.0 255.255.255.0 tunnel 0
Verify the configuration:
# View the tunnel interface status on Switch A and Switch B.
[SwitchA] display interface Tunnel 0 Tunnel0 current state: UP Line protocol current state: UP Description: Tunnel0 Interface The Maximum Transmit Unit is 1456 Internet Address is 10.1.2.1/24 Primary Encapsulation is TUNNEL, service-loopback-group ID is 1. Tunnel source 2002::1:1, destination 2001::2:1 Tunnel bandwidth 64 (kbps) Tunnel protocol/transport GRE/IPv6 GRE key disabled Checksumming of GRE packets disabled Last clearing of counters: Never Last 300 seconds input: 0 bytes/sec, 0 packets/sec Last 300 seconds output: 0 bytes/sec, 0 packets/sec 10 packets input, 840 bytes 0 input error 10 packets output, 840 bytes 0 output error [SwitchB] display interface Tunnel 0 Tunnel0 current state: UP Line protocol current state: UP Description: Tunnel0 Interface The Maximum Transmit Unit is 1456 Internet Address is 10.1.2.2/24 Primary Encapsulation is TUNNEL, service-loopback-group ID is 1. Tunnel source 2001::2:1, destination 2002::1:1 Tunnel bandwidth 64 (kbps) Tunnel protocol/transport GRE/IPv6 GRE key disabled Checksumming of GRE packets disabled Last clearing of counters: Never Last 300 seconds input: 0 bytes/sec, 0 packets/sec Last 300 seconds output: 0 bytes/sec, 0 packets/sec 10 packets input, 840 bytes 0 input error 10 packets output, 840 bytes 0 output error
# From Switch B, ping the IP address of VLAN-interface 100 on Switch A.
[SwitchB] 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=3 ms Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=2 ms Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=2 ms Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=2 ms Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=3 ms --- 10.1.1.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 2/2/3 ms