The peer IP address is the IP address specified in ipv4-address or ipv6-address in the peer { group-name | ipv4-address | ipv6-address } as-number { as-number-plain | as-number-dot } command. The group-name parameter specified in the command is the one specified in the peer { ipv4-address | ipv6-address } group group-name command.
If the optimal route has not been selected yet before BGP begins to compare peer IP addresses, the local device may have established multiple BGP peer relationships with another device through equal-cost links. In most cases, if a backup physical link is available between two devices, using loopback interfaces to establish a BGP peer relationship is recommended although multiple BGP peer relationships may be established between the two devices through the physical links.
The configurations on Switch A are as follows:
# bgp 65001 peer 10.1.1.2 as-number 65002 peer 10.1.2.2 as-number 65002 # ipv4-family unicast peer 10.1.1.2 enable peer 10.1.2.2 enable #
The configurations on Switch B are as follows:
# bgp 65002 peer 10.1.1.1 as-number 65001 peer 10.1.2.1 as-number 65001 # ipv4-family unicast network 2.2.2.9 255.255.255.255 peer 10.1.1.1 enable peer 10.1.2.1 enable #
Run the display bgp routing-table [ ip-address ] command to check the configurations.
# Display the routing table of Switch A.
[HUAWEIA] display bgp routing-table
BGP Local router ID is 192.168.2.3 Status codes: * - valid, > - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total Number of Routes: 2 Network NextHop MED LocPrf PrefVal Path/Ogn *> 2.2.2.9/32 10.1.1.2 0 0 65002i * 10.1.2.2 0 0 65002i
The preceding command output shows that two routes 2.2.2.9/32 are available in the routing table and that the route with the next hop address 10.1.1.2 is selected as the optimal route.
[HUAWEIA] display bgp routing-table 2.2.2.9
BGP local router ID : 192.168.2.3 Local AS number : 65001 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 2.2.2.9/32: From: 10.1.1.2 (192.168.2.4) Route Duration: 00h19m10s Direct Out-interface: GigabitEthernet1/0/5 Original nexthop: 10.1.1.2 Qos information : 0x0 AS-path 65002, origin igp, MED 0, pref-val 0, valid, external, best, select, active, pre 255 Advertised to such 2 peers: 10.1.1.2 10.1.2.2 BGP routing table entry information of 2.2.2.9/32: From: 10.1.2.2 (192.168.2.4) Route Duration: 00h19m05s Direct Out-interface: GigabitEthernet1/0/10 Original nexthop: 10.1.2.2 Qos information : 0x0 AS-path 65002, origin igp, MED 0, pref-val 0, valid, external, pre 255, not preferred for peer address Not advertised to any peer yet
The preceding command output shows that the route with the next hop address 10.1.1.2 is selected as the optimal route because its peer IP address is smaller than that of the other route.