BGP
Peering and next hops
eBGP peers across ASes and normally needs multihop (plus local-address) when the peers are not directly connected, because the default TTL is 1. iBGP peers inside one AS must reach each other's next hops through the IGP, and iBGP does not rewrite the next hop by default, so next-hop-self on edge routers and route reflectors is essential. Because iBGP split horizon blocks re-advertising iBGP-learned routes to other iBGP peers, you need either a full mesh or route reflection with a cluster-id.
Attributes and selection order
Junos compares, in order: higher local preference (default 100), shorter AS path, lower origin (IGP better than EGP better than incomplete), lower MED, eBGP over iBGP, lower IGP metric to the next hop, lowest router ID, shortest cluster list, lowest peer address. Local preference never leaves the AS; MED is a hint to neighbouring ASes and is not propagated past the next AS by default. Junos has no Cisco-style weight attribute.
Traps
- Sessions stuck in Active indicate a transport problem (TCP 179, reachability, TTL), not policy.
- Default keepalive 30 and hold time 90; mismatched authentication keys drop the session.
advertise-inactiveis needed when a policy must export a route Junos did not select as best.multipath multiple-asfor load sharing across different ASes.
Worked example
Two paths to 203.0.113.0/24: path A has local preference 150 and a longer AS path, path B has local preference 100 and a shorter AS path. Path A wins - local preference is checked before AS path length in Junos.