3.2.c Configure and verify eBGP between directly connected neighbors
ENCOR 350-401 v1.2 · 3.0 Infrastructure
BGP is the routing protocol of the Internet: it exchanges prefixes between autonomous systems (AS), choosing routes by attributes and policy rather than by a simple metric. eBGP is BGP between routers in different ASes. For ENCOR you configure it between directly connected neighbors and explain how the best path is picked.
What you must know
- Configure an eBGP neighbor and advertise a prefix with
network, and say why the prefix must already be in the routing table. - Name the neighbor states and explain what each one tells you when a session does not come up.
- Walk through the best-path steps in order, and say which attributes you would change to influence outbound traffic.
- Explain why eBGP neighbors normally need to be directly connected.
Neighbor relationships
BGP runs over TCP port 179, so two routers must reach each other by IP first. Neighbors are configured by hand (they are not discovered). eBGP packets are sent with a TTL of 1 by default, which is why eBGP neighbors are normally directly connected; ebgp-multihop relaxes that.
router bgp 65001
bgp router-id 1.1.1.1
neighbor 192.0.2.2 remote-as 65002
network 203.0.113.0 mask 255.255.255.0| State | What it means |
|---|---|
| Idle | Not trying yet, or backing off after a failure. |
| Connect / Active | Trying to open the TCP connection. Staying here usually means no IP reachability, a wrong neighbor address, or a filter blocking port 179. |
| OpenSent / OpenConfirm | TCP is up and the routers are exchanging OPEN messages. A mismatch (wrong remote AS, bad authentication) shows here. |
| Established | Neighbors are exchanging prefixes. |
Best path selection
When a router hears several routes to the same prefix it picks one, using these steps in order (Cisco IOS XE). Stop at the first one that decides:
- Highest weight (Cisco-specific, local to this router).
- Highest local preference (default 100; shared across the whole AS).
- Prefer routes the router originated itself.
- Shortest AS path.
- Lowest origin code (IGP, then EGP, then incomplete).
- Lowest MED (by default compared only between routes from the same neighboring AS).
- Prefer eBGP over iBGP.
- Lowest IGP metric to the next hop.
- Final tie-breakers: oldest eBGP route, then lowest router ID.
To influence outbound traffic, raise local preference (or weight) on the route you prefer. To influence inbound traffic from outside, the usual tools are AS-path prepending and MED.
route-map PREFER-B permit 10
set local-preference 200
!
router bgp 65000
neighbor 192.0.2.5 route-map PREFER-B inLoop prevention and administrative distance
A router rejects any route whose AS path already contains its own AS number, which prevents loops between ASes. eBGP routes have an administrative distance of 20, iBGP routes 200.
Commands
show ip bgp summary | Each neighbor, its AS, uptime and state (a number means prefixes received and the session is Established). |
show ip bgp | The BGP table, with the best path marked >. |
show ip bgp 198.51.100.0 | Every path to one prefix and which one was chosen. |
show ip route bgp | BGP routes that made it into the routing table. |
clear ip bgp * soft | Re-apply policy without tearing the sessions down. |
Exam traps
- Neighbors stuck in Active are not "active" in the good sense. Check reachability and the neighbor address first.
- Weight is checked before local preference, but it is never sent to a neighbor; it only affects this router.
- MED is only compared between paths from the same neighboring AS unless
bgp always-compare-medis set. - A
networkstatement with the wrong mask advertises nothing, because it must match a route exactly. - Local preference only travels inside an AS, so it steers outbound traffic. It does nothing for inbound traffic.
Check yourself
- Your eBGP session to a directly connected neighbor stays in Active. List two things to check.
- IP reachability to the neighbor address, that the
neighboraddress andremote-asare right on both sides, and that nothing filters TCP 179. - Two paths to a prefix have weight 0, local preference 100, same origin and the same AS-path length. One is eBGP and one is iBGP. Which wins?
- The eBGP path, at the step where eBGP is preferred over iBGP. That comes before any IGP metric or router-ID tie-break.
- How would you make all traffic to the Internet leave through ISP-B while keeping ISP-A as a backup?
- Set a higher local preference (for example 200) on routes learned from ISP-B, using an inbound route map, so best-path selection prefers them. If ISP-B fails, ISP-A's routes remain.
Labs
Try it live: eBGP peering and best-path selection
More topics in 3.0 Infrastructure
- 3.1.a Troubleshoot 802.1Q trunks, whether configured statically or negotiated
- 3.1.b Troubleshoot static and dynamic EtherChannels
- 3.1.c Configure and verify RSTP and MST, plus protections such as root guard and BPDU guard
- 3.2.a Compare EIGRP and OSPF: algorithm, load balancing, path selection, metrics, areas
- 3.3.a Interpret NTP and PTP configurations
- 3.3.b Configure NAT and PAT
- 3.3.c Configure first-hop redundancy with HSRP and VRRP
- 3.3.d Describe multicast: RPF check, PIM-SM, IGMPv2/v3, SSM, bidir, MSDP