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

NE40E V800R010C10SPC500 Configuration Guide - IP Routing 01

This is NE40E V800R010C10SPC500 Configuration Guide - IP Routing
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).
Example for Configuring the MED Attribute to Control Route Selection

Example for Configuring the MED Attribute to Control Route Selection

By setting the MED attribute, you can flexibly control BGP route selection.

Networking Requirements

The MED attribute equals a metric used in an IGP, and is used to determine the optimal route for traffic that enters an AS. When a BGP device obtains multiple routes to the same destination address but with different next hops from EBGP peers, the route with the smallest MED value is selected as the optimal route.

On the network shown in Figure 10-39, BGP is configured on all routers. Device A is in AS 65008. Device B and Device C are in AS 65009. Device A establishes EBGP connections with Device B and Device C. Device B establishes an IBGP connection with Device C. Traffic sent by Device A to 9.1.1.0 can enter AS 65009 through Device B or Device C. If the attributes excluding the MED values of the routes advertised by Devices B and C to Device A are the same, you can change the MED value of the route to be advertised by Device B or Device C to Device A to determine the device through which traffic will enter AS 65009.

Figure 10-39 Configuring the MED attribute to control route selection
NOTE:

Interfaces 1 through 2 in this example are GE 1/0/0, GE 2/0/0, respectively.



Precautions

None

Configuration Roadmap

The configuration roadmap is as follows:

  1. Establish EBGP connections between Device A and Device B, and between Device A and Device C, and establish an IBGP connection between Device B and Device C.

  2. Apply a routing policy to increase the MED value of the route sent by Device B to Device A so that Device A will send traffic to AS 65009 through Device C.

Data Preparation

To complete the configuration, you need the following data:

  • Router ID 1.1.1.1 and AS number 65008 of Device A
  • Router IDs 2.2.2.2 and 3.3.3.3, and AS number 65009 of Devices B and C
  • New MED value 100 of the route on Device B

Procedure

  1. Configure an IP address for each interface. For configuration details, see Configuration Files in this section.
  2. Configure BGP connections.

    # Configure Device A.

    [~DeviceA] bgp 65008
    [*DeviceA-bgp] router-id 1.1.1.1
    [*DeviceA-bgp] peer 200.1.1.1 as-number 65009
    [*DeviceA-bgp] peer 200.1.2.1 as-number 65009
    [*DeviceA-bgp] commit
    [~DeviceA-bgp] quit

    # Configure Device B.

    [~DeviceB] bgp 65009
    [*DeviceB-bgp] router-id 2.2.2.2
    [*DeviceB-bgp] peer 200.1.1.2 as-number 65008
    [*DeviceB-bgp] peer 9.1.1.2 as-number 65009
    [*DeviceB-bgp] ipv4-family unicast
    [*DeviceB-bgp-af-ipv4] network 9.1.1.0 255.255.255.0
    [*DeviceB-bgp-af-ipv4] commit
    [~DeviceB-bgp-af-ipv4] quit
    [~DeviceB-bgp] quit

    # Configure Device C.

    [~DeviceC] bgp 65009
    [*DeviceC-bgp] router-id 3.3.3.3
    [*DeviceC-bgp] peer 200.1.2.2 as-number 65008
    [*DeviceC-bgp] peer 9.1.1.1 as-number 65009
    [*DeviceC-bgp] ipv4-family unicast
    [*DeviceC-bgp-af-ipv4] network 9.1.1.0 255.255.255.0
    [*DeviceC-bgp-af-ipv4] commit
    [~DeviceC-bgp-af-ipv4] quit
    [~DeviceC-bgp] quit

    # Check the routing table of Device A.

    [~DeviceA] display bgp routing-table 9.1.1.0 24
    
     BGP local router ID : 1.1.1.1
     Local AS number : 65008
     Paths:   2 available, 1 best, 1 select
     BGP routing table entry information of 9.1.1.0/24:
     From: 200.1.1.1 (2.2.2.2)
     Route Duration: 0d00h00m56s
     Direct Out-interface: GigabitEthernet1/0/0
     Original nexthop: 200.1.1.1
     Qos information : 0x0
     AS-path 65009, origin igp, MED 0, pref-val 0, valid, external, best, select, pre 255
     Advertised to such 2 peers:
        200.1.1.1
        200.1.2.1
    
     BGP routing table entry information of 9.1.1.0/24:
     From: 200.1.2.1 (3.3.3.3)
     Route Duration: 0d00h00m06s
     Direct Out-interface: GigabitEthernet2/0/0
     Original nexthop: 200.1.2.1
     Qos information : 0x0
     AS-path 65009, origin igp, MED 0, pref-val 0, valid, external, pre 255, not preferred for router ID
     Not advertised to any peers yet

    The command output shows that there are two valid routes to 9.1.1.0/24. The route with 200.1.1.1 as the next hop is the optimal route because the router ID of Device B is smaller.

  3. Configure the MED attribute.

    # Set the MED value for the route sent by Device B to Device A based on a routing policy.

    [~DeviceB] route-policy 10 permit node 10
    [*DeviceB-route-policy] apply cost 100
    [*DeviceB-route-policy] commit
    [~DeviceB-route-policy] quit
    [~DeviceB] bgp 65009
    [*DeviceB-bgp] peer 200.1.1.2 route-policy 10 export
    [*DeviceB-bgp] commit

    # Check the routing table of Device A.

    [~DeviceA] display bgp routing-table 9.1.1.0 24
    
    BGP local router ID : 1.1.1.1
     Local AS number : 65008
     Paths:   2 available, 1 best, 1 select
     BGP routing table entry information of 9.1.1.0/24:
     From: 200.1.2.1 (3.3.3.3)
     Route Duration: 0d00h07m45s
     Direct Out-interface: GigabitEthernet2/0/0
     Original nexthop: 200.1.2.1
     Qos information : 0x0
     AS-path 65009, origin igp, MED 0, pref-val 0, valid, external, best, select, pre 255
     Advertised to such 2 peers:
        200.1.1.1
        200.1.2.1
    
     BGP routing table entry information of 9.1.1.0/24:
     From: 200.1.1.1 (2.2.2.2)
     Route Duration: 0d00h00m08s
     Direct Out-interface: GigabitEthernet1/0/0
     Original nexthop: 200.1.1.1
     Qos information : 0x0
     AS-path 65009, origin igp, MED 100, pref-val 0, valid, external, pre 255, not preferred for MED
     Not advertised to any peers yet

    The command output shows that the MED value of the next hop 200.1.1.1 (Device B) is 100 and that the MED value of the next hop 200.1.2.1 is 0. Therefore, the route with the smaller MED value is selected.

Configuration Files

  • Device A configuration file

    #
    sysname DeviceA
    #
    interface GigabitEthernet1/0/0
     undo shutdown
     ip address 200.1.1.2 255.255.255.0
    #
    interface GigabitEthernet2/0/0
     undo shutdown
     ip address 200.1.2.2 255.255.255.0
    #
    bgp 65008
     router-id 1.1.1.1
     peer 200.1.1.1 as-number 65009
     peer 200.1.2.1 as-number 65009
     #
     ipv4-family unicast
      peer 200.1.1.1 enable
      peer 200.1.2.1 enable
    #
    return
  • Device B configuration file

    #
    sysname DeviceB
    #
    interface GigabitEthernet1/0/0
     undo shutdown
     ip address 9.1.1.1 255.255.255.0
    #
    interface GigabitEthernet2/0/0
     undo shutdown
     ip address 200.1.1.1 255.255.255.0
    #
    bgp 65009
     router-id 2.2.2.2
     peer 9.1.1.2 as-number 65009
     peer 200.1.1.2 as-number 65008
     #
     ipv4-family unicast
      undo synchronization
      network 9.1.1.0 255.255.255.0
      peer 9.1.1.2 enable
      peer 200.1.1.2 enable
      peer 200.1.1.2 route-policy 10 export
    #
    route-policy 10 permit node 10
     apply cost 100
    #
    return
  • Device C configuration file

    #
    sysname DeviceC
    #
    interface GigabitEthernet1/0/0
     undo shutdown
     ip address 9.1.1.2 255.255.255.0
    #
    interface GigabitEthernet2/0/0
     undo shutdown
     ip address 200.1.2.1 255.255.255.0
    #
    bgp 65009
     router-id 3.3.3.3
     peer 9.1.1.1 as-number 65009
     peer 200.1.2.2 as-number 65008
     #
     ipv4-family unicast
      undo synchronization
      network 9.1.1.0 255.255.255.0
      peer 9.1.1.1 enable
      peer 200.1.2.2 enable
    #
    return
Translation
Download
Updated: 2019-01-03

Document ID: EDOC1100055018

Views: 56386

Downloads: 211

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