MadNetworks Technical Blog

Networking Stuff




Basic EBGP with JUNOS

EBGP

EBGP is used when routing needs to be done between two different BGP AS.  When using Cisco IOS, the basic configuration of BGP is done from the router bgp AS_Number command and then through some neighbor/network statements.

In JUNOS the configuration is quite different.

Configuration

This very basic example shows how to configure an EBGP session between two JUNOS.

image

Once the basic configuration has been done (interface can join each other, root authentication is set). The BGP configuration can begin

AS configuration

First we must define in which AS the Juniper router is located. If you are familiar with Cisco, you know you need to specify it when configuring the BGP protocol.

With JUNOS it is not the case, the AS is a routing-options defined globally outside of the BGP statements with the command set routing-options.

routing-options {

    autonomous-system 100;

}

Group and Neighbor configuration

As you are familiar with Cisco, you are now looking for some set protocol bgp neighbor command which would allow you to configure the EBGP neighbor. In JUNOS you are forced to configure a peer-group to access this neighbor command. In the example we will simply call it EBGP.

Once the group is created you need to specify the type of the neighbor you want to configure with the type internal or type external command. The group you just created can only be one type at a time. From here you can proceed in different ways :

  • You can specify the neighbor address, the peer-as of the neighbor and its routing policies and proceed on a neighbor by neighbor basis
  • Or you can specify the peer-as globally for the group as well as the routing-policies

With the neighbor by neighbor style the configuration would be like this :

ADMIN@JUNOS1# show

group EBGP {

    type external;

    neighbor 10.0.0.2 {

        peer-as 200;

    }

}

 

And with the peer-group specified globally :

ADMIN@JUNOS1# show

type external;

peer-as 200;

neighbor 10.0.0.2;

The way you choose how you proceed depends on how you want to organize your groups.

When you have the configuration on the two peers, you can check the status of your EBGP peering :

ADMIN@JUNOS1# run show bgp summary

Groups: 1 Peers: 1 Down peers: 0

Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending

inet.0                 0          0          0          0          0          0

Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped…

10.0.0.2                200          3          3       0       1           4 0/0/0/0              0/0/0/0

The state definition are the same than within the IOS meaning that your peer should not be in Active.

Advertise the route

Now you want to send the network of your Loopback to your peer. You look for some network command like you have in the IOS but you don’t find it… So next you look for some redistribute command and you do not find it either.

In JUNOS, all the network/redistribute stuff should be configured using routing-policies. Routing-policies are very similar to IOS route-maps, the big difference is you need to do everything through them in JUNOS whereas you would really need them in IOS for filtering or route manipulation in IOS.

One you have configured the routing policy which will send your loopback network, you will need to assign it to the neighbor through the neighbor statement or globally depending on how you prefer. The export command will be used for this.

policy-options {

    policy-statement LO1 {

        term T1 {

            from interface lo0.1;

            then accept;

        }

    }

}

 

protocols {

    bgp {

        group EBGP {

            type external;

            export LO1;

            peer-as 200;

            neighbor 10.0.0.2;

        }

    }

Here the Loopback interface is specified but you could also specify directly the network.

At the end you can check the routing table of the peer to view now the loopback network :

root@JUNOS2# run show route

 

inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)

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

 

1.1.1.0/24         *[BGP/170] 00:00:03, localpref 100

                      AS path: 100 I

                    > to 10.0.0.1 via em0.0

10.0.0.0/24        *[Direct/0] 01:09:14

                    > via em0.0

10.0.0.2/32        *[Local/0] 01:09:14

                      Local via em0.0

 

Leave a Reply

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