Basic BGP Configuration on Juniper

Juniper-BGP-configuration-example

Basic BGP Configuration on Juniper

BGP is one of the widely used Routing Protocol. It is also known as Internet Protocol. In this lesson we will configure BGP on Juniper Routers.

We will use the below simple topology for our Juniper BGP Configuration Example.

Juniper-BGP-configuration-example

Juniper-BGP-configuration-example

We will see each step of BGP Configuration on Juniper Routers step by step. Let’s start.

Step 1 – IP Configurations

The first step is IP connectivity, we need to be sure that all the interfaces are connected successfully.

Juniper-RouterA1@Kosem> configure
[edit]
Juniper-RouterA1@Kosem# set interfaces et-1/1/1 unit 0 family inet address 172.16.0.1/30
[edit]
Juniper-RouterA1@Kosem# set interfaces et-1/1/2 unit 0 family inet address 10.1.1.1/30
Juniper-RouterA2@Kosem> configure
[edit]
Juniper-RouterA2@Kosem# set interfaces et-1/1/1 unit 0 family inet address 10.1.1.2/30
Juniper-RouterB1@Kosem> configure
[edit]
Juniper-RouterB1@Kosem# set interfaces et-1/1/1 unit 0 family inet address 172.16.0.2/30
[edit]
Juniper-RouterB1@Kosem# set interfaces et-1/1/2 unit 0 family inet address 10.2.2.1/30
Juniper-RouterB2@Kosem> configure
[edit]
Juniper-RouterB2@Kosem# set interfaces et-1/1/1 unit 0 family inet address 10.2.2.2/30

Step 2 – Autonomous System Number Configuration

BGP uses AS (Autonomous System) Numbers. To configure AS Numbers on Juniper routers, we will use the below command.

Juniper-RouterA1@Kosem# set routing-options autonomous-system 100
Juniper-RouterA2@Kosem# set routing-options autonomous-system 100
Juniper-RouterB1@Kosem# set routing-options autonomous-system 200

Juniper-RouterB2@Kosem# set routing-options autonomous-system 200

Step 3 – eBGP Peer Configurations

BGP Peer configuration is required to esatblish peer relationship.There are two type of peers in BGP:

  • eBGP Peers
  • iBGP Peers

Here, we will configure both of them. As you know, eBGP is used between external peers that reside in  another AS. iBGP is used between internal peers that reside in the same AS.

In step 3, we will configure eBGP.

RouterA1

[edit]
Juniper-RouterA1@Kosem# edit protocols bgp
[edit protocols bgp]
Juniper-RouterA1@Kosem# edit group ebgp-peers
[edit protocols bgp group ebgp-peers]
Juniper-RouterA1@Kosem# set neighbor 172.16.0.2 peer-as 200
[edit protocols bgp group ebgp-peers]
Juniper-RouterA1@Kosem# set type external

RouterB1

[edit]
Juniper-RouterB1@Kosem# edit protocols bgp
[edit protocols bgp]
Juniper-RouterB1@Kosem# edit group ebgp-peers
[edit protocols bgp group ebgp-peers]
Juniper-RouterB1@Kosem# set neighbor 172.16.0.1 peer-as 100
[edit protocols bgp group ebgp-peers]
Juniper-RouterB1@Kosem# set type external

Step 4 – iBGP Peer Configurations

iBGP Peers are the peers that is in the same AS in the BGP Domain.

RouterA1

[edit]
Juniper-RouterA1@Kosem# edit protocols bgp
[edit protocols bgp]
Juniper-RouterA1@Kosem# edit group ibgp-peers
[edit protocols bgp group ibgp-peers]
Juniper-RouterA1@Kosem# set neighbor 10.1.1.2
edit protocols bgp group ibgp-peers]
Juniper-RouterA1@Kosem# set type internal

RouterA2

[edit]
Juniper-RouterA2@Kosem# edit protocols bgp
[edit protocols bgp]
Juniper-RouterA2@Kosem# edit group ibgp-peers
[edit protocols bgp group ibgp-peers]
Juniper-RouterA2@Kosem# set neighbor 10.1.1.1
edit protocols bgp group ibgp-peers]
Juniper-RouterA2@Kosem# set type internal

RouterA1

[edit]
Juniper-RouterB1@Kosem# edit protocols bgp
[edit protocols bgp]
Juniper-RouterB1@Kosem# edit group ibgp-peers
[edit protocols bgp group ibgp-peers]
Juniper-RouterB1@Kosem# set neighbor 10.2.2.2
[edit protocols bgp group ibgp-peers]
Juniper-RouterB1@Kosem# set type internal

RouterB2

[edit]
Juniper-RouterB2@Kosem# edit protocols bgp
[edit protocols bgp]
Juniper-RouterB2@Kosem# edit group ibgp-peers
[edit protocols bgp group ibgp-peers]
Juniper-RouterB2@Kosem# set neighbor 10.2.2.1
[edit protocols bgp group ibgp-peers]
Juniper-RouterB2@Kosem# set type internal

Step 5 – Creating Routing Policy

With all routers, you can add a Routing Policy that provide you to manuplate routing. You can add this Routing Policies as Internal and External.

[edit]
Juniper-RouterA1@Kosem# edit policy-options policy-statement OurBGPPolicy
[edit policy-options policy-statement OurBGPPolicy]
Juniper-RouterA1@Kosem# set term 1
[edit policy-options policy-statement OurBGPPolicy term 1]
Juniper-RouterA1@Kosem# set from protocol direct
[edit policy-options policy-statement OurBGPPolicy term 1]
Juniper-RouterA1@Kosem# set then accept

You can create this Routing Policy on all the routers that you want to use.

Step 6 – Assigning Routing Policy

To use a Routing Policy, we need to add it under the BGP configuration. To do this, we will go under the bgp group hieararchy and we will add the Routing Policy under it. This can be  eBGP or iBGP. Here, we will add the iBGP as an example.

[edit protocols bgp group internal-peers]
Juniper-RouterA1@Kosem# set export OurBGPPolicy

You can add this command all the routers that you want to use this routing policy.

Step 7 – Commit the configuration

To use our last configuration, we need to commit our configuration. It is good to use “commit check” and then “commit” commands on al routers.

[edit]
Juniper-RouterA1@Kosem# commit check
configuration check succeeds
[edit]
Juniper-RouterA1@Kosem# commit
Commit completed

 Step 8 – BGP Verification on Juniper

To verify BGP configuration there are various useful commands in Juniper Routers. Some of the common commands used for this purpose are given below:

show bgp summary
show bgp group
show bgp neighbor
show route receive-protocol bgp special-address
show route advertising-protocol bgp special-address
show route protocol bgp

The most used one is “show bgp summary” certainly. You can find the summary information about BGP peers with this command. You will use this command too much if you work in a service provider.

Juniper-RouterA1@Kosem> show bgp summary

Groups: 2 Peers: 4 Down peers: 0

Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending

inet.0                12         12          0          0          0          0

Peer               AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State

172.16.0.2         200        345        325       0       0     1:49:56

10.1.1.2                20        392        392       0       0     3:14:30

There are three important commands that you will use  to learn local routes beside which routes are advertised to a peer and which ones are received from them. These are “show route protocol bgp”,“show route receive-protocol bgp special-address” and “show route advertising-protocol bgp special-address” commands.

 

Juniper-RouterA1@Kosem> show route protocol bgp 10.2.2.1/30

inet.0: 347539 destinations, 347538 routes (347478 active, 0 holddown, 120 hidden)

+ = Active Route, - = Last Active, * = Both

10.2.2.1/30         *[BGP/170] 6d 10:41:16, localpref 100, from 172.16.0.2

AS path: 200 I

> to 172.16.0.2 via et-1/1/1
Juniper-RouterA1@Kosem> show route receive-protocol bgp 172.16.0.2

inet.0: 28 destinations, 33 routes (27 active, 0 holddown, 1 hidden)

Prefix                   Next hop             MED      Lclpref    AS path

10.2.2.1/30         172.16.0.2          0             100        I
Juniper-RouterA1@Kosem> show route advertising-protocol bgp 10.2.2.1

VPN-A.inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)

Prefix             Nexthop                MED    Lclpref AS path

10.2.2.1          172.16.0.2                     1        100    I

Leave a Reply