< Home

Configuring BGP Peers

Two devices can exchange BGP routing information only after a peer relationship is established between them.

Context

Because BGP uses TCP connections, you need to specify IP addresses for peers when configuring BGP. Two BGP peers are not necessarily neighbors of each other. Such BGP peers establish a BGP peer relationship through a logical link. Using loopback interface addresses to set up BGP peer relationships improves the stability of BGP connections, and therefore is recommended.

IBGP peer relationships are established between devices within an AS. EBGP peer relationships are established between devices in different ASs.

Procedure

  • Configure an IBGP peer.
    1. Access the system view.

      system-view

    2. Access the BGP view.

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

    3. Set the IP address and the number of the AS where a BGP peer resides.

      peer ipv4-address as-number { as-number-plain | as-number-dot }

      The number of the AS where the specified peer resides should be the same as the number of the local AS.

      The IP address of the specified peer can be one of the following types:

      • IP address of the interface on the directly connected peer
      • IP address of the loopback interface on the reachable peer
      • IP address of the sub-interface on the directly connected peer

    4. (Optional) Set the source interface and source address for a TCP connection.

      peer ipv4-address connect-interface interface-type interface-number [ ipv4-source-address ]

      By default, BGP uses the physical interface that is directly connected to the peer as the local interface of a TCP connection.

      When loopback interfaces are used to establish a BGP connection, run the peer connect-interface command at both ends of the connection to ensure that the connection is correctly established. If this command is run on only one end, the BGP connection may fail to be established.

    5. (Optional) Configure a description for the peer.

      peer ipv4-address description description-text

      Configuring a description for a peer simplifies network management.

  • Configure an EBGP peer.
    1. Access the system view.

      system-view

    2. Access the BGP view.

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

    3. Set the IP address and the number of the AS where a BGP peer resides.

      peer ipv4-address as-number { as-number-plain | as-number-dot }

      The number of the AS where the specified peer resides should be the same as the number of the local AS.

      The IP address of the specified peer can be one of the following types:

      • IP address of the interface on the directly connected peer
      • IP address of the loopback interface on the reachable peer
      • IP address of the sub-interface on the directly connected peer

    4. (Optional) Set the source interface and source address for a TCP connection.

      peer ipv4-address connect-interface interface-type interface-number [ ipv4-source-address ]

      By default, BGP uses the physical interface that is directly connected to the peer as the local interface of a TCP connection.

      When loopback interfaces are used to establish a BGP connection, run the peer connect-interface command at both ends of the connection to ensure that the connection is correctly established. If this command is run on only one end, the BGP connection may fail to be established.

    5. (Optional) Set the maximum number of hops for an EBGP connection.

      peer ipv4-address ebgp-max-hop [ number ]

      By default, a direct physical link must be available between EBGP peers. If such a link does not exist, run the peer ebgp-max-hop command to allow EBGP peers to establish a TCP connection over multiple hops.

      If hop-count is not specified in the peer ebgp-max-hop command, 255 is used as the maximum number of hops in EBGP connections.

      If loopback interfaces are used to establish an EBGP peer relationship, the peer ebgp-max-hop command (hop-count ≥ 2) must be run. Otherwise, the peer relationship cannot be established.

    6. (Optional) Configure a description for the peer.

      peer ipv4-address description description-text

      Configuring a description for a peer simplifies network management.

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