Basic BGP Configuration Example on Juniper

Juniper-BGP-configuration-example

How to Configure BGP on Juniper

BGP is one of the widely used Routing Protocol. It is also known as Internet Protocol. In this Juniper BGP Configuration Example, 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 Topology

 

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

 


You can test yourself with JNCIA Questions and JNCIP Questions.


 

IP Configurations

The first step of Juniper BGP Configuration 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

 


 

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

 


 

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

 


 

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

 


 

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.

 


 

Assigning Routing Policy

To use a Routing Policy, we need to add it under the Juniper 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.

Lesson tags: BGP, junos, juniper
Back to: JNCIP > BGP

Leave a Reply

Your email address will not be published. Required fields are marked *

JNCIP

Collapse
Expand
Latest Blog Posts