Example: Configuring an IPv4 over IPv4 tunnel
Network configuration
As shown in Figure 92, the two subnets IPv4 group 1 and IPv4 group 2 use private IPv4 addresses. Configure an IPv4 over IPv4 tunnel between Switch A and Switch B to make the two subnets reachable to each other.
Figure 92: Network diagram
Procedure
IMPORTANT: By default, interfaces on the devices are disabled (in ADM or Administratively Down state). To have an interface operate, you must use the undo shutdown command to enable that interface. | ||
Make sure Switch A and Switch B have the corresponding VLAN interfaces created and can reach each other through IPv4.
Configure Switch A:
# Add Ten-GigabitEthernet 1/0/1 to VLAN 100.
<SwitchA> system-view [SwitchA] vlan 100 [SwitchA-vlan100] port ten-gigabitethernet 1/0/1 [SwitchA-vlan100] quit
# Specify an IPv4 address for VLAN-interface 100.
[SwitchA] interface vlan-interface 100 [SwitchA-Vlan-interface100] ip address 10.1.1.1 255.255.255.0 [SwitchA-Vlan-interface100] quit
# Add Ten-GigabitEthernet 1/0/2 (the physical interface of the tunnel) to VLAN 101.
[SwitchA] vlan 101 [SwitchA-vlan101] port ten-gigabitethernet 1/0/2 [SwitchA-vlan101] quit
# Specify an IPv4 address for VLAN-interface 101.
[SwitchA] interface vlan-interface 101 [SwitchA-Vlan-interface101] ip address 2.1.1.1 255.255.255.0 [SwitchA-Vlan-interface101] quit
# Create service loopback group 1, and specify its service type as tunnel.
[SwitchA] service-loopback group 1 type tunnel
# Assign Ten-GigabitEthernet 1/0/3 to service loopback group 1.
[SwitchA] interface ten-gigabitethernet 1/0/3 [SwitchA-Ten-GigabitEthernet1/0/3] port service-loopback group 1 [SwitchA-Ten-GigabitEthernet1/0/3] quit
# Create IPv4 over IPv4 tunnel interface Tunnel 1.
[SwitchA] interface tunnel 1 mode ipv4-ipv4
# Specify an IPv4 address for the tunnel interface.
[SwitchA-Tunnel1] ip address 10.1.2.1 255.255.255.0
# Specify the IP address of VLAN-interface 101 as the source address for the tunnel interface.
[SwitchA-Tunnel1] source 2.1.1.1
# Specify the IP address of VLAN-interface 101 on Switch B as the destination address for the tunnel interface.
[SwitchA-Tunnel1] destination 3.1.1.1 [SwitchA-Tunnel1] quit
# Configure a static route destined for IPv4 group 2 through the tunnel interface.
[SwitchA] ip route-static 10.1.3.0 255.255.255.0 tunnel 1
Configure Switch B:
# Add Ten-GigabitEthernet 1/0/1 to VLAN 100.
<SwitchB> system-view [SwitchB] vlan 100 [SwitchB-vlan100] port ten-gigabitethernet 1/0/1 [SwitchB-vlan100] quit
# Specify an IPv4 address for VLAN-interface 100.
[SwitchB] interface vlan-interface 100 [SwitchB-Vlan-interface100] ip address 10.1.3.1 255.255.255.0 [SwitchB-Vlan-interface100] quit
# Add Ten-GigabitEthernet 1/0/2 (the physical interface of the tunnel) to VLAN 101.
[SwitchB] vlan 101 [SwitchB-vlan101] port ten-gigabitethernet 1/0/2 [SwitchB-vlan101] quit
# Specify an IPv4 address for VLAN-interface 101.
[SwitchB] interface vlan-interface 101 [SwitchB-Vlan-interface101] ip address 3.1.1.1 255.255.255.0 [SwitchB-Vlan-interface101] quit
# Create service loopback group 1, and specify its service type as tunnel.
[SwitchB] service-loopback group 1 type tunnel
# Assign Ten-GigabitEthernet 1/0/3 to service loopback group 1.
[SwitchB] interface ten-gigabitethernet 1/0/3 [SwitchB-Ten-GigabitEthernet1/0/3] port service-loopback group 1 [SwitchB-Ten-GigabitEthernet1/0/3] quit
# Create IPv4 over IPv4 tunnel interface Tunnel 2.
[SwitchB] interface tunnel 2 mode ipv4-ipv4
# Specify an IPv4 address for the tunnel interface.
[SwitchB-Tunnel2] ip address 10.1.2.2 255.255.255.0
# Specify the IP address of VLAN-interface 101 as the source address for the tunnel interface.
[SwitchB-Tunnel2] source 3.1.1.1
# Specify the IP address of VLAN-interface 101 on Switch A as the destination address for the tunnel interface.
[SwitchB-Tunnel2] destination 2.1.1.1 [SwitchB-Tunnel2] quit
# Configure a static route destined for IPv4 group 1 through the tunnel interface.
[SwitchB] ip route-static 10.1.1.0 255.255.255.0 tunnel 2
Verifying the configuration
# Use the display interface tunnel command to display the status of the tunnel interfaces on Switch A and Switch B. Verify that the tunnel interfaces are up. (Details not shown.)
# Verify that Switch A and Switch B can ping the IPv4 address of the peer interface VLAN-interface 100. This example uses Switch A.
[SwitchA] ping -a 10.1.1.1 10.1.3.1 Ping 10.1.3.1 (10.1.3.1) from 10.1.1.1: 56 data bytes, press CTRL_C to break 56 bytes from 10.1.3.1: icmp_seq=0 ttl=255 time=2.000 ms 56 bytes from 10.1.3.1: icmp_seq=1 ttl=255 time=1.000 ms 56 bytes from 10.1.3.1: icmp_seq=2 ttl=255 time=0.000 ms 56 bytes from 10.1.3.1: icmp_seq=3 ttl=255 time=1.000 ms 56 bytes from 10.1.3.1: icmp_seq=4 ttl=255 time=1.000 ms --- Ping statistics for 10.1.3.1 --- 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.000/1.000/2.000/0.632 ms