Sie sind auf Seite 1von 8

Basic understanding about BGP

We really want to show you why we need BGP first but it is very difficult to explain without understanding a bit about
BGP. So we will learn some basic knowledge about BGP first.
First we need to understand about the different between Interior Gateway Protocol and Exterior Gateway Protocol. The
difference between them is shown below:

Interior Gateway Protocol (IGP): A routing protocol operating within an Autonomous System (AS) like OSPF,
EIGRP Usually routers running IGP are under the same administration (of a company, corporation, individual)
Exterior Gateway Protocol (EGP): A routing protocol operating between different AS. BGP is the only EGP used
nowadays
In the topology above R1, R2 and R3 should run an IGP to communicate with each other because they are in the same
AS. But to connect with other routers in another AS (like a different ISP), R1 and R3 must use an EGP.
With BGP, the term autonomous system (AS) refers to a network that operates separately from other networks and
usually operates within a single administrative domain. Each AS is represented by an AS number. It is similar to EIGRP
AS in this aspect. BGP is used mainly by the Internet Service Provider (ISP) all over the world. Each ISP usually has
one BGP AS number (some very big ISP may have a few AS numbers). BGP AS numbers can be between 1 to 65,535.
In the topology above R1 and R3 are operating in BGP AS 1. If an AS connects to the public Internet using an EGP,
then it must be assigned a unique AS number which is managed by the Internet Assigned Numbers Authority (IANA).
IANA manages the AS numbers from 1 to 64,512 for public use (similar to public IP addresses) while 64,512 to
65,535 numbers are reserved for private use (similar to private IP addresses).
If we dont want to show the routers inside each AS we can simply ignore them:

In fact, the Internet that we are going online everyday is a collection of interconnected autonomous systems and
BGP is running to provide routing between them.
Other BGP terms that you should learn are listed below:
+ BGP speaker: a router running BGP
+ BGP peer or BGP neighbor: Any two routers that have formed a TCP connection to exchange BGP routing
information (as BGP runs over TCP on port 179, not UDP)
+ Prefix: Maybe you learned the word subnet. In BGP world, it is usually called prefix because BGP usually does
not advertise small subnets. It advertises blocks of large subnets so prefix is often used instead
+ Internal BGP (iBGP): refers to the BGP neighbor relationship within the same AS. The iBGP neighbor does not have
to be directly connected
+ External BGP (eBGP): refers to the BGP neighbor relationship between two peers belongs to different AS. It is
recommended that eBGP should be directly connected. Never run an IGP between eBGP peers.
In the below topology suppose all routers are running BGP then R1 is considered internal BGP to R2 and R3 (as they
are running same AS 1) but is external BGP to R4. R5 is internal to R4 and R6 but external to R3.

Why do we need BGP?


Maybe you will raise a question: Why cant we only use OSPF or EIGRP instead?
The most important reason is BGP greatly supports path control.
Maybe you learned and understood about EIGRP, OSPF routing protocols. They are different but both of them have the
same purpose: find the most optimal path to the destination. But when we are working in ISP level we dont care
much about this. In ISP we really want to control the path, even it is not the most optimal path, to the destination.
For example, how can you choose which path to go from AS 1 to AS 3 in the topology below?

Suppose an IGP (like OSPF) is using all the way. With default values and same bandwidth on all the links, OSPF will
choose the path AS 1 -> AS 2 -> AS 3. In order to manipulate the path we will have to change the bandwidth of some
interfaces on the edge routers of each AS. A few months later we want to change the path then we have to configure
the bandwidth again. With BGP we can easily define the path like this: to go from AS 1 to AS 3 we will go through AS
2 then AS 4 then AS 5. Moreover we can easily control the ratio of traffic passing through each link. BGP can do this
because it has a rich set of features to control the paths to the destination. One of the most popular features BGP
uses to control the path is known as attributes. However, discussion about attributes is out of the scope of this
tutorial, which is dedicated for CCNA learners.
In fact, BGP is a path vector protocol. Path vector protocol does not rely on the bandwidth of the links (like
OSPF) or hop count (like RIP) or a group of parameters (like EIGRP). Path vector protocol relies on the number of
autonomous systems it has to go through. In other words, it choose the path with least number of autonomous
systems (shortest AS Path) to reach the destination, provided that the path is loop-free. Of course we can change
the path easily for our purpose.
For example in the topology above, if all the values are default and same, BGP will choose the path AS 1 -> AS 2 ->
AS 3 for traffic from AS 1 destined to AS 3 because it only has to go through one AS (AS 2).
Another reason to use BGP is BGP can handle very big routing tables. The ISP level of routing do had large
number of routes, which IGP cannot handle. BGP handle such large routes between AS. Currently the global Internet
routing table contains over 500,000 routes.
Another good reason to use BGP is because the great benefits of MPLS-based virtual private networks (MPLS
VPN). MPLS VPN is beyond the scope of this tutorial but in general MPLS VPN provides traffic separation and path
isolation on a shared network infrastructure and BGP is the background layer so that VPN can operate well. For
example your corporation is running Voice over IP (VoIP), Video on Demand (VoD), Internet service on the same
infrastructure then you can use MPLS VPN to separate these services as if they were running on theirs own
infrastructure.

In the next part we will learn about how your edge routers of your company can connect to the ISP.
Type of connection to ISP
BGP is often used to connect to the ISP so we list here all the type of connection to the ISP.
Single homed
Your company may connect to ISP in several ways. The most popular and simple way is single homed with a single
link between the company and the ISP. With this design, only one possible next-hop router exists for all routes to the
Internet.

A big disadvantage of this design is when the link fails or either of the routers fails, the connection to the Internet fails
as well. But of course, this design saves money comparing to multiple connections to the Internet designs and in fact
it is the only reason for small company to accept this design.
With this design we dont need BGP in fact, all things we need are:
+ A default route from the company to the ISP
+ A static route from the ISP to the companys public address range
Dual homed
The next design is called dual homed, in which the dual word refers to the designs with two links to the same
router.

In this design we can use BGP to share the traffic between two routers of the company with our specific ratio (load
balancing) or fail over. Of course this design is better in redundancy than the first one but it still has a single point of
failure at the ISP router.
Single Multihomed
The next design is called single multihomed refers to:
+ Having connections to multiple ISPs from one router at the company
+ Single link per ISP.

This design is good if we want to separate important traffic to a specific ISP while still has the other ISP as the fail
over path.
Dual Multihomed
And the last design is called dual multihomed refers to:
+ Multiple links per ISP
+ Multiple links to Company

If your company has a strong budget then Dual Multihomed design is ideal to make sure your connection to outside is
always up. And BGP is highly recommended in this case.
In conclusion, except Single Homed design, BGP can be used effectively to control the traffic between your
company/corporation to ISPs.
To learn about BGP Configuration please read our Basic BGP Configuration tutorial.

Basic BGP Configuration


August 25th, 2016Go to comments

In this lab we will learn a simple eBGP (two BGP routers with different Autonomous System numbers) configuration
between two routers with the topology below:

First we need to configure some interfaces on two routers as follows:

R1(config)#interface fastethernet0/0
R1(config-if)#ip address 11.0.0.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.0

R2(config)#interface fastethernet0/0
R2(config-if)#ip address 11.0.0.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0

So we have just configured interface fa0/0 and loopback0 on both routers. Next we will configure the BGP
configuration part on R1:

R1(config)#router bgp 1
R1(config-router)#neighbor 11.0.0.2 remote-as 2
The configuration is very simple with only two lines on R1. In the first line, BGP configuration begins with a familiar
type of command: the router bgp command, where AS number is the BGP AS number used by that router (same as
EIGRP, OSPF configuration).
The next command defines the IP address of the neighbor. Unlike OSPF or EIGRP, BGP cannot discover its neighbors
automatically so we have to explicitly declare them. We also have to know and declare the neighbors BGP AS number
as well. In this case R1 wants to establish BGP neighbor relationship with R2 (in BGP AS 2) so it choose an interface
on R2 (Fa0/0: 11.0.0.2) and specify R2 is in BGP AS 2 via the command neighbor 11.0.0.2 remote-as 2. At the
other end R2 will do the same thing for R1 to set up BGP neighbor relationship.

R2(config)#router bgp 2
R2(config-router)#neighbor 11.0.0.1 remote-as 1
After a moment we should see a message (on each router) similar to the following, letting us know that an adjacency
has been formed:
On R1:

*Aug 17 00:09:38.453: %BGP-5-ADJCHANGE: neighbor 11.0.0.2 Up


On R2:

*Aug 17 00:09:38.453: %BGP-5-ADJCHANGE: neighbor 11.0.0.1 Up


So after forming BGP neighbor relationship we can verify by using the show ip bgp summary command on both
routers:

R1#show ip bgp summary


BGP router identifier 1.1.1.1, local AS number 1
BGP table version is 1, main routing table version 1
Neighbor

11.0.0.2

AS MsgRcvd MsgSent

R2#show ip bgp summary

19

19

TblVer
1

InQ OutQ Up/Down


0

0 00:16:21

State/PfxRcd
0

BGP router identifier 2.2.2.2, local AS number 2


BGP table version is 1, main routing table version 1
Neighbor

11.0.0.1

AS MsgRcvd MsgSent
1

20

TblVer

20

InQ OutQ Up/Down

0 00:17:13

State/PfxRcd
0

Please pay attention to the State/PfxRcd column of the output. It indicates the number of prefixes that have been
received from a neighbor. If this value is a number (including 0, which means BGP neighbor does not advertise any
route) then the BGP neighbor relationship is good. If this value is a word (including Idle, Connect, Active,
OpenSent, OpenConfirm) then the BGP neighbor relationship is not good.
In the outputs above we see the BGP neighbor relationship between R1 & R2 is good with zero Prefix Received
(PfxRcd) because they have not advertised any routes yet.
How about the BGP routing table? We can check with the show ip bgp command but currently this table is empty!
This is because although they formed BGP neighbor relationship but they have not exchanged any routes. Lets try
advertising the loopback 0 interface on R1 to R2:

R1(config-router)#network 1.1.1.0 mask 255.255.255.0


As you see, unlike other routing protocols like OSPF or EIGRP, we have to use subnet mask (255.255.255.0 in this
case), not wildcard mask, to advertise the routes in the network command.

Note: With BGP, you must advertise the correct network and subnet mask in the network command ( in
this case network 1.1.1.0/24). BGP is very strict in the routing advertisements. In other words, BGP only
advertises the network which exists exactly in the routing table (in this case network 1.1.1.0/24 exists in the
routing table as the loopback 0 interface). If you put the command network 1.1.0.0 mask 255.255.0.0 or
network 1.0.0.0 mask 255.0.0.0 or network 1.1.1.1 mask 255.255.255.255 then BGP will not advertise
anything.
Now the BGP routing tables on these two routers contain this route:

R1#sh ip bgp
BGP table version is 4, local router ID is 11.0.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network

Next Hop

*> 1.1.1.0/24

0.0.0.0

Metric LocPrf
0

Weight
32768

Path
i

R2#sh ip bgp
BGP table version is 2, local router ID is 11.0.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network

Next Hop

*> 1.1.1.0/24

11.0.0.1

Metric LocPrf
0

Weight
0

Path
1 i

An asterisk (*) in the first column means that the route has a valid next hop. A greater-than sign (>) indicates the
route has been selected as the best path to that network.
The Metric column here is not the usual metric like in OSPF or EIGRP. It is the Multi Exit Discriminator (MED)
attribute of BGP. Weight is another BGP attribute. The default values of both MED and Weight are 0 (as you see at
the outputs above).
The Path column shows the AS paths that prefix were sent to reach us. It would better to read the Path from right
to left to understand which path this prefix travel to reach our router. Letter i is considered the starting point of the
prefix and the next number is the originating AS where this prefix originated. Next numbers are the recorded paths it
traveled. For example if a prefix had to travel from AS 1 -> 2 -> 3 -> 4 -> 5 (our AS) then we will see the path 4 3 2
1 i on our router.
Note: A blank AS path (only letter i is shown) means that the route was originated in the local AS. In the R1 output
above, network 1.1.1.0/24 is originated from R1 so we see the path only has one letter i.
One notice is on R1 the Next Hop is 0.0.0.0 which means this prefix is originated from the local router. On R2 the
Next Hop is pointing toward the interface Fa0/0 of R1 (11.0.0.1) to which R2 will send traffic for the destination
1.1.1.0/24.
Now R1 advertised prefix 1.1.1.0/24 to R2 so we can re-check R2 with the show ip bgp summary command to see
the Prefix received increased to 1:

R2#sh ip bgp summary


BGP router identifier 2.2.2.2, local AS number 2
BGP table version is 2, main routing table version 2
1 network entries using 117 bytes of memory
1 path entries using 52 bytes of memory
2/1 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 441 total bytes of memory
BGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secs
Neighbor

11.0.0.1

AS MsgRcvd MsgSent
1

TblVer

InQ OutQ Up/Down

State/PfxRcd

0 00:01:36

Also in the routing table of R2 we will see this prefix, which is advertised with BGP from R1:

R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set

1.0.0.0/24 is subnetted, 1 subnets


B

1.1.1.0 [20/0] via 11.0.0.1, 00:00:20


2.0.0.0/24 is subnetted, 1 subnets

2.2.2.0 is directly connected, Loopback0


11.0.0.0/24 is subnetted, 1 subnets

11.0.0.0 is directly connected, FastEthernet0/0

This lab only mentioned about the most basic configuration of BGP and introduced two most important commands of
BGP, which are show ip bgp summary and show ip bgp. In practical BGP is often much more complex with many
attributes, routing policies, redistribution, used.

Das könnte Ihnen auch gefallen