< Home

Configuring the MED Attribute

The Multi_Exit Discriminator (MED) attribute equals a metric used in an IGP. The MED attribute is used to determine the optimal route for traffic that enters an AS. The route with the smallest MED value is selected as the optimal route if the other attributes of the routes are the same.

Context

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

Procedure

  • Setting the Default MED of the Local router
    1. Access the system view.

      system-view

    2. Access the BGP view.

      bgp { as-number-plain | as-number-dot }

    3. Access the BGP IPv4 unicast address family view.

      ipv4-family unicast

    4. Set the default MED.

      default med med

      The default med command is valid only for the routes imported through the import-route command and the BGP aggregated routes on the local router.

  • Compare the MEDs of the routes from different ASs.
    1. Access the system view.

      system-view

    2. Access the BGP view.

      bgp { as-number-plain | as-number-dot }

    3. Access the BGP IPv4 unicast address family view.

      ipv4-family unicast

    4. Compare the MEDs of the routes from different ASs.

      compare-different-as-med

      In general, the BGP router compares only the MEDs of the routes from the same AS (different peers). After this command is used, you can allow BGP to compare the MEDs of the routes from different ASs.

  • Configure the processing method when the MED is not set.
    1. Access the system view.

      system-view

    2. Access the BGP view.

      bgp { as-number-plain | as-number-dot }

    3. Access the BGP IPv4 unicast address family view.

      ipv4-family unicast

    4. Set the MED as the maximum value if there is no MED in the route attributes.

      bestroute med-none-as-maximum

      If this command is used, BGP takes the MED as the maximum value if there is no MED in the route attributes during route selection. If this command is not used, the MED is 0.

  • Compare the MEDs of the routes in a confederation.
    1. Access the system view.

      system-view

    2. Access the BGP view.

      bgp { as-number-plain | as-number-dot }

    3. Access the BGP IPv4 unicast address family view.

      ipv4-family unicast

    4. Compare the MEDs of the routes in a confederation.

      bestroute med-confederation

  • Enable Deterministic-MED.
    1. Access the system view.

      system-view

    2. Access the BGP view.

      bgp { as-number-plain | as-number-dot }

    3. Enable Deterministic-MED.

      deterministic-med

      If this command is not configured, when an optimal route is to be selected from among routes that are received from different ASs and which carry the same prefix, the sequence in which routes are received is relevant to the result of route selection. After the command is configured, however, when an optimal route is to be selected from among routes which are received from different ASs and which carry the same prefix, routes are first grouped according to the leftmost AS in the AS_Path. Routes with the same leftmost AS are grouped together, and after comparison, an optimal route is selected for the group. The group optimal route is then compared with optimal routes from other groups to determine the final optimal route. This mode of route selection ensures that the sequence in which routes are received is no longer relevant to the result of route selection.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >