Home > BGP Questions

BGP Questions

March 16th, 2020 in ENCOR 350-401 Go to comments

If you are not suere 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 > (highest) 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
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

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

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.

  1. No trackbacks yet.