Home > BGP Questions

BGP Questions

January 31st, 2021 in ENCOR 350-401 Go to comments

If you are not sure about BGP, please read our BGP tutorial.

BGP Quick Summary:

Protocol type: Path Vector
Type: EGP (External Gateway Protocol)
Packet Types: Open, Update, KeepAlive, Notification
Administrative Distance: eBGP: 20; iBGP: 200
Transport: TCP port 179
Neighbor States: Idle -> Active -> Connect -> Open Sent -> Open Confirm -> Established
1 – Idle: the initial state of a BGP connection. In this state, the BGP speaker is waiting for a BGP start event, generally either the establishment of a TCP connection or the re-establishment of a previous connection. Once the connection is established, BGP moves to the next state.
2 – Connect: In this state, BGP is waiting for the TCP connection to be formed. If the TCP connection completes, BGP will move to the OpenSent stage; if the connection cannot complete, BGP goes to Active
3 – Active: In the Active state, the BGP speaker is attempting to initiate a TCP session with the BGP speaker it wants to peer with. If this can be done, the BGP state goes to OpenSent state.
4 – OpenSent: the BGP speaker is waiting to receive an OPEN message from the remote BGP speaker
5 – OpenConfirm: Once the BGP speaker receives the OPEN message and no error is detected, the BGP speaker sends a KEEPALIVE message to the remote BGP speaker
6 – Established: All of the neighbor negotiations are complete. You will see a number, which tells us the number of prefixes the router has received from a neighbor or peer group.
Path Selection Attributes: (highest) Weight > (highest) Local Preference > Originate > (shortest) AS Path > Origin > (lowest) MED > External > IGP Cost > eBGP Peering > (lowest) Router ID
(Originate: prefer routes that it installed into BGP by itself over a route that another router installed in BGP)
Authentication: MD5
BGP Origin codes: i – IGP (injected by “network” statement), e – EGP, ? – Incomplete
AS number range: Private AS range: 64512 – 65535, Globally (unique) AS: 1 – 64511

More information about popular Path Selection Attributes
Weight Attribute:
+ Cisco proprietary
+ First attribute used in Path selection
+ Only used locally in a router (not be exchanged between BGP neighbors)
+ Higher weight is preferred
+ Default value is 0
Weight_BGP_Attribute_Influence.jpg

Local Preference (LocalPrf) Attribute:
+ Sent to all iBGP neighbor (not be exchanged between eBGP neighbors)
+ Used to choose the path to external BGP neighbors
+ Higher value is preferred
+ Default value is 100

LocalPreference_BGP_Influence.jpg

Note: Although Local Preference attribute is only sent to all iBGP neighbor and it is not exchanged between eBGP neighbors but we can apply it to an eBGP neighbor (inbound direction) to affect our local AS choice.

For example in the topology above, we can use Local Preference on R2 (inbound direction) for the R2-R4 eBGP connection to affect routing decision on R1 toward R4.

Unlike Weight attribute, Local Preference attribute is advertised to all iBGP neighbors.

MED Attribute:
+ Optional nontransitive attribute (nontransitive means that we can only advertise MED to routers that are one AS away)
+ Sent through ASes to external BGP neighbors
+ Lower value is preferred (it can be considered the external metric of a route)
+ Default value is 0

MED_BGP_Attribute_Influence.jpg

Question 1

Explanation

The BGP session may report in the following states

1 – Idle: the initial state of a BGP connection. In this state, the BGP speaker is waiting for a BGP start event, generally either the establishment of a TCP connection or the re-establishment of a previous connection. Once the connection is established, BGP moves to the next state.
2 – Connect: In this state, BGP is waiting for the TCP connection to be formed. If the TCP connection completes, BGP will move to the OpenSent stage; if the connection cannot complete, BGP goes to Active
3 – Active: In the Active state, the BGP speaker is attempting to initiate a TCP session with the BGP speaker it wants to peer with. If this can be done, the BGP state goes to OpenSent state.
4 – OpenSent: the BGP speaker is waiting to receive an OPEN message from the remote BGP speaker
5 – OpenConfirm: Once the BGP speaker receives the OPEN message and no error is detected, the BGP speaker sends a KEEPALIVE message to the remote BGP speaker
6 – Established: All of the neighbor negotiations are complete. You will see a number, which tells us the number of prefixes the router has received from a neighbor or peer group.

Question 2

Explanation

With BGP, we must advertise the correct network and subnet mask in the “network” command ( in this case network 10.1.1.0/24 on R1 and network 10.2.2.0/24 on R2). 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, if you put the command “network x.x.0.0 mask 255.255.0.0” or “network x.0.0.0 mask 255.0.0.0” or “network x.x.x.x mask 255.255.255.255” then BGP will not advertise anything.

It is easy to establish eBGP neighborship via the direct link. But let’s see what are required when we want to establish eBGP neighborship via their loopback interfaces. We will need two commands:
+ The command “neighbor 10.1.1.1 ebgp-multihop 2” on R1 and “neighbor 10.2.2.2 ebgp-multihop 2” on R1. This command increases the TTL value to 2 so that BGP updates can reach the BGP neighbor which is two hops away.
+ A route to the neighbor loopback interface. For example: “ip route 10.2.2.0 255.255.255.0 192.168.10.2” on R1 and “ip route 10.1.1.0 255.255.255.0 192.168.10.1” on R2

Question 3

Explanation

The ‘>’ shown in the output above indicates that the path with a next hop of 192.168.101.2 is the current best path.

Path Selection Attributes: Weight > Local Preference > Originate > AS Path > Origin > MED > External > IGP Cost > eBGP Peering > Router ID

BGP prefers the path with highest weight but the weights here are all 0 (which indicate all routes that are not originated by the local router) so we need to check the Local Preference. A path without LOCAL_PREF (LocPrf column) means it has the default value of 100. Therefore we can find the two next best paths with the next hop of 192.168.101.18 and 192.168.101.10.

We have to move to the next path selection attribute: Originate. BGP prefers the path that the local router originated (which is indicated with the “next hop 0.0.0.0”). But none of the two best paths is self-originated.

The AS Path of the next hop 192.168.101.18 (one AS away) is shorter than the AS Path of the next hop 192.168.101.10 (two ASes away) so the next hop 192.168.101.18 will be chosen as the next best path.

Question 4

Explanation

Path Selection Attributes: Weight > Local Preference > Originate > AS Path > Origin > MED > External > IGP Cost > eBGP Peering > Router ID

Question 5

Explanation

Local preference is an indication to the AS about which path has preference to exit the AS in order to reach a certain network. A path with a higher local preference is preferred. The default value for local preference is 100.

Unlike the weight attribute, which is only relevant to the local router, local preference is an attribute that routers exchange in the same AS. The local preference is set with the “bgp default local-preference value” command.

In this case, both R3 & R4 have exit links but R4 has higher local-preference so R4 will be chosen as the preferred exit point from AS 200.

(Reference: http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800c95bb.shtml#localpref)

Question 6

Question 7

Explanation

Unlike EIGRP or OSPF, when a “network” command is declared under BGP, BGP advertises that network without knowing if it has that network or not. Therefore in this question R2 will advertise network 10.0.0.0/24, which is collided with the same network on R1. Therefore we must remove this statement on R2 as it does not have this network. Although answer A is not totally correct (it should be “no network 10.0.0.0 mask 255.255.255.0 instead) but it is the best choice here.

Question 8

Explanation

R3 advertises BGP updates to R1 with multiple AS 200 so R1 believes the path to reach AS 200 via R3 is farther than R2 so R1 will choose R2 to forward traffic to AS 200.

Comments
  1. Syed
    August 6th, 2020

    Hi digital-tut, why in Q3, the answer is A(192.168.101.18). The AS path is 64517 is bigger than 64516 not shorter. Can u plz explain?

  2. digitaltut
    August 6th, 2020

    @Syed: The next hop 192.168.101.18 is only one AS away (64517 i) so it is shorter than the next hop 192.168.101.10, which is two ASes away (64515 64515 i).

  3. syldoni
    August 15th, 2020

    hi, why the Q.2 ans is A, it could have the ans B, whats the reason for choosing A rather B? Thanks

  4. Lostodos
    August 26th, 2020

    I agree with syldoni, i would think it would be both A and B with Q2 as you need both to setup both neighbors correctly?

  5. salam
    September 18th, 2020

    @syldoni and Lostodos, read the question once again.
    the directly connected neighbours are using the 192.168.10.x/24 subnet and need to exchange the 10.x.x.x. networks.

  6. Sapir
    February 21st, 2021

    Q8, shouldn’t the explanation be corrected to: R3 advertises BGP updates to R1 with multiple AS 200 so R1 believes the path to reach AS 200 via R3 is farther than R2, so R1 will choose R2 to forward traffic to AS 200. ?

  7. Sonda de Mexico
    March 4th, 2021

    Q8, shouldn’t the explanation be corrected to: R3 advertises BGP updates to R1 with multiple AS 200 so R1 believes the path to reach AS 200 via R3 is farther than R2, so R1 will choose R2 to forward traffic to AS 200.

    sapir tienes razon man

  8. digitaltut
    March 4th, 2021

    @Sonda de Mexico: Thanks for your detection, we have just updated Q.8.

  9. zaphod
    March 9th, 2021

    Q8: “multiple AS 100” should be “Multiple AS 200”
    Option A answer is correct, but the explanation does not match the option.
    Advertising from AS200 to AS100 to get AS100 to use link2 would require AS200 to be prepended multiple times.

  10. digitaltut
    March 10th, 2021

    @zaphod: Thanks for your detection, we have just updated Q.8 again.

  11. DJ
    March 16th, 2021

    Q8. IBGP peers do not prepend their ASN to the AS_PATH, because the NLRIs would fail the validity check and would not install the prefix into the IP routing table.

  12. Carloncho
    June 6th, 2021

    Hi Digitaltut, did you update Q8?
    thanks

  13. GraFF
    August 16th, 2021

    @digitaltut i need ths dump … price?

  14. DG
    January 27th, 2022

    @digitaltut Q8 explanation is still not updated. it should be “R1 will choose R2 to forward traffic to AS 200”

  15. nasolsi
    February 9th, 2022

    Hi Digitaltut,
    Q5- Please correct me if I’m wrong.
    You mentioned in Q5’s explanation that both R3 & R4 have exit links but R4 has higher local-preference so R4 will be chosen as the preferred exit point from AS 200 but according to Q5 both R3 & R4 have been set with the same local-preference of 200 so for R4 to be chosen as the preferred exit point from AS 200 we have to keep its local-preference of 200 and set R3 with default local-preference value of 100.

  16. Boy Blue
    July 4th, 2022

    In reference to Q5, I don’t understand why local-preference is chosen over weight as the best Path Attribute for R4

  17. Anonymous
    October 10th, 2022

    I m not happy with Q8 answer with explanation.

  18. Miquel Villa
    October 27th, 2022

    Where are you?

  19. aL
    November 28th, 2022

    Q8> Option with the below config should be the correct answer

    R3(config)#route-map PREPEND permit 10
    R3(config-route-map)#set as-path prepend 100 100 100

    R3(config)# router bgp 200
    R3(config-router)#neighbor 10.1.1.1 route-map PREPEND in

    Reason 1: Route-map should apply at inbound direction, since the traffic is coming from AS100.
    “R3(config-router)#neighbor 10.1.1.1 route-map PREPEND in”
    Reason 2: The prepend number “100” does not matter at all since it is just a “cosmetic” in form. What is important is it added multiple times that denotes multiple hops
    ” R3(config-route-map)#set as-path prepend 100 100 100 “

  20. Anonymous2
    February 8th, 2023

    Can you please confirm answer for Q8 ? Is that Inbound or Outbound as per aL explanation , shouldn’t the answer be C ?

  21. Anonymous
    March 17th, 2023

    Pass4 surexams.com exam dumps helped me achieve a score of 92%.

  22. Tinky-Winky
    March 20th, 2023

    Is Q4 really correct? Because local-preference is exchanged just between iBGP peers not eBGP, right?

  23. Calica23
    June 27th, 2023

    The Question 6 is B

  24. Floky
    July 22nd, 2023

    @Calica23

    no, it’s A.
    in B you can’t reach remote neighbor as you dont have loopback route.

  25. Alser
    July 24th, 2023

    do you have any update about Q8, why neighbor 10.1.1.1 route-map PREPEND out, why out, if its incoming trafic?

  26. Jose
    August 5th, 2023

    Hello,

    For Question:

    Refer to the exhibit. Which IP address becomes the next active next hop for 192.168.102.0/24 when 192.168.101.2 fails?
    R1#show ip bgp
    BGP table version is 32, local router ID is 192.168.101.5
    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
    * 192.168.102.0 192.168.101.18 80 0 64517 i
    * 192.168.101.14 80 80 0 64516 i
    * 192.168.101.10 0 64515 64515 i
    *> 192.168.101.2 0 64513 i
    * 192.168.101.6 80 0 64514 64514 i
    A. 192.168.101.18
    B. 192.168.101.6
    C. 192.168.101.10
    D. 192.168.101.14

    Answer: A

    Shouldn’t the right answer be D ?

    thanks

  27. Questions
    October 14th, 2023

    I can’t see the questions.

  28. Anonymous
    January 25th, 2024

    I feel the answer to Q8 is C.
    All traffic entering AS 200 from AS 100 chooses Link 2 as an entry point. Isn’t that inbound direction? Shouldn’t the route map be placed in the inbound direction of R3 eBGP neighbor with R1? So that when R1 tries to route its traffic to R3, its AS path will be long than R1 to R4. so the traffic will go through link 2

  1. No trackbacks yet.