02-Configuration Examples

HomeSupportRoutersH3C SR8800-X Router SeriesConfigure & DeployConfiguration ExamplesH3C SR8800-X Routers Configuration Examples All-In-One-R8630Pxx-6W10002-Configuration Examples
Table of Contents
Related Documents
52-GRE Tunnel Establishment Using OSPF Configuration Examples

Introduction

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

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.

Configuration examples

Network configuration

As shown in Figure 1, Device A, Device B, and Device C on a backbone network are running 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. Enable OSPF on the tunnel interfaces.

·     Use OSPF process 1 on the backbone network, and OSPF process 2 in the user access areas.

Figure 1 Network diagram

Analysis

To meet the network requirements, perform the following tasks:

·     To ensure interconnectivity within the backbone network, complete OSPF configurations on Device A, Device B, and Device C.

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

Procedures

Configuring Device A

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

2.     Configure OSPF process 1.

<DeviceA> system-view

[DeviceA] ospf 1

[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] quit

[DeviceA-ospf-1] quit

3.     Configure OSPF process 2.

[DeviceA] ospf 2

[DeviceA-ospf-2] area 0

[DeviceA-ospf-2-area-0.0.0.0] network 2.2.2.0 0.0.0.255

[DeviceA-ospf-2-area-0.0.0.0] network 10.1.1.0 0.0.0.255

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

[DeviceA-ospf-2] quit

4.     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-GigabitEthernet3/1/1 on Device A).

[DeviceA-Tunnel0] source 11.1.1.1

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

[DeviceA-Tunnel0] destination 11.2.1.2

[DeviceA-Tunnel0] quit

Configuring Device B

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

2.     Configure OSPF process 1.

<DeviceB> system-view

[DeviceB] ospf 1

[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 OSPF process 2.

[DeviceB] ospf 2

[DeviceB-ospf-2] area 0

[DeviceB-ospf-2-area-0.0.0.0] network 2.2.2.0 0.0.0.255

[DeviceB-ospf-2-area-0.0.0.0] network 10.2.1.0 0.0.0.255

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

[DeviceB-ospf-2] quit

4.     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-GigabitEthernet3/1/1 on Device B).

[DeviceB-Tunnel0] source 11.2.1.2

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

[DeviceB-Tunnel0] destination 11.1.1.1

[DeviceB-Tunnel0] quit

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 1

[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 the OSPF 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        XGE3/1/2

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        XGE3/1/2

10.2.1.0/24        O_INTRA 10  1563        2.2.2.2         Tun0

11.1.1.0/24        Direct  0   0           11.1.1.1        XGE3/1/1

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        XGE3/1/1

11.2.1.0/24        O_INTRA 10  2           11.1.1.2        XGE3/1/1

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 OSPF route from Device B to the subnet where Host A 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.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        O_INTRA 10  1563        2.2.2.1         Tun0

10.2.1.0/24        Direct  0   0           10.2.1.2        XGE3/1/2

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        XGE3/1/2

11.1.1.0/24        O_INTRA 10  2           11.2.1.1        XGE3/1/1

11.2.1.0/24        Direct  0   0           11.2.1.2        XGE3/1/1

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        XGE3/1/1

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

XGE3/1/1                           UP   UP       11.1.1.1

XGE3/1/2                           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

XGE3/1/1                           UP   UP       11.2.1.2

XGE3/1/2                           UP   UP       10.2.1.2

InLoop0                           UP   UP(s)    --

NULL0                             UP   UP(s)    --

Tun0                              UP   UP       2.2.2.2

# 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=1.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=2.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=1.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/1.200/2.000/0.400 ms

# Verify that Host A can ping the private IP of 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=2.000 ms

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

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

56 bytes from 10.2.1.1: icmp_seq=3 ttl=253 time=1.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/1.600/2.000/0.490 ms

Configuration files

·     Device A:

#

ospf 1

 area 0.0.0.0

  network 11.1.1.0 0.0.0.255

#

ospf 2

 area 0.0.0.0

  network 2.2.2.0 0.0.0.255

  network 10.1.1.0 0.0.0.255

#

interface Ten-GigabitEthernet3/1/1

 port link-mode route

 ip address 11.1.1.1 255.255.255.0

#

interface Ten-GigabitEthernet3/1/2

 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

#

return

·     Device B:

#

ospf 1

 area 0.0.0.0

  network 11.2.1.0 0.0.0.255

#

ospf 2

 area 0.0.0.0

  network 2.2.2.0 0.0.0.255

  network 10.2.1.0 0.0.0.255

#

interface Ten-GigabitEthernet3/1/1

 port link-mode route

 ip address 11.2.1.2 255.255.255.0

#

interface Ten-GigabitEthernet3/1/2

 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

#

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-GigabitEthernet3/1/1

 port link-mode route

 ip address 11.1.1.2 255.255.255.0

#

interface Ten-GigabitEthernet3/1/2

 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
新华三官网