Thursday, April 21, 2016

BGP (Porder Gatway Protocol)



BGP basics

The current version of BGP is BGP version 4, based on RFC4271.

1. BGP is the path-vector protocol that provides routing information for autonomous systems on the Internet via its AS-Path attribute.

2. BGP is a Layer 4 protocol that sits on top of TCP. It is much simpler than OSPF, because it doesn’t have to worry about the things TCP will handle.

3. Peers that have been manually configured to exchange routing information will form a TCP connection and begin speaking BGP. There is no discovery in BGP.

4. Medium-sized businesses usually get into BGP for the purpose of true multi-homing for their entire network.

5. An important aspect of BGP is that the AS-Path itself is an anti-loop mechanism. Routers will not import any routes that contain themselves in the AS-Path.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
What is eBGP?

BGP runs between routers in different autonomous systems. By default, in EBGP (peering in two different AS), IP TTL is set to 1, which means peers are assumed to be directly connected.

In this case, when packet crosses one router, TTL becomes 0 and then the packet will be dropped beyond that. In cases where the two neighbors are not directly connected, for example, peering with loopback interfaces or peering when devices are multiple hops away, we
need to add command “neighbor x.x.x.x ebgp-multihop <TTL>”

Otherwise, BGP neighborship will not be established. In addition, EBGP peer will advertise all the best routes it knows or it has learnt from its peers (whether EBGP peer or IBGP peer), which is not, in the case of IBGP.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
What is iBGP?

In IBGP, there is no restriction that neighbors have to be connected directly; however, an IBGP peer will not advertise the prefix it learned from an IBGP peer to another IBGP peer. This restriction is there to avoid loops within the same AS. To clarify this, when a route is
passed to a EBGP peer, the local AS number gets added to the prefix in as-path, so if we receive the same packet back stating our AS in as-path, we know that it is a loop, and that packet gets dropped. However, when a route is advertised to an IBGP peer, the local AS
number is not added to as-path, since the peers are in same AS.

To avoid loops in same AS, there are two methods used.

1. Full Meshed Topology
===============
In this, all the routers in the same AS have to be connected to each other. For example, if we have N routers, then we must have N (N-1)/2 IBGP sessions. We can avoid this by introducing Route Reflectors.

2. Use of Route-Reflectors
================
It is an alternative method to overcome full mesh scenario. In this case, IBGP sessions are established with a central point. This central point is called Route Reflector and the other IBGP routers are called route reflector clients.


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
BGP route reflector

A route reflector is BGP router that is allowed to break the iBGP loop avoidance rule. Route reflectors can advertise updates received from an iBGP peer to another iBGP peer under specific conditions.

By breaking the rules, route reflectors are used to eliminate the full mesh requirement and allow for building iBGP networks that scale easily and cleanly.

Everyone who ever studied BGP knows that BGP has strong rules to prevent routing and updates loops. In this post I will focus on iBGP loop prevention and specifically route reflectors as a result.

The rule states: that any route received from an iBGP neighbor must not be advertised to any other iBGP neighbor.

This loop prevention mechanism induces a requirement that all iBGP routers in the network should be connected in logical full mesh topology to allow for routing information propagation through out the network. However, full mesh connectivity has never been a scalable
solution specially in large networks.

Two mechanisms were introduced to solve the scalability problem, by eliminating the need for the full mesh and in the same time keep the network loop free.

The first solution is BGP confederations and the second one is BGP route reflectors

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
What is the difference between eBGP and iBGP?

1. EBGP is peering between two different AS, whereas IBGP is between same AS (Autonomous System).

2. Routes learned from eBGP peer will be advertised to other peers (BGP or IBGP); however, routes learned from IBGP peer will not be advertised to other IBGP peers.

3. By default, EBGP peers are set with TTL = 1, which means neighbors are assumed to be directly connected, which is not in the case of IBGP. We can change this behavior for EBGP by using command “neighbor x.x.x.x ebgp-multihop <TTL>”. Multihop is the term used in
EBGP only.

4. EBGP routes have administrative distance of 20, whereas IBGP has 200.

5. Next hop remains unchanged when route is advertised to IBGP peer; however, it is changed when it is advertised to EBGP peer by default.

This default behavior of IBGP can be changed by the command “neighbor x.x.x.x next-hop-self”; this changes the next hop, while advertising, as a local route.

++++++++++++++++++++++++++++++++++++++++++++++++++++++

No comments:

Post a Comment