Home > Basic BGP Configuration

Basic BGP Configuration

August 25th, 2016 Go 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:

BGP_Config.jpg

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 neighbor’s 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        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
11.0.0.2        4     2      19      19        1    0    0 00:16:21        0
R2#show ip bgp summary
BGP router identifier 2.2.2.2, local AS number 2
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
11.0.0.1        4     1      20      20        1    0    0 00:17:13        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. Let’s 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            Metric LocPrf  Weight   Path
*> 1.1.1.0/24       0.0.0.0                  0          32768   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            Metric LocPrf  Weight   Path
*> 1.1.1.0/24       11.0.0.1                 0              0   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        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
11.0.0.1        4     1       5       4        2    0    0 00:01:36        1

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
C       2.2.2.0 is directly connected, Loopback0
     11.0.0.0/24 is subnetted, 1 subnets
C       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.

Comments (47) Comments
  1. zerox
    August 27th, 2016

    that is great , we need more

  2. Anonymous
    August 29th, 2016

    That’s is amazing !!

  3. krish
    August 30th, 2016

    thank you

  4. jdrizze
    August 31st, 2016

    OMG please provide more I’m studying for my CCNP and I want to master BGP

  5. Anonymous
    September 1st, 2016

    Hi, does anyone knows for the new version how much bgp knowledge will be in the real test?

  6. jojo
    September 6th, 2016

    well explained we definitely need more well done

  7. HM125
    September 16th, 2016

    Why we use loopback IP for router ? Please explain.

  8. Faheb
    September 21st, 2016

    Loopback is used to add a Logical network in the Routers. @HM125
    If you check the diagram, there is no LAN network.

  9. MeeM
    September 28th, 2016

    is this supported on packet tracer? if yes , on which version?

  10. Eddiebics
    October 6th, 2016

    @MeeM most of the Bgp comands are supported by packet tracer v6.2

  11. HND
    October 12th, 2016

    In real time scenario, do we use loopback interfaces…???
    Please anyone explain..

  12. any
    November 9th, 2016

    thanks

  13. gk singh
    December 14th, 2016

    please configure BGP by taking more than 3 or 4 router.

  14. KMT
    January 5th, 2017

    great . . thanks for sharing . . and appreciate it .

  15. Vincent
    January 19th, 2017

    Thanks

  16. Tu
    January 28th, 2017

    Great, very helpful tutorial!

  17. stephen
    February 2nd, 2017

    tang ina kau

  18. Shankar
    February 11th, 2017

    Thanks a lot..It is very helpful.

  19. anon
    February 14th, 2017

    @HND: in this case, loopback is used to assume that there is network under each router to be routed back and forth.
    In real case, it must be many networks under each router as the writer explained above.

  20. NAdeem
    February 23rd, 2017

    Really very Informative .

  21. Anonymous
    February 26th, 2017

    thank’s you

  22. Tiffany
    March 10th, 2017

    The new version of Packet Tracer (101) has BGP commands support.
    Note: this version only support EBGP not IBGP AS, and only the basic commands from BGP.

  23. Sreekanth
    March 11th, 2017

    Nice

  24. umair
    March 21st, 2017

    Excellent

  25. slim shady
    March 29th, 2017

    tang ina ka rin hahah

  26. Anonymous
    April 9th, 2017

    Excellent

  27. Kobi
    April 14th, 2017

    you are so good
    l need more

  28. gm
    June 1st, 2017

    Thanks, very useful article

  29. sson89
    August 20th, 2017

    cool

  30. Don Vergas
    September 1st, 2017

    Hey 9Tut, I think one of the questions has the wrong answer on the 3 BGP question but I’m not sure…

    interface fa0/0
    ip address 172.16.1.33 255.255.255.224
    router bgp XXX
    neighbor 10.1.5.2 remote as 65001

    You need to advertise the network of int fa0/0. Which of the following would you type int he “network command”?

    172.16.1.32 255.255.255.224
    172.16.1.32 mask 255.255.255.224
    172.16.1.33 mask 255.255.255.224 (I chose this since is the one one the red text)
    172.16.1.32 mask 255.255.255.224

    I always choose the xxx.33 because it’s the network I see on the ip address but it looks like I get a wrong answer. Can you please explain if I’m missing something or if it’s just a type or mistake on the question?

    Sincerely…

    – Don Vergas

  31. 9tut
    September 1st, 2017

    @Don Vergas: For BGP, you must use the exact subnet of this interface, in this case 172.16.1.32 mask 255.255.255.224. For EIGRP, RIP, OSPF… you can use xxx.33.

  32. Kirwa
    September 4th, 2017

    Greatfull am studying CCNA….

  33. Kirwa
    September 4th, 2017

    How can i book CCNA exams?

  34. BJ
    September 27th, 2017
  35. Anonymous
    September 30th, 2017

    Well explained

  36. Anonymous
    October 4th, 2017

    how we advertise this network 1.1.1.0
    i mean on which interface

  37. sohel
    October 12th, 2017

    awesome understanding.

  38. Irving
    December 5th, 2017

    But one questions, whats the importance of using BGP?
    Is better o similar that EIGRP or OSPF?

  39. D Mohapatra
    December 25th, 2017

    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
    C 2.2.2.0 is directly connected, Loopback0
    11.0.0.0/24 is subnetted, 1 subnets
    C 11.0.0.0 is directly connected, FastEthernet0/0

    B 1.1.1.0 [20/0] via 11.0.0.1, 00:00:20 ****why 20/0 ?

  40. stiven
    December 26th, 2017

    correct answer plzzz

    01.If Computer A is sending traffic to computer B, which option is the source ip address when
    a packet leaves R1 on interface F0/1?

    A. IP address of the R2 interface F0/1
    B. Ip address of computer B
    C. Ip address of R1 interface F0/1
    D. Ip address of Computer A

    02.Which command must you enter to enable OSPFV2 in an IPV4 network?

    A. ip ospf hello-interval seconds
    B. router ospfv2 process-id
    C. router ospf value
    D. router ospf process-id

    03.Which NTP command configures the local devices as an NTP reference clock source?

    A. NTP Peer
    B. NTP Broadcast
    C. NTP Master
    D. NTP Server

    04.Which statement about DHCP snooping is true?

    A. it blocks traffic from DHCP servers on untrusted interfaces.
    B. it can be configured on switches and routers.
    C. it allows packets from untrusted ports if their source MAC address is found in the binding table.
    D. it uses DHCPDiscover packets to identify DHCP servers

    05.When troubleshooting Ethernet connectivity issues,how can you verify that an IP address is known to a
    router?
    A. Check whether the IP address is in the routing table
    B. Check whether an ACL is blocking the IP address
    C. Check whether the IP address is in the CAM table
    D. Check whether the IP address is in the ARP table

    06.Which command can you enter to configure an IPV6 floating static route?

    A. Router(config)# ipv6 route FE80:0202::/32 serail 0/1 201
    B. Router(config)# ipv6 route::/0 serail0/1
    C. Router(config)# ipv6 route static resolve default
    D. Router(config)# ipv6 route FE80:0202::/32 serail 0/1 1

    plzzzz correct answer….????

  41. subhan hermawan
    December 29th, 2017

    good explanation, thank you

  42. Satindi
    January 7th, 2018

    @Stiven,
    Here are the correct answers:
    01:D
    02:D
    03:C
    04:A
    05:D
    06:A

  43. stiven
    January 9th, 2018

    @ satindi thnx bro

  44. nuwan rox
    January 15th, 2018

    @satindi

    correct answer plzzz????

    01.If you configure syslog messages without specifying the logging trap level, which log
    messages will the router send?

    A. error conditions only
    B. warning and error conditions only
    C. normal but significant conditions only
    D. all levels except debugging
    E. informational messages only

    02.Which function does the IP SLAs ICMP Echo operation perform to assist with
    troubleshooting?

    A. hop-by-hop response time
    B. packet-loss detection
    C. congestion detection
    D. one way jitter measurements

    03.Which part of the PPPoE server configuration contains the information used to assign an IP
    address to a PPPoE client?

    A. virtual-template interface
    B. DHCP
    C. dialer interface
    D. AAA authentication

    04.What is the two benefits of DHCP snooping? (Choose two.)
    A. prevent static reservation
    B. prevent reservation
    C. prevent DHCP rogue server
    D. track users hosts on the network.

    05.Which RFC was created to alleviate the depletion of IPv4 public addresses?

    A. RFC 4193
    B. RFC 1519
    C. RFC 1518
    D. RFC 1918

    06.Which statement about native VLAN traffic is true?

    A. Cisco Discovery Protocol traffic travels on the native VLAN by default
    B. Traffic on the native VLAN is tagged with 1 by default
    C. Control plane traffic is blocked on the native VLAN.
    D. The native VLAN is typically disabled for security reasons

    07.Where information about untrusted hosts are stored?

    A. CAM table
    B. Trunk table
    C. MAC table
    D. binding database

  45. shruti
    January 18th, 2018

    can someone tell BGP configuration is in CCNA also? Or in CCNP?
    As i m preparing for CCNA do i need to do BGP configuration thoroughly too?

  46. sj
    January 25th, 2018

    @shruti you dont need to chilax…concept of BGP is very important and someday or other you have to learn about ebgp and ibgp its concepts in detail if you want to become an network engineer but for CCNA only the basic concept is required and you wont be getting any labs …

Add a Comment