02-Configuration Examples

HomeSupportRoutersCR16000-M1A SeriesCR16000-M1A SeriesTechnical DocumentsConfigure & DeployConfiguration ExamplesH3C CR16000-M1A Routers Configuration Examples All-In-One-R8630Pxx-6W10002-Configuration Examples
Table of Contents
Related Documents
48-GRE Tunnel Establishment Using Static Routes Configuration Examples

Introduction

The following information provides an example of configuring GRE tunnels using static routes.

Prerequisites

This document is not restricted to specific software or hardware versions. Procedures and information in the examples might be slightly different depending on the software or hardware version of the device.

The configuration examples 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.

The following information is provided based on the assumption that you have basic knowledge of GRE and static routes.

Configuration examples

Network configuration

As shown in Figure 1, Device A, Device B, and Device C run OSPF. Establish a directly connected link between Device A and Device B so that Host A and Host B can communicate with each other. The specific requirements are as follows:

·     Configure Device A as the default gateway for Host A, and Device B as the default gateway for Host B.

·     Establish a directly connected link between Device A and Device B. Use static routes to specify forwarding of packets to the peer ends through the corresponding tunnel interfaces.

Figure 1 Network diagram

Analysis

To meet the network requirements, perform the following tasks:

·     To establish a GRE tunnel between Device A and Device B, complete GRE-related configurations.

·     To transmit packets between Host A and Host B through the GRE tunnel, configure a directly connected route to Host B on Device A and a directly connected route to Host A on Device B.

Procedures

Configuring Device A

1.     Assign an IP address to each interface, as shown in Figure 1. (Details not shown.)

2.     Configure basic OSPF functions.

<DeviceA> system-view

[DeviceA] ospf

[DeviceA-ospf-1] area 0

[DeviceA-ospf-1-area-0.0.0.0] network 11.1.1.0 0.0.0.255

[DeviceA-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255

[DeviceA-ospf-1-area-0.0.0.0] quit

[DeviceA-ospf-1] quit

3.     Configure a GRE tunnel:

# Create tunnel interface Tunnel 0, and specify the tunnel mode as GRE/IPv4.

[DeviceA] interface tunnel 0 mode gre

# Assign an IP address to interface Tunnel 0.

[DeviceA-Tunnel0] ip address 2.2.2.1 255.255.255.0

# Configure the source address of interface Tunnel 0 (as the IP address of Ten-GigabitEthernet0/0/15 on Device A).

[DeviceA-Tunnel0] source 11.1.1.1

# Configure the destination address of interface Tunnel 0 (as the IP address of Ten-GigabitEthernet0/0/15 on Device B).

[DeviceA-Tunnel0] destination 11.2.1.2

[DeviceA-Tunnel0] quit

4.     Configure a static route to the subnet where Host B resides.

[DeviceA] ip route-static 10.2.1.0 255.255.255.0 Tunnel 0

Configuring Device B

1.     Assign an IP address to each interface, as shown in Figure 1. (Details not shown.)

2.     Configure basic OSPF functions.

<DeviceB> system-view

[DeviceB] ospf

[DeviceB-ospf-1] area 0

[DeviceB-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255

[DeviceB-ospf-1-area-0.0.0.0] quit

[DeviceB-ospf-1] quit

3.     Configure a GRE tunnel:

# Create tunnel interface Tunnel 0, and specify the tunnel mode as GRE/IPv4.

[DeviceB] interface tunnel 0 mode gre

# Assign an IP address to interface Tunnel 0.

[DeviceB-Tunnel0] ip address 2.2.2.2 255.255.255.0

# Configure the source address of interface Tunnel 0 (as the IP address of Ten-GigabitEthernet0/0/15 on Device B).

[DeviceB-Tunnel0] source 11.2.1.2

# Configure the destination address of interface Tunnel 0 (as the IP address of Ten-GigabitEthernet0/0/15 on Device A).

[DeviceB-Tunnel0] destination 11.1.1.1

[DeviceB-Tunnel0] quit

4.     Configure a static route to the subnet where Host A resides.

[DeviceB] ip route-static 10.1.1.0 255.255.255.0 Tunnel 0

Configuring Device C

1.     Assign an IP address to each interface, as shown in Figure 1. (Details not shown.)

2.     Configure basic OSPF functions.

<DeviceC> system-view

[DeviceC] ospf

[DeviceC-ospf-1] area 0

[DeviceC-ospf-1-area-0.0.0.0] network 11.1.1.0 0.0.0.255

[DeviceC-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255

[DeviceC-ospf-1-area-0.0.0.0] quit

[DeviceC-ospf-1] quit

Verifying the configuration

# Execute the display ip routing-table command on Device A. Verify that Device A has learned the OSPF route to the 11.2.1.0/24 subnet.

<DeviceA>display ip routing-table

 

Destinations : 15       Routes : 15

 

Destination/Mask   Proto   Pre Cost        NextHop         Interface

2.2.2.0/24         Direct  0   0           2.2.2.1         Tun0

2.2.2.1/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.255/32       Direct  0   0           2.2.2.1         Tun0

10.1.1.0/24        Direct  0   0           10.1.1.2        XGE0/0/16

10.1.1.2/32        Direct  0   0           127.0.0.1       InLoop0

10.1.1.255/32      Direct  0   0           10.1.1.2        XGE0/0/16

10.2.1.0/24        Static  60  0           0.0.0.0         Tun0

11.1.1.0/24        Direct  0   0           11.1.1.1        XGE0/0/15

11.1.1.1/32        Direct  0   0           127.0.0.1       InLoop0

11.1.1.255/32      Direct  0   0           11.1.1.1        XGE0/0/15

11.2.1.0/24        O_INTRA 10  2           11.1.1.2        XGE0/0/15

127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0

127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0

127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

# Execute the display ip routing-table command on Device B. Verify that Device B has learned the OSPF route to the 11.1.1.0/24 subnet.

<DeviceB>display ip routing-table

 

Destinations : 15       Routes : 15

 

Destination/Mask   Proto   Pre Cost        NextHop         Interface

2.2.2.0/24         Direct  0   0           2.2.2.2         Tun0

2.2.2.2/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.255/32       Direct  0   0           2.2.2.2         Tun0

10.1.1.0/24        Static  60  0           0.0.0.0         Tun0

10.2.1.0/24        Direct  0   0           10.2.1.2        XGE0/0/16

10.2.1.2/32        Direct  0   0           127.0.0.1       InLoop0

10.2.1.255/32      Direct  0   0           10.2.1.2        XGE0/0/16

11.1.1.0/24        O_INTRA 10  2           11.2.1.1        XGE0/0/15

11.2.1.0/24        Direct  0   0           11.2.1.2        XGE0/0/15

11.2.1.2/32        Direct  0   0           127.0.0.1       InLoop0

11.2.1.255/32      Direct  0   0           11.2.1.2        XGE0/0/15

127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0

127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0

127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

# Execute the display interface brief command on Device A. Verify that the status of interface Tunnel 0 on Device A is up.

<DeviceA>display interface brief

Brief information on interfaces in route mode:

Link: ADM - administratively down; Stby - standby

Protocol: (s) - spoofing

Interface                         Link Protocol Primary IP      Description

XGE0/0/15                           UP   UP       11.1.1.1

XGE0/0/16                           UP   UP       10.1.1.2

InLoop0                           UP   UP(s)    --

NULL0                             UP   UP(s)    --

Tun0                              UP   UP       2.2.2.1

# Execute the display interface brief command on Device B. Verify that the status of interface Tunnel 0 on Device B is up.

<DeviceB>display interface brief

Brief information on interfaces in route mode:

Link: ADM - administratively down; Stby - standby

Protocol: (s) - spoofing

Interface                         Link Protocol Primary IP      Description

XGE0/0/15                           UP   UP       11.2.1.2

XGE0/0/16                           UP   UP       10.2.1.2

InLoop0                           UP   UP(s)    --

NULL0                             UP   UP(s)    --

Tun0                              UP   UP       2.2.2.2

# Execute the display ip routing-table command on Device A. Verify that the static route from Device A to the subnet where Host B resides goes through interface Tunnel 0.

<DeviceA>display ip routing-table

 

Destinations : 15       Routes : 15

 

Destination/Mask   Proto   Pre Cost        NextHop         Interface

2.2.2.0/24         Direct  0   0           2.2.2.1         Tun0

2.2.2.1/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.255/32       Direct  0   0           2.2.2.1         Tun0

10.1.1.0/24        Direct  0   0           10.1.1.2        XGE0/0/16

10.1.1.2/32        Direct  0   0           127.0.0.1       InLoop0

10.1.1.255/32      Direct  0   0           10.1.1.2        XGE0/0/16

10.2.1.0/24        Static  60  0           0.0.0.0         Tun0

11.1.1.0/24        Direct  0   0           11.1.1.1        XGE0/0/15

11.1.1.1/32        Direct  0   0           127.0.0.1       InLoop0

11.1.1.255/32      Direct  0   0           11.1.1.1        XGE0/0/15

11.2.1.0/24        O_INTRA 10  2           11.1.1.2        XGE0/0/15

127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0

127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0

127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

# Execute the display ip routing-table command on Device B. Verify that the static route from Device B to the subnet where Host A resides goes through interface Tunnel 0.

<DeviceB>display ip routing-table

 

Destinations : 15       Routes : 15

 

Destination/Mask   Proto   Pre Cost        NextHop         Interface

2.2.2.0/24         Direct  0   0           2.2.2.2         Tun0

2.2.2.2/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.255/32       Direct  0   0           2.2.2.2         Tun0

10.1.1.0/24        Static  60  0           0.0.0.0         Tun0

10.2.1.0/24        Direct  0   0           10.2.1.2        XGE0/0/16

10.2.1.2/32        Direct  0   0           127.0.0.1       InLoop0

10.2.1.255/32      Direct  0   0           10.2.1.2        XGE0/0/16

11.1.1.0/24        O_INTRA 10  2           11.2.1.1        XGE0/0/15

11.2.1.0/24        Direct  0   0           11.2.1.2        XGE0/0/15

11.2.1.2/32        Direct  0   0           127.0.0.1       InLoop0

11.2.1.255/32      Direct  0   0           11.2.1.2        XGE0/0/15

127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0

127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0

127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

# Verify that the private IP of Device A can ping the private IP of Device B.

<DeviceA>ping -a 10.1.1.2 10.2.1.2

Ping 10.2.1.2 (10.2.1.2) from 10.1.1.2: 56 data bytes, press CTRL+C to break

56 bytes from 10.2.1.2: icmp_seq=0 ttl=255 time=26.000 ms

56 bytes from 10.2.1.2: icmp_seq=1 ttl=255 time=1.000 ms

56 bytes from 10.2.1.2: icmp_seq=2 ttl=255 time=1.000 ms

56 bytes from 10.2.1.2: icmp_seq=3 ttl=255 time=1.000 ms

56 bytes from 10.2.1.2: icmp_seq=4 ttl=255 time=2.000 ms

 

--- Ping statistics for 10.2.1.2 ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

round-trip min/avg/max/std-dev = 1.000/6.200/26.000/9.908 ms

# Verify that Host A can ping Host B.

<HostA>ping 10.2.1.1

Ping 10.2.1.1 (10.2.1.1): 56 data bytes, press CTRL+C to break

56 bytes from 10.2.1.1: icmp_seq=0 ttl=253 time=3.000 ms

56 bytes from 10.2.1.1: icmp_seq=1 ttl=253 time=1.000 ms

56 bytes from 10.2.1.1: icmp_seq=2 ttl=253 time=2.000 ms

56 bytes from 10.2.1.1: icmp_seq=3 ttl=253 time=2.000 ms

56 bytes from 10.2.1.1: icmp_seq=4 ttl=253 time=2.000 ms

 

--- Ping statistics for 10.2.1.1 ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

round-trip min/avg/max/std-dev = 1.000/2.000/3.000/0.632 ms

Configuration files

·     Device A:

#

ospf 1

 area 0.0.0.0

  network 11.1.1.0 0.0.0.255

  network 11.2.1.0 0.0.0.255

#

interface Ten-GigabitEthernet0/0/15

 port link-mode route

 ip address 11.1.1.1 255.255.255.0

#

interface Ten-GigabitEthernet0/0/16

 port link-mode route

 ip address 10.1.1.2 255.255.255.0

#

interface Tunnel0 mode gre

 ip address 2.2.2.1 255.255.255.0

 source 11.1.1.1

 destination 11.2.1.2

#

 ip route-static 10.2.1.0 24 Tunnel0

#

return

·     Device B:

#

ospf 1

 area 0.0.0.0

  network 11.2.1.0 0.0.0.255

#

interface Ten-GigabitEthernet0/0/15

 port link-mode route

 ip address 11.2.1.2 255.255.255.0

#

interface Ten-GigabitEthernet0/0/16

 port link-mode route

 ip address 10.2.1.2 255.255.255.0

#

interface Tunnel0 mode gre

 ip address 2.2.2.2 255.255.255.0

 source 11.2.1.2

 destination 11.1.1.1

#

 ip route-static 10.1.1.0 24 Tunnel0

#

return

·     Device C:

#

ospf 1

 area 0.0.0.0

  network 11.1.1.0 0.0.0.255

  network 11.2.1.0 0.0.0.255

#

interface Ten-GigabitEthernet0/0/15

 port link-mode route

 ip address 11.1.1.2 255.255.255.0

#

interface Ten-GigabitEthernet0/0/16

 port link-mode route

 ip address 11.2.1.1 255.255.255.0

#

return

Related documentation

·     Layer 3—IP Services Configuration Guide

·     Layer 3—IP Routing Configuration Guide

·     Layer 3—IP Services Command Reference

·     Layer 3—IP Routing Command Reference

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Intelligent Storage
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
  • Technical Blogs
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网