No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

Typical Configuration Examples

CloudEngine 12800, 12800E, 8800, 7800, 6800, and 5800 Series Switches

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Configuring a Routing Policy

Configuring a Routing Policy

Applicable Products and Versions

This example applies to the CE12800/CE6800/CE5800 V100R001C00 or later, CE12800E V200R002C50 or later, CE8800 V100R006C00 or later, and CE7800 V100R003C00 or later.

Networking Requirements

As shown in Figure 2-55, a company has one headquarters and two branches, and three ASs: AS 100, AS 200, and AS 300. The headquarters network belongs to AS 100, and the two branch networks belong to AS 200 and AS 300 respectively. OSPF runs in the three ASs. BGP runs between the headquarters and two branches for interconnection. The customer requires that the two branches communicate through the core network of the headquarters. A routing policy is configured to control routes imported into OSPF and BGP. Only required routes are imported.

Figure 2-55 Networking for configuring a routing policy
Table 2-18 Data preparation

Device

Interface

IP Address

S100_1

10GE1/0/1

192.168.10.1/24

10GE1/0/2

192.168.20.1/24

10GE1/0/3

192.168.30.1/24

S100_2

10GE1/0/1

192.168.40.1/24

10GE1/0/2

192.168.50.1/24

10GE1/0/3

192.168.30.2/24

S200_1

10GE1/0/1

192.168.10.2/24

10GE1/0/2

192.168.50.2/24

10GE1/0/3

192.168.60.1/24

S200_2

10GE1/0/1

172.16.1.1/24

10GE1/0/2

172.16.2.1/24

10GE1/0/3

192.168.60.2/24

S300_1

10GE1/0/1

192.168.40.2/24

10GE1/0/2

192.168.20.2/24

10GE1/0/3

192.168.70.1/24

S300_2

10GE1/0/1

172.17.1.1/24

10GE1/0/2

172.17.2.1/24

10GE1/0/3

192.168.70.2/24

Configuration Roadmap

The configuration roadmap is as follows:
  1. Configure basic BGP and OSPF functions.
  2. Configure an IGP to interact with BGP on edge devices of ASs and configure a routing policy to control advertised and imported routes.

Procedure

  1. Configure basic BGP functions on S100_1, S100_2, S200_1, and S300_1. S100_1 is used as an example. The configurations of S100_2, S200_1, and S300_1 are similar to the configuration of S100_1, and are not mentioned here.

    <HUAWEI> system-view
    [~HUAWEI] sysname S100_1   //Configure the device name.
    [~HUAWEI] commit
    [~S100_1] bgp 100   //Set the AS number to 100 and enter the BGP view.
    [~S100_1-bgp] router-id 10.1.1.1   //Set the router ID to 10.1.1.1.
    [~S100_1-bgp] peer 192.168.10.2 as-number 200   //Configure a BGP peer.
    [~S100_1-bgp] peer 192.168.10.2 description TO_S200_1   //Configure the description for the BGP peer.
    [~S100_1-bgp] peer 192.168.20.2 as-number 300
    [~S100_1-bgp] peer 192.168.20.2 description TO_S300_1
    [~S100_1-bgp] peer 192.168.30.2 as-number 100
    [~S100_1-bgp] peer 192.168.30.2 description TO_S100_2
    [~S100_1-bgp] network 192.168.10.0 24   //Configure the device to advertise routes on the network segment 192.168.10.0 24.
    [~S100_1-bgp] network 192.168.20.0 24
    [~S100_1-bgp] network 192.168.30.0 24
    [~S100_1-bgp] quit
    [~S100_1] commit

    Configure basic BGP functions on S100_2, S200_1, and S300_1 according to the configuration of S100_1, and set router IDs.

    Table 2-19 Router ID configuration

    Device

    Router ID

    S100_2

    10.2.1.1

    S200_1

    20.1.1.1

    S300_1

    30.1.1.1

  2. Configure basic OSPF functions on S200_1, S200_2, S300_1, and S300_2. S200_2 is used as an example. The configurations of S200_1, S300_1, and S300_2 are similar to the configuration of S200_2, and are not mentioned here.

    <S200_2> system-view
    [~S200_2] ospf   //Create an OSPF process.
    [~S200_2-ospf-1] area 0   //Enter the OSPF area view.
    [~S200_2-ospf-1-area-0.0.0.0] network 192.168.60.0 0.0.0.255   //Specify the interface running OSPF.
    [~S200_2-ospf-1-area-0.0.0.0] network 172.16.1.0 0.0.0.255
    [~S200_2-ospf-1-area-0.0.0.0] network 172.16.2.0 0.0.0.255
    [~S200_2-ospf-1-area-0.0.0.0] quit
    [~S200_2-ospf-1] quit
    [~S200_2] commit

  3. Configure an IGP to interact with BGP and configure a routing policy.

    # Configure an IGP to interact with BGP and configure a routing policy on S200_1. The configuration of S300_1 is similar to that of S200_1, and is not mentioned here.

    Configure BGP to import OSPF routes.

    <S200_1> system-view
    [~S200_1] bgp 200
    [~S200_1-bgp] import-route ospf 1   //Import routes of OSPF process 1 into the BGP routing table.
    [~S200_1-bgp] quit
    [~S200_1] commit

    Define an IP prefix list named ospf_import that allows routes with prefixes of 172.16.1.0/24, 172.16.2.0/24, 172.17.1.0/24, and 172.17.2.0/24.

    [~S200_1] ip ip-prefix ospf_import index 10 permit 172.17.1.0 24   //Define the IP prefix list and allow routes with the prefix of 172.16.1.0/24.
    [~S200_1] ip ip-prefix ospf_import index 20 permit 172.17.2.0 24

    Create a route-policy named ospf_import, set the matching mode to permit, and define an if-match clause to allow routes with destination addresses matching the IP prefix list ospf_import.

    [~S200_1] route-policy ospf_import permit node 10   //Create a route-policy and define the action as permit.
    [~S200_1-route-policy] if-match ip-prefix ospf_import   //Define the if-match clause.
    [~S200_1-route-policy] quit
    [~S200_1] commit

    Configure OSPF to import BGP routes and apply the route-policy ospf_import.

    [~S200_1] ospf
    [~S200_1-ospf-1] import-route bgp route-policy ospf_import
    [~S200_1-ospf-1] quit
    [~S200_1] commit

Verifying the Configuration

After the preceding configurations are complete, run the display ip routing-table command on S200_2 to view the IP routing table. S200_2 has two external routes: 172.17.1.0/24 and 172.17.2.0/24.

<S200_2> display ip routing-table
Proto: Protocol        Pre: Preference
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: _public_
         Destinations : 15       Routes : 15       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
     172.16.1.0/24  Direct  0    0           D   172.16.1.1       10GE1/0/1
     172.16.1.1/32  Direct  0    0           D   127.0.0.1       10GE1/0/1
   172.16.1.255/32  Direct  0    0           D   127.0.0.1       10GE1/0/1
     172.16.2.0/24  Direct  0    0           D   172.16.2.1       10GE1/0/2
     172.16.2.1/32  Direct  0    0           D   127.0.0.1       10GE1/0/2
   172.16.2.255/32  Direct  0    0           D   127.0.0.1       10GE1/0/2
     172.17.1.0/24  O_ASE   150  1           D   192.168.60.1    10GE1/0/3
     172.17.2.0/24  O_ASE   150  1           D   192.168.60.1    10GE1/0/3
   192.168.60.0/24  Direct  0    0           D   192.168.60.2    10GE1/0/3
   192.168.60.2/32  Direct  0    0           D   127.0.0.1       10GE1/0/3
 192.168.60.255/32  Direct  0    0           D   127.0.0.1       10GE1/0/3
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
Download
Updated: 2019-10-14

Document ID: EDOC1000039339

Views: 150004

Downloads: 7858

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next