PermitANY
JuniperConfig634 downloads

Juniper JunOS BGP (eBGP / iBGP / RR)

eBGP and iBGP configuration for Juniper JunOS with route reflectors, peer groups, communities, import/export policies, and prefix-list filters.

↓ example.txt

What is it?

Juniper BGP is configured under 'protocols bgp' using peer groups — all neighbors sharing the same policy and type (eBGP/iBGP) belong to the same group. Import and export policies are JunOS route policies defined under 'policy-options policy-statement' — far more expressive than Cisco route-maps. JunOS BGP requires explicit export policy to advertise routes — unlike Cisco IOS where 'network' statements work without a route-map. Juniper is widely deployed as internet exchange (IX) route servers, MPLS PE routers, and ISP edge routers, so its BGP implementation is highly mature.

When to use

  • ·ISP and internet edge routing with full BGP tables
  • ·MPLS L3VPN PE-to-PE signaling with BGP VPNv4/VPNv6 address families
  • ·Internet Exchange peering — Juniper is common at IXPs
  • ·Route reflector deployments for large iBGP topologies

When NOT to use

  • ·Internal routing only — use OSPF or IS-IS for IGP routing inside the network
  • ·Small networks where a static default route is sufficient

How it compares

vs Cisco IOS BGPIOS uses 'route-map' for filtering. Juniper uses 'policy-statement' with 'term' blocks — more readable and powerful (supports multiple match conditions per term). Juniper requires explicit export policy to advertise; IOS uses 'network' statements or 'redistribute'.
vs Palo Alto BGPPalo Alto BGP runs in a virtual router context. Juniper BGP is a full-featured implementation suitable for internet routing and MPLS. Palo Alto is for edge security with basic BGP; Juniper is for full BGP routing platforms.

Prerequisites

  • →AS number must be set: 'set routing-options autonomous-system <ASN>'
  • →Router ID should be set via a loopback address
  • →Import/export policies should be created before enabling BGP neighbors to prevent accidental route leaks
  • →For iBGP: IGP (OSPF or IS-IS) must be running so PE loopbacks are reachable

Config Generator

Verification commands

show bgp summary

Show all BGP peers and their state

ExpectedPeers show 'Establ' state with non-zero 'Prefixes' received. 'Active' or 'Idle' means session not up.

show route protocol bgp

Show BGP routes installed in the routing table

ExpectedLists all active BGP routes with AS path and next-hop

show bgp neighbor <peer-ip> received-routes

Show all routes received from a peer (before import policy)

ExpectedAll routes the peer is advertising. If empty, peer is not sending routes.

Debug commands

show bgp neighbor <peer-ip>

Show detailed BGP session info, error notifications, and policy counts

Common mistakes & fixes

SymptomBGP session stays 'Active' or 'Idle'
CauseTCP 179 not reachable, wrong peer IP, or AS mismatch
FixTest connectivity: 'ping <peer-ip> routing-instance <vrf>'. Check firewall filter on lo0 is not blocking TCP 179. Verify 'peer-as' matches remote router's AS.
SymptomRoutes received but not installed in routing table
CauseImport policy rejecting routes, or next-hop not resolvable
FixCheck 'show bgp neighbor <ip> received-routes' vs 'show route protocol bgp'. If routes are received but not installed, the import policy is filtering them or next-hop is unreachable.
SymptomNo routes being advertised to peer
CauseExport policy missing or not attached, or no matching routes in routing table
FixCheck export policy with 'show policy <name>'. Verify 'show bgp neighbor <ip> advertised-routes' — if empty, either no export policy or no routes match the policy.

Further learning

Recommended books to go deeper on this topic.

BGP Design and Implementation

Randy Zhang & Micah Bartell · Cisco Press · The practical BGP bible — iBGP, eBGP, policies, communities, design patterns

Internet Routing Architectures

Sam Halabi · Cisco Press · BGP for ISPs and large enterprise — AS path, route reflectors, confederation

Related configs