Configure BGP
Learn how to configure the BGP protocol on your MX204, MX301, MX304, MX10004, or MX10008 router.
Configuring BGP on a Juniper MX204, MX301, MX304, MX10004, or MX10008 router involves
defining the local Autonomous System (AS) and Router ID under [edit
routing-options], creating a BGP group with peer details (neighbor IP, peer AS,
type) under [edit protocols bgp], and applying routing policies to control
route advertisement.
For more information on configuring your device as a node in a BGP network, see Configuring BGP Routing Policy.
To configure BGP on a Juniper MX router (Junos OS), perform the following steps:
-
Set the local AS number and a unique router ID (usually a loopback address).
[edit routing-options] set autonomous-system 64511 set router-id 192.168.0.3
Enable logging BGP Events.
[edit protocols bgp] set protocols bgp log-updown
-
Create a group for BGP peers, specifying whether it is
internal(iBGP) orexternal(eBGP). For eBGP, define the peer AS.[edit protocols bgp] set group EBGP-PEER type external set group EBGP-PEER peer-as 64510 set group EBGP-PEER neighbor 10.0.0.14
-
Define policies to filter which routes are accepted (import) or advertised (export).
[edit policy-options] set policy-statement ADV-ROUTES term 1 from protocol direct set policy-statement ADV-ROUTES term 1 then accept set policy-statement ADV-ROUTES term 2 then reject
Attach the policy to the BGP group to start exchanging routes.
[edit protocols bgp group EBGP-PEER] set export ADV-ROUTES
Verify and apply the configuration.
user@host# commit show bgp summary: Verify session establishment. show route protocol bgp: View routes learned via BGP. show bgp neighbor: Check detailed neighbor status.