Online Test Banks
Score higher
See Online Test Banks
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

How to Configure BGP on a Junos Network

That connectivity between your network and the Internet is typically provided via the Border Gateway Protocol (BGP). The configuration required for BGP to work can be broken into two parts:

  • A configuration that specifies who you are: Who you are is really as simple as identifying your AS and specifying the address by which you want to be known. You configure "who you are" by setting your AS under routing options:

    routing options {
      autonomous-system 65001;
  • A lot of protocols include an address for the router in their exchange of information with other routers. Explicitly configuring the address to be used for this type of communication is generally a good idea so that messages between routers are always clear, making it far easier to troubleshoot things down the road. You should always explicitly configure the router ID:

    routing-options {
  • A common best practice is to have the router-id correspond to your loopback interface IP address.

  • A configuration that establishes a session with your neighbors: After configuring your own information, you need to set up the BGP session to your external neighbor.

    Configure a BGP session between router 3 to router 5, and vice versa, by working in the protocols section of the configuration hierarchy, such as shown here:

    [edit protocols]
    bgp {
      group those-guys {
       type external;
       peer-as 65002;

    All you’re doing here is explicitly defining the BGP session that will connect your autonomous system (AS) to your peer autonomous system (AS). The neighbor address specified here is the interface address on the peer you’re connecting to.

    The AS number you configure for this peer must match the AS number that the peer configured for itself. Also note that you configured this neighbor as type external. This configuration means that the neighbor will be connected via the external flavor of BGP called EBGP.


If you have an external BGP, you also have an internal version of BGP (known as IBGP). Whereas EBGP is configured between routers in different ASs, IBGP is configured between all routers within your internal network.

IBGP allows the routers in the AS that are not the EBGP router to reach external routers. For example, with IBGP running, routers 6, 7, and 8 in AS 65002 know which routes are in AS 65027.

The external BGP (EBGP) session that you created established the connection between your AS and the peering AS. It did not, however, connect all your routers via BGP. You must configure IBGP between your routers. Configuring IBGP is very similar to configuring EBGP. To configure router 3:

[edit protocols]
bgp {
group my-guys {
  type internal;

Notice the type of connection being configured here: type internal. Because these are internal neighbors, JUNOS is intelligent enough to know that the AS number is the same as the AS number configured under the routing-options. Also, notice that you configured three neighbors, but the topology shows that you have only two immediate neighbors. Router 2 is accessible only via the other routers.

This is because IBGP has some restrictions. By default, IBGP can’t advertise routes learned via IBGP to other IBGP neighbors (this is a routing loop prevention mechanism).

So router 4 learns routes via EBGP from router 5. These routes have to be propagated to the rest of your network so that router 2 can send traffic to router 7. Router 4 sends those routes to routers 1 and 3 via the IBGP session between them. Because IBGP cannot re-advertise those routes, it can’t share them with router 2.

To get around this “no re-advertise” limitation, IBGP requires a full mesh configuration — that is, every router within your network must be configured as an internal peer to every other router in your network, regardless of whether they’re physically connected via a link. This reason is why you see router 2 configured as a neighbor to router 3 when they’re not physically linked.

BGP is now configured on your router.

blog comments powered by Disqus

Inside Sweepstakes

Win $500. Easy.