Configuring BGP to Import Routes

BGP can import the routes from other routing protocols. When BGP needs to import routes from a dynamic routing protocol, you need to specify the process ID of the protocol.

Context

BGP itself cannot discover routes. Therefore, it needs to import routes from other protocols, such as IGP or static routes and adds the routes to the BGP routing table so that these imported routes can be transmitted within an AS or between ASs.

BGP can import routes in either Import or Network mode:

  • Import mode: BGP imports routes by protocol type, such asRIP, OSPF, IS-IS, static routes, and direct routes.

  • Network mode: BGP imports a route with the specified prefix and mask. This mode is more precise than the Import mode.

Procedure

  • Import mode
    1. Run system-view

      The system view is displayed.

    2. Run bgp as-number

      The BGP view is displayed.

    3. (Optional) Run ipv4-family unicast

      The BGP-IPv4 unicast address family view is displayed.

    4. Run import-route { isis process-id | ospf process-id | rip process-id | direct | static| unr } [ [ med med ] | [ route-policy route-policy-name ] | [ route-filter route-filter-name ] ] *

      BGP is configured to import routes from another protocol.

      To set an MED value for the imported routes, specify the med parameter. An EBGP peer selects the route with the lowest MED value to guide traffic entering the AS where the peer resides.

      To filter the routes imported from another protocol, specify route-policy route-policy-name or route-filter route-filter-name in the command.

      If non-relay-tunnel is specified, the routes imported by BGP do not recurse to tunnels. In most cases, the routes imported by BGP can recurse to tunnels. However, in some other cases, if the routes imported by BGP recurse to tunnels, a problem will occur. For example, in a seamless MPLS scenario, if the egress protection function is configured on egress MASGs between which a tunnel exists and a route imported by BGP on one of the MASGs recurses to the tunnel, this MASG then recurses the route to another tunnel of a different type. In this case, traffic is directed to the other MASG, which slows down traffic switchover. As a result, the egress protection function does not take effect. To address this problem, specify non-relay-tunnel to prevent the routes imported by BGP from recursing to tunnels.

      When configuring the device to import the routes discovered by a dynamic routing protocol, such as OSPF, RIP, or IS-IS, specify the process ID of the protocol.

    5. (Optional) Run default-route imported

      BGP is configured to import default routes.

      To import default routes, run both the default-route imported command and the import-route command. If only the import-route command is used, no default route can be imported.

    6. Run commit

      The configuration is committed.

  • Network mode
    1. Run system-view

      The system view is displayed.

    2. Run bgp as-number

      The BGP view is displayed.

    3. (Optional) Run ipv4-family unicast

      The BGP-IPv4 unicast address family view is displayed.

    4. Run network ipv4-address [ mask | mask-length ] [ route-policy route-policy-name | route-filter route-filter-name ] [ non-relay-tunnel ]

      BGP is configured to import a local route.

      If the mask or mask length of an IPv4 address is not specified, the IPv4 address is considered as a classful address. The local routes to be imported must be in the local IP routing table.

      By configuring the parameter route-policy route-policy-name, you can use a route-policy to control the routes to be imported.

      By configuring the parameter route-filter route-filter-name, you can use a route-filter to control the routes to be imported.

      If non-relay-tunnel is specified, the routes imported by BGP do not recurse to tunnels. In most cases, the routes imported by BGP can recurse to tunnels. However, in some other cases, if the routes imported by BGP recurse to tunnels, a problem will occur. For example, in a seamless MPLS scenario, if the egress protection function is configured on egress MASGs between which a tunnel exists and a route imported by BGP on one of the MASGs recurses to the tunnel, this MASG then recurses the route to another tunnel of a different type. In this case, traffic is directed to the other MASG, which slows down traffic switchover. As a result, the egress protection function does not take effect. To address this problem, specify non-relay-tunnel to prevent the routes imported by BGP from recursing to tunnels.

      • The destination address and mask specified in the network command must be consistent with the corresponding entries in the local IP routing table. Otherwise, the specified route cannot be imported.

      • When running the undo network command to clear the existing configuration, you need to specify the correct mask.

    5. Run commit

      The configuration is committed.

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