04-S12500_GRE_Tunnel_Configuration_Examples
Chapters Download (144.54 KB)
Title | Size | Download |
---|---|---|
04-S12500_GRE_Tunnel_Configuration_Examples | 144.54 KB |
Contents
Example: Configuring an IPv4 over IPv4 GRE tunnel
Configuration restrictions and guidelines
Example: Configuring an IPv6 over IPv4 GRE tunnel
Configuration restrictions and guidelines
This document provides GRE tunnel configuration examples.
H3C S12500 switches support GRE over IPv4 tunnels, but they do not support GRE over IPv6 tunnels.
The configuration examples in this document were created and verified in a lab environment, and all the devices were started with the factory default configuration. When you are working on a live network, make sure you understand the potential impact of every command on your network.
This document assumes that you have basic knowledge of GRE tunneling.
As shown in Figure 1, Switch A, Switch B, and Switch C run the IPv4 protocol.
Configure an IPv4 over IPv4 GRE tunnel between Switch A and Switch B for PC 1 and PC 2 in the private IPv4 networks to communicate with each other.
To meet the network requirements, you must perform the following tasks:
· For Switch A to forward packets from PC 1 to PC 2 through the GRE tunnel, configure a static route with the following settings:
? Destination address is the IP address of PC 2.
? Next hop is the IP address of the tunnel interface on Switch B.
Configure Switch B in the same way that Switch A is configured. (You can also configure a dynamic routing protocol on the tunnel interface and the VLAN interface that connects to PC 1. However, this example uses a static route.)
· To make sure the tunnel source and the tunnel destination can reach each other, configure a static route to the other tunnel end on both Switch A and Switch B. The next hop for the two routes is Switch C.
This configuration example was created and verified on S12500-CMW710-R7129.
When you configure an IPv4 over IPv4 GRE tunnel, follow these restrictions and guidelines:
· The source interface for the tunnel must be up and must have an IP address. It can be a VLAN interface, a GigabitEthernet interface, or a loopback interface.
· You must configure the tunnel source address and destination address at both ends of a tunnel, and the tunnel source or destination address at one end must be the tunnel destination or source address at the other end.
· The IP address of the tunnel interface and the tunnel destination address configured on the tunnel interface must be in different subnets.
· By default, Ethernet, VLAN, and aggregate interfaces are shut down. You must use the undo shutdown command to bring them up. In this example, the interfaces are already up, and you do not need to use this command.
# Create VLANs and specify IP addresses for the VLAN interfaces as shown in Figure 1. (Details not shown.)
# Create a tunnel interface Tunnel 0 and specify the tunnel mode as GRE over IPv4.
[SwitchA] interface tunnel 0 mode gre
# Specify an IP address for the tunnel interface.
[SwitchA-Tunnel0] ip address 101.1.2.1 24
# Specify the IP address of VLAN-interface 101 on Switch A as the source address of the tunnel interface.
[SwitchA-Tunnel0] source 192.13.2.2
# Specify the IP address of VLAN-interface 200 on Switch B as the destination address of the tunnel interface.
[SwitchA-Tunnel0] destination 131.108.5.2
[SwitchA-Tunnel0] quit
# Configure a static route to PC 2 through the tunnel interface.
[SwitchA] ip route-static 10.101.2.2 255.255.255.0 Tunnel 0
# Configure a static route to the tunnel destination.
[SwitchA] ip route-static 131.108.5.2 255.255.255.0 192.13.2.1
# Create VLANs and specify IP addresses for the VLAN interfaces as shown in Figure 1. (Details not shown.)
# Create a tunnel interface Tunnel 0 and specify the tunnel mode as GRE over IPv4.
[SwitchB] interface tunnel 0 mode gre
# Specify an IP address for the tunnel interface.
[SwitchB-Tunnel0] ip address 101.1.2.2 24
# Specify the IP address of VLAN-interface 200 on Switch B as the source address of the tunnel interface.
[SwitchB-Tunnel0] source 131.108.5.2
# Specify the IP address of VLAN-interface 101 on Switch A as the destination address of the tunnel interface.
[SwitchB-Tunnel0] destination 192.13.2.2
[SwitchB-Tunnel0] quit
# Configure a static route to PC 1 through the tunnel interface.
[SwitchB] ip route-static 10.101.1.2 255.255.255.0 Tunnel 0
# Configure a static route to the tunnel destination.
[SwitchB] ip route-static 192.13.2.2 255.255.255.0 131.108.5.1
# Create VLANs and specify IP addresses for the VLAN interfaces as shown in Figure 1. (Details not shown.)
# Configure a route to PC 2 through Switch A. This task is performed on Windows XP.
C:\>route ADD 10.101.2.0 MASK 255.255.255.0 10.101.1.1
# Configure a route to PC 1 through Switch B. This task is performed on Windows XP.
C:\> route ADD 10.101.1.0 MASK 255.255.255.0 10.101.2.1
Verify that PC 1 and PC 2 can ping each other.
# Ping PC 2 from PC 1.
C:\>ping 10.101.2.2
Pinging 10.101.2.2 with 32 bytes of data:
Reply from 10.101.2.2: bytes=32 time<1ms TTL=253
Reply from 10.101.2.2: bytes=32 time<1ms TTL=253
Reply from 10.101.2.2: bytes=32 time<1ms TTL=253
Reply from 10.101.2.2: bytes=32 time<1ms TTL=253
Ping statistics for 10.101.2.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
# Ping PC 1 from PC 2.
C:\>ping 10.101.1.2
Pinging 10.101.1.2 with 32 bytes of data:
Reply from 10.101.1.2: bytes=32 time<1ms TTL=253
Reply from 10.101.1.2: bytes=32 time<1ms TTL=253
Reply from 10.101.1.2: bytes=32 time<1ms TTL=253
Reply from 10.101.1.2: bytes=32 time<1ms TTL=253
Ping statistics for 10.101.1.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
· Switch A:
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 10.101.1.1 255.255.255.0
#
interface Vlan-interface101
ip address 192.13.2.2 255.255.255.0
#
interface GigabitEthernet3/0/1
port link-mode bridge
port access vlan 100
#
interface GigabitEthernet3/0/3
port link-mode bridge
port access vlan 101
#
interface Tunnel0 mode gre
ip address 101.1.2.1 255.255.255.0
source 192.13.2.2
destination 131.108.5.2
#
ip route-static 10.101.2.0 255.255.255.0 Tunnel 0
ip route-static 131.108.5.2 255.255.255.0 192.13.2.1
#
· Switch B:
#
vlan 200 to 201
#
interface Vlan-interface200
ip address 131.108.5.2 255.255.255.0
#
interface Vlan-interface201
ip address 10.101.2.1 255.255.255.0
#
interface GigabitEthernet3/0/1
port link-mode bridge
port access vlan 201
#
interface GigabitEthernet3/0/3
port link-mode bridge
port access vlan 200
#
interface Tunnel0 mode gre
ip address 101.1.2.2 255.255.255.0
source 131.108.5.2
destination 192.13.2.2
#
ip route-static 10.101.1.0 255.255.255.0 tunnel 0
ip route-static 192.13.2.2 255.255.255.0 131.108.5.1
#
· Switch C:
#
vlan 101
#
vlan 200
#
interface Vlan-interface101
ip address 192.13.2.1 255.255.255.0
#
interface Vlan-interface200
ip address 131.108.5.1 255.255.255.0
#
interface GigabitEthernet2/0/1
port link-mode bridge
port access vlan 101
#
interface GigabitEthernet2/0/2
port link-mode bridge
port access vlan 200
#
As shown in Figure 2, configure an IPv6 over IPv4 GRE tunnel between the dual-stack switches Switch A and Switch B for PC 1 and PC 2 in the IPv6 networks to communicate with each other.
To meet the network requirements, you must perform the following tasks:
· To make sure PC 1 and PC 2 can communicate with each other, configure an IPv6 address for the tunnel interface on Switch A and Switch B.
· For Switch A to forward packets from PC 1 to PC 2 through the GRE tunnel, configure a static route with the following settings:
? Destination address is the IP address of PC 2.
? Next hop is the IP address of the tunnel interface on Switch B.
Configure Switch B in the same way that Switch A is configured. (You can also configure a dynamic routing protocol on the tunnel interface and the VLAN interface that connects to PC 1. This example uses a static route.)
· To make sure the tunnel source and the tunnel destination can reach each other, configure a static route to the other end on both Switch A and Switch B. The next hop for the two routes is Switch C.
This configuration example was created and verified on S12500-CMW710-R7129.
When you configure an IPv6 over IPv4 GRE tunnel, follow these restrictions and guidelines:
· The source interface for the tunnel must be up and must have an IP address. It can be a VLAN interface, a GigabitEthernet interface, or a loopback interface.
· You must configure the tunnel source address and destination address at both ends of a tunnel, and the tunnel source or destination address at one end must be the tunnel destination or source address at the other end.
· By default, Ethernet, VLAN, and aggregate interfaces are shut down. You must use the undo shutdown command to bring them up. In this example, the interfaces are already up, and you do not need to use this command.
# Create VLANs and specify IP addresses for the VLAN interfaces as shown in Figure 2. (Details not shown.)
# Create a tunnel interface Tunnel 0 and specify the tunnel mode as GRE over IPv4.
[SwitchA] interface tunnel 0 mode gre
# Specify an IPv6 address for the tunnel interface.
[SwitchA-Tunnel0] ipv6 address 3000::1 64
# Specify the IP address of VLAN-interface 101 on Switch A as the source address of the tunnel interface.
[SwitchA-Tunnel0] source 192.13.2.2
# Specify the IP address of VLAN-interface 200 on Switch B as the destination address of the tunnel interface.
[SwitchA-Tunnel0] destination 131.108.5.2
[SwitchA-Tunnel0] quit
# Configure a static route to PC 2 through the tunnel interface.
[SwitchA] ipv6 route-static 2000:: 64 Tunnel 0
# Configure a static route to the tunnel destination.
[SwitchA] ip route-static 131.108.5.2 255.255.255.0 192.13.2.1
# Create VLANs and specify IP addresses for the VLAN interfaces as shown in Figure 2. (Details not shown.)
# Create a tunnel interface Tunnel 0 and specify the tunnel mode as GRE over IPv4.
[SwitchB] interface tunnel 0 mode gre
# Specify an IPv6 address for the tunnel interface.
[SwitchB-Tunnel0] ipv6 address 3000::2 64
# Specify the IP address of VLAN-interface 200 on Switch B as the source address of the tunnel interface.
[SwitchB-Tunnel0] source 131.108.5.2
# Specify the IP address of VLAN-interface 101 on Switch A as the destination address of the tunnel interface.
[SwitchB-Tunnel0] destination 192.13.2.2
[SwitchB-Tunnel0] quit
# Configure a static route to PC 1 through the tunnel interface.
[SwitchB] ipv6 route-static 1000:: 64 Tunnel 0
# Configure a static route to the tunnel destination.
[SwitchB] ip route-static 192.13.2.2 255.255.255.0 131.108.5.1
# Create VLANs and specify IP addresses for the VLAN interfaces as shown in Figure 2. (Details not shown.)
The following tasks are performed on Windows XP:
# Install the IPv6 protocol on PC 1.
C:\>ipv6 install
# Display the IPv6 interface configuration to obtain the interface index.
C:\>ipv6 if
# Configure an IPv6 address for the interface. Typically, the interface index is 5.
C:\>ipv6 adu 5/1000::2
# Configure a default IPv6 route.
C:\>ipv6 rtu ::/0 5/1000::1
The following tasks are performed on Windows XP:
# Install the IPv6 protocol on PC 2.
C:\>ipv6 install
# Display the IPv6 interface configuration to obtain the interface index.
C:\>ipv6 if
# Configure an IPv6 address for the interface. Typically, the interface index is 5.
C:\>ipv6 adu 5/2000::2
# Configure a default IPv6 route.
C:\>ipv6 rtu ::/0 5/2000::1
Verify that PC 1 and PC 2 can ping each other.
# Ping PC 2 from PC 1.
C:\>ping6 -s 1000::1 2000::2
Pinging 2000::2
from 1000::1 with 32 bytes of data:
Reply from 2000::2: bytes=32 time<1ms
Reply from 2000::2: bytes=32 time<1ms
Reply from 2000::2: bytes=32 time<1ms
Reply from 2000::2: bytes=32 time<1ms
Ping statistics for 2000::2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
# Ping PC 1 from PC 2.
C:\>ping6 -s 2000::2 1000::2
Pinging 1000::2
from 2000::2 with 32 bytes of data:
Reply from 1000::2: bytes=32 time<1ms
Reply from 1000::2: bytes=32 time<1ms
Reply from 1000::2: bytes=32 time<1ms
Reply from 1000::2: bytes=32 time<1ms
Ping statistics for 1000::2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
· Switch A:
#
vlan 100 to 101
#
interface Vlan-interface100
ipv6 address 1000::1/64
#
interface Vlan-interface101
ip address 192.13.2.2 255.255.255.0
#
interface GigabitEthernet3/0/1
port link-mode bridge
port access vlan 100
#
interface GigabitEthernet3/0/3
port link-mode bridge
port access vlan 101
#
interface Tunnel0 mode gre
ipv6 address 3000::1/64
source 192.13.2.2
destination 131.108.5.2
#
ip route-static 131.108.5.2 255.255.255.0 192.13.2.1
#
ipv6 route-static 2000:: 64 Tunnel 0
#
· Switch B:
#
vlan 200 to 201
#
interface Vlan-interface200
ip address 131.108.5.2 255.255.255.0
#
interface Vlan-interface201
ipv6 address 2000::1/64
#
interface GigabitEthernet3/0/1
port link-mode bridge
port access vlan 201
#
interface GigabitEthernet3/0/3
port link-mode bridge
port access vlan 200
#
interface Tunnel0 mode gre
ipv6 address 3000::2/64
source 131.108.5.2
destination 192.13.2.2
#
ip route-static 192.13.2.2 255.255.255.0 131.108.5.1
#
ipv6 route-static 1000:: 64 Tunnel 0
#
· Switch C:
#
vlan 101
#
vlan 200
#
interface Vlan-interface101
ip address 192.13.2.1 255.255.255.0
#
interface Vlan-interface200
ip address 131.108.5.1 255.255.255.0
#
interface GigabitEthernet2/0/1
port link-mode bridge
port access vlan 101
#
interface GigabitEthernet2/0/2
port link-mode bridge
port access vlan 200
#
· H3C S12500 Routing Switch Series Layer 3—IP Services Configuration Guide
· H3C S12500 Routing Switch Series Layer 3—IP Services Command Reference