BGP · Topic 3 of 4
IBGP, EBGP, Groups and Peers
Configure and verify Junos BGP groups and peers for the JNCIS-SP JN0-364: IBGP full mesh, loopback peering, EBGP next hops, split horizon and show bgp.
- 6 min
- Includes a diagram
- EBGP: different ASs, TTL 1 by default, next hop set to self, AS prepended.
- IBGP: same AS, next hop unchanged, local preference carried, no readvertising to other IBGP peers.
- Full mesh of IBGP sessions is required by default.
What it is
EBGP (external BGP) runs between routers in different ASs. IBGP (internal BGP) runs between routers in the same AS and carries externally learned routes across it. Both use the same messages, but they follow different rules for next hops, loop prevention and readvertising.
In Junos OS, peers are configured inside groups. A group holds shared settings such as the type, peer AS and policies, and each neighbor inherits them unless it overrides them.
How it works
IBGP compared with EBGP
| EBGP | IBGP | |
|---|---|---|
| Peers in | Different ASs | The same AS |
| Usual peering address | Directly connected interface | Loopback (lo0) |
| Default TTL | 1 (peer must be directly connected) | Not limited to one hop |
| Next hop when advertising | Set to the advertising router's own address | Left unchanged by default |
| AS path when advertising | Own AS prepended | Not changed |
| Loop prevention | Reject routes containing own AS | Do not readvertise IBGP routes to IBGP peers |
| Local preference | Not sent | Sent |
| Junos route preference | 170 | 170 |
IBGP split horizon and the full mesh
A route learned from an IBGP peer is not advertised to other IBGP peers, because the AS path does not change inside an AS and could not detect a loop. So every IBGP router must peer directly with every other IBGP router: a full mesh of n(n-1)/2 sessions. Route reflectors or confederations remove that requirement, but the default rule is the full mesh.
Peering between loopbacks
IBGP sessions normally run between loopback addresses, so a single link failure does not drop the session while another path exists. Two things make this work:
- The IGP (OSPF or IS-IS) must carry the loopback addresses.
local-addressmust be set to the router's own loopback, so the TCP session is sourced from the address the peer expects.
user@PE1# set routing-options router-id 10.255.0.1
user@PE1# set routing-options autonomous-system 65000
user@PE1# set protocols bgp group IBGP type internal
user@PE1# set protocols bgp group IBGP local-address 10.255.0.1
user@PE1# set protocols bgp group IBGP neighbor 10.255.0.2
user@PE1# set protocols bgp group IBGP neighbor 10.255.0.3
user@PE1# set protocols bgp group EXT-ISP type external
user@PE1# set protocols bgp group EXT-ISP peer-as 64500
user@PE1# set protocols bgp group EXT-ISP neighbor 192.0.2.1
An internal group takes its AS from routing-options autonomous-system. An external group needs a peer-as, either per group or per neighbor.
The IBGP next-hop problem
When PE1 learns a route from the ISP, the next hop is the ISP's interface address, 192.0.2.1. PE1 passes that route to PE2 over IBGP with the next hop unchanged. If PE2 has no route to 192.0.2.1, the next hop is unresolvable and PE2 hides the route.
The two fixes are to carry the external link in the IGP (often as a passive interface) or, more commonly, to apply an export policy on PE1 with then next-hop self toward its IBGP peers. The policy is shown on the next page.
A route that appears in show route receive-protocol bgp but not in show route protocol bgp is often hidden. Check show route hidden extensive for "Unusable" next hops.
Monitoring and troubleshooting
| Command | What it shows |
|---|---|
show bgp summary | Every peer, its state or route counts (active, received, accepted, damped) |
show bgp neighbor 10.255.0.2 | Session detail: options, hold time, last error, local and peer addresses |
show route receive-protocol bgp 192.0.2.1 | Routes received from a peer, before import policy |
show route advertising-protocol bgp 10.255.0.2 | Routes being sent to a peer, after export policy |
show route protocol bgp | BGP routes in the routing table |
show route hidden | Routes rejected by policy or with an unresolvable next hop |
A good order for a session that will not come up: confirm the peer address and AS; ping the peer address sourced from your local address; check that the IGP carries both loopbacks; check local-address; check firewall filters for TCP 179; check authentication keys on both sides. For EBGP between loopbacks, multihop is also needed.
user@PE1> ping 10.255.0.2 source 10.255.0.1
user@PE1> clear bgp neighbor 10.255.0.2
clear bgp neighbor resets the session. Adding soft resends routes after a policy change without tearing down the session.
Common mistakes
Forgetting local-address on IBGP loopback peering. The router sources TCP from the outgoing interface address, the peer does not recognize it, and the session never establishes.
Expecting IBGP routes to pass through a middle router. Without a full mesh or route reflection, PE3 never hears routes that PE2 learned over IBGP from PE1.
Ignoring hidden routes. Routes with an external next hop that the IGP does not know are received but unusable.
An external group or neighbor with no peer-as fails to commit. Every EBGP peer needs its AS number configured on your side.
What to remember for the exam
- EBGP: different ASs, TTL 1 by default, next hop set to self, AS prepended.
- IBGP: same AS, next hop unchanged, local preference carried, no readvertising to other IBGP peers.
- Full mesh of IBGP sessions is required by default.
- Loopback peering needs the IGP to carry loopbacks and
local-address. type internalusesrouting-options autonomous-system;type externalneedspeer-as.receive-protocolshows before import;advertising-protocolshows after export.- Unresolvable next hops make routes hidden; fix with
next-hop selfor IGP reachability.
Check yourself
PE2 receives a route over IBGP whose next hop is the ISP's link address, and PE2's IGP does not know that subnet. What happens?
The route is hidden because its next hop is unresolvable; it is not used or readvertised.
Why must IBGP routers be fully meshed by default?
A router does not readvertise routes learned from one IBGP peer to another IBGP peer, so each router must hear the route directly from the router that learned it.
Which statement makes the router source its IBGP session from lo0?
local-addresswith the loopback address, set in the group or for the neighbor.
Topic 3 of 4 in BGP
Test yourself on BGP
The full Juniper JNCIS-SP JN0-364 question bank has 860 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.