Set Up BGP on Routers in Your Network
Before BGP can function in your MPLS network, you must define the autonomous system (AS) number on the routers in your network, and configure at least one group that includes at least one peer.
Optionally, you can configure a routing policy. The routing policy allows you to control the information shared with BGP neighbors and provides the opportunity to filter and modify the information you receive.

The BGP configuration in the MPLS network in Figure 1 consists of the following:
A full-mesh IBGP topology, using AS 65432.
All IBGP sessions peer between loopback addresses because significant stability advantages are gained.
All routers are configured with one group, group internal.
A send-statics policy on routers R1 and R6 allows a new route to be advertised into the network.
The example network uses IS-IS Level 2 and a policy to create routes that are reachable through the LSP. However, IS-IS Level 1 or an OSPF area can be used and the policy omitted if the network has existing BGP traffic.
You can set up BGP throughout the rest of the network by repeating Step 1, Define the Local Autonomous System through Step 3, Configure a Simple Routing Policy as appropriate on other routers until all routers are set up with BGP.
To set up BGP on routers in your network, follow these steps:
Define the Local Autonomous System
Purpose
Before BGP can function, you need to define a local AS number on the routers in your network. In the example network in BGP Network Topology, all routers are in AS 65432.
Action
To define an AS number on routers in your network, follow these steps:
In configuration mode, go to the following hierarchy level:
content_copy zoom_out_map[edit]user@host# edit routing-optionsConfigure all interfaces to a specific AS:
content_copy zoom_out_map[edit routing-options]user@host# set autonomous-system as-numberVerify the configuration:
content_copy zoom_out_mapuser@host# showcontent_copy zoom_out_mapuser@host# commit
Sample Output
user@R1> edit Entering configuration mode [edit] user@R1# edit routing-options [edit routing-options] user@R1# set autonomous-system 65432 [edit routing-options] user@R1# show [...Output truncated...] autonomous-system 65432; [edit routing-options] user@R6# commit commit complete
Meaning
The output shows that router R1 resides in AS 65432. All other routers in the example network shown in BGP Network Topology also reside in AS 65432.
Configure BGP Neighbor Connections
Purpose
You must configure at least one group that includes at least one peer for BGP to run in your network. First determine which neighbors are internal or external to your local AS boundary. Internal neighbors are inside your local AS boundary. In the example network shown in BGP Network Topology, all the routers are in one AS and are therefore internal. In this example, all IBGP sessions peer between loopback addresses because significant stability advantages are gained. For more information about configuring BGP neighbor connections, see the Junos Routing Protocols Configuration Guide.
Action
To configure BGP neighbor connections, follow these steps:
In configuration mode, go to the following hierarchy level:
content_copy zoom_out_map[edit]user@host# edit protocols bgpConfigure the group and peer’s IP address:
content_copy zoom_out_map[edit protocols bgp]user@host# set group group-name type type neighbor neighbor-addressNoteFor external neighbors, use the following form of the command that includes the peer’s AS number:
content_copy zoom_out_mapuser@host# set group group-name neighbor neighbor-address peer-as peer-as-numberConfigure the local address:
content_copy zoom_out_map[edit protocols bgp]user@host# set group group-name local-address local-addressVerify and commit the configuration:
content_copy zoom_out_mapuser@host# showcontent_copy zoom_out_mapuser@host# commit
Sample Output
user@R1> edit Entering configuration mode [edit] user@R1# edit protocols bgp [edit protocols bgp] user@R1# set group internal type internal neighbor 10.0.0.2 [edit protocols bgp] users@R1# set group internal local-address 10.0.0.1 [edit protocols bgp] user@R1# show group internal { type internal; local-address 10.0.0.1; neighbor 10.0.0.2; neighbor 10.0.0.3; neighbor 10.0.0.5; neighbor 10.0.0.4; neighbor 10.0.0.6; } [edit protocols bgp] user@R1# commit commit complete
Meaning
The sample output shows that router R1 is in an internal group with five BGP neighbors. The local-address statement is included in this example configuration because IBGP is used. It is considered best practice to configure a local address when you use an IBGP. BGP messages are sourced from the loopback address because the local-address statement is included in the configuration. Generally, you would not configure a local address when external BGP is configured.
Configure a Simple Routing Policy
Purpose
Routing policy allows you to control the information shared with BGP neighbors and provides the opportunity to filter and modify the information you receive. Typically, a network is injected into BGP using a policy. This may also be done through a static route. In the network in BGP Network Topology, a static route export policy is used to inject routes into BGP.
Action
To configure a simple routing policy, follow these steps:
In configuration mode, go to the following hierarchy level:
content_copy zoom_out_map[edit]user@host# edit routing-optionsConfigure a static route for redistribution to other autonomous systems:
content_copy zoom_out_map[edit routing-options]user@host# set static route destination/24 rejectConfigure a routing policy that matches and accepts the configured static routes into BGP updates:
content_copy zoom_out_map[edit]user@host# edit policy-options[edit policy-options]user@host# set policy-statement policy-name term term-name from route-filter address exactuser@host# set policy-statement policy-nameterm term-name then acceptApply the policy created in Step 3 to all BGP neighbors:
content_copy zoom_out_map[edit]user@host# edit protocols bgp[edit protocols bgp]user@host# set export policy-nameVerify and commit the configuration:
content_copy zoom_out_mapuser@host# showcontent_copy zoom_out_mapuser@host# commit
Sample Output
user@R1> edit Entering configuration mode [edit] user@R1# edit routing-options [edit routing-options] user@R1# set static route 100.100.1.0/24 reject [edit routing-options] user@R1# show [...Output truncated...] route 100.100.1.0/24 reject; } router-id 10.0.0.1; autonomous-system 65432; [edit routing-options] user@R1# top [edit] user@R1# edit policy-options [edit policy-options] user@R1# set policy-statement send-statics term statics from route-filter 100.100.1.0/24 exact [edit policy-options] user@R1# set policy-statement send-statics term statics then accept [edit policy-options] user@R1# top [edit] user@R1# edit protocols bgp [edit protocols bgp] user@R1# set export send-statics [edit protocols bgp] user@R1# show export send-statics; group internal { type internal; local-address 10.0.0.1; neighbor 10.0.0.2; neighbor 10.0.0.3; neighbor 10.0.0.5; neighbor 10.0.0.4; neighbor 10.0.0.6; } [edit protocols bgp] user@R1# commit commit complete
Meaning
The sample output shows that routing policy send-statics is configured on the router. The routing policy matches and accepts the configured static routes into the routing table and injects the routes into BGP updates. Typically, a routing policy is applied at the group level, although it can be applied at the global level, as shown in this example.
Verify That BGP Sessions Are Up
Purpose
After configuring BGP, you must verify that BGP peers are established and the sessions are up.
Action
To verify BGP peers and sessions, enter the following Junos OS CLI operational mode command:
Sample Output
user@R1> show bgp summary Groups: 1 Peers: 5 Down peers: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 1 1 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Damped... 10.0.0.2 65432 1369 1373 0 0 11:25:11 0/0/0 0/0/0 10.0.0.3 65432 1369 1372 0 0 11:24:55 0/0/0 0/0/0 10.0.0.4 65432 1369 1372 0 0 11:25:03 0/0/0 0/0/0 10.0.0.5 65432 1369 1372 0 0 11:25:07 0/0/0 0/0/0 10.0.0.6 65432 1343 1344 0 1 11:10:55 1/1/0 0/0/0 user@R3> show bgp summary Groups: 1 Peers: 4 Down peers: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 2 2 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Damped... 10.0.0.1 65432 1375 1375 0 6 11:26:57 1/1/0 0/0/0 10.0.0.2 65432 43016 43016 0 0 2w0d22h 0/0/0 0/0/0 10.0.0.4 65432 74460 74461 0 0 3w4d20h 0/0/0 0/0/0 10.0.0.6 65432 1347 1347 0 6 11:13:10 1/1/0 0/0/0 user@R6> show bgp summary Groups: 1 Peers: 5 Down peers: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 1 1 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Damped... 10.0.0.1 65432 1348 1350 0 0 11:13:46 1/1/0 0/0/0 10.0.0.2 65432 1347 1351 0 0 11:14:02 0/0/0 0/0/0 10.0.0.3 65432 1347 1350 0 0 11:13:58 0/0/0 0/0/0 10.0.0.4 65432 1347 1350 0 0 11:13:54 0/0/0 0/0/0 10.0.0.5 65432 1347 1350 0 0 11:13:50 0/0/0 0/0/0
Meaning
The sample output from the ingress, transit, and egress routers shows that all routers in the network shown in BGP Network Topology have BGP peers established and sessions up.