Technical Documentation

Configure BGP Neighbor Connections


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.


To configure BGP neighbor connections, follow these steps:

  1. In configuration mode, go to the following hierarchy level:
    [edit]user@host# edit protocols bgp
  2. Configure the group and peer’s IP address:
    [edit protocols bgp]user@host# set group group-name type type neighbor neighbor-address

    Note: For external neighbors, use the following form of the command that includes the peer’s AS number:

    user@host# set group group-name neighbor neighbor-address peer-as peer-as-number
  3. Configure the local address:
    [edit protocols bgp]user@host# set group group-name local-address local-address
  4. Verify and commit the configuration:
    user@host# show
    user@host# commit

Sample Output

user@R1> edit
Entering configuration mode

user@R1# edit protocols bgp

[edit protocols bgp]
user@R1# set group internal type internal neighbor

[edit protocols bgp]
users@R1# set group internal local-address
[edit protocols bgp]
user@R1# show 
group internal  {
    type internal;

[edit protocols bgp]
user@R1# commit 
commit complete


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.

Published: 2010-01-25