Documente Academic
Documente Profesional
Documente Cultură
Border Gateway Protocol is an Exterior Gateway Protocol (EGP) used for routing
between autonomous systems. It enables routing policies and improves security.
The function of BGP is to exchange routing information between autonomous
systems and guarantee the selection of a loop free path.
BGP4 is the first version of BGP that supports CIDR and route aggregation
BGP updates are carried using TCP on port 179
BGP is an advanced path vector protocol and includes the following:
Reliable updates.
Triggered updates only.
Rich metric (Path attributes).
Scalable to massive networks.
Protocol Specifications
eBGP AD 20
iBGP AD 200
Transport TCP/179
Usage applications
1. IDLE – In IDLE state, Router is searching routing table to see whether a route
exists to reach the neighbor.
2. CONNECT - In the CONNECT state, BGP initiates a TCP connection to the remote
neighbor IP address. The BGP Finite State Machine remains in CONNECT until the
TCP three-way handshake completes.
- If the TCP connection is successful, the BGP process sends an Open message to
the neighbor, and transitions to the OpenSent state.
- If the TCP connection is unsuccessful, the BGP process continues to listen for a
connection and transitions to the Active state.
3. ACTIVE: In Active state, BGP initialize a new TCP three-way handshake to the
remote router (peer) because the initial connect failed. Typically, we only see this
state if initial connect failed.
1. OPEN SENT - BGP sends open message to establish BGP peering with neighbor. It
includes BGP version number, the AS number, hold time, and Router.
- Keepalive are sent every 60 seconds. Peers can use MD5 shared secret.
An EBGP neighbor is a router outside this autonomous system; an IGP is not run
between the EBGP neighbors. For two routers to exchange BGP routing updates,
the TCP-reliable transport layer on each side must successfully pass the TCP
three-way handshake before the BGP session can be established. Therefore, the IP
address used in the BGP neighbor command must be reachable without using an
IGP, which can be accomplished by pointing at an address that is reachable
through a directly connected network or by using static routes to that IP address.
Generally, the neighbor address that is used is the address on a directly
connected network and sharing the same medium and a subnet.
Define neighbors:
• A TCP session (three-way handshake) must be established before starting
BGP routing update exchanges.
Reachability:
• EBGP neighbors are usually directly connected.
Different AS number:
• EBGP neighbors must have different AS numbers.
2. IBGP: When BGP that runs between routers within the same autonomous system
is called IBGP. IBGP runs within an autonomous system to exchange BGP
information so that all BGP speakers have the same BGP routing information
about outside autonomous systems.
Routers running IBGP do not have to be directly connected to each other as long
as they can reach each other so that TCP handshaking can be performed to set up
the BGP neighbor relationships. The IBGP neighbor can be reached by a directly
connected network, static routes, or by the internal routing protocol. Because
multiple paths generally exist within an autonomous system to reach the other
IBGP routers, a loopback address is generally used in the BGP neighbor
command to establish the IBGP sessions.
Define neighbors:
• A TCP session (three-way handshake) must be established before starting
BGP routing update exchanges.
Reachability:
• IBGP neighbors must be reachable usually by using an IGP.
• Loopback IP addresses are typically used to identify IBGP neighbors.
Same AS number:
• IBGP neighbors must have the same AS number.
2. Open – Once a TCP connection has been established, BGP sends open message to
establish BGP peering with neighbor. It includes BGP version number, the AS
number, hold time, and Router.
3. Update – Update message is used to transfer routing information between peers
and to advertise or withdraw a prefix. It includes new routes (network-layer
reachability information (NLRI)), withdrawn routes (unreachable Routes) and path
attributes.
Unreachable Routes information a list of routing updates that are no longer
reachable and that need to be removed (if any) from the BGP routing table.
Withdrawn routes have the same format as NLRI.
Path Attributes Information: The AS-path, origin, local preference, and so forth.
Each path attribute includes the attribute type, attribute length, and
attribute value (TLV).
The attribute type consists of the attribute flags, followed by the attribute
type code.
Network layer reachability information (NLRI): A list of networks (IP address
prefixes and their prefix lengths) that can be reached by this path.
4. Keepalive – Keepalive messages are sent between peers every 60 seconds (by
default) to maintain connections. Hold time is three times the KEEPALIVE timer of
60 seconds. If the periodic timer = 0, no keepalives are sent (disable).
1. The BGP router will prefer route with highest weight (local to router)
2. If the multiple routes have same weight, the BGP router will Prefer route with the
highest local preference
3. If multiple routes have the same local preference, the BGP router will prefer the
route that is originated by local router.
4. If none of the routes are originated by the local router, BGP router will prefer the
route with the shortest AS_Path.
5. If AS_Path length is the same, the BGP router will prefer the route with the
lowest origin code. This is when IGP is lower than EGP and EGP is lower than
Incomplete.
6. If the all the origin codes are same, the BGP router will prefer the route with the
lowest MED.
7. If the route have same MED, the BGP router will prefer eBGP over iBGP
8. For iBGP paths, prefer path through closest IGP neighbor
9. For eBGP paths, prefer the oldest route
10. Prefer route with lowest neighbor BGP router ID
11. If BGP router IDs are same, prefer the route with lowest neighbor IP address.
The best routes (valid and reachable) are propagated to BGP neighbors.
The best BGP routes are copied into the IP routing table after the router checks
administrative distance value.
Route reflectors
BGP uses split horizon rule to avoid the loop inside an Autonomous System, Split
horizon rule states that an update sent by one IBGP neighbor should not be send to
another IBGP neighbor. To overcome we have 3 solutions:
Route Reflector allows a router to advertise routes received from one IBGP peer to
another IBGP peers. In Route reflector one router act as Server and all other routers
act as client. Clients will form neighborship only with server. Client send updates to
Server and server advertise that update to all other clients.
Confederations
Peer groups
To configure one router with multiple BGP peer relationships, configurations can be
quite complex. Peer groups simplify the configuration process. You make peer groups
and assign neighbors with the same policies to the group. Peer group members inherit
the policies assigned to the group.
To configure the BGP peer group on Cisco IOS routers, you must complete the
following steps:
Create a BGP peer group; use the neighbor peer-group router configuration
command
Specify parameters for the BGP peer group
Create a BGP neighbor
Assign a neighbor to the peer group; use the neighbor peer-group router
configuration command
To control how many prefixes a BGP router can receive from a nighbor, use the
neighbor maximum-prefix router configuration command.
Route dampening
Flapping routes create problems for BGP. An approach was created to remove the
update about a flapping route until it can be guaranteed that the destination is more
stable. This additional BGP scalability mechanism, called route flap dampening, was
created to reduce route update processing requirement by suppressing unstable
routes.
Using the Network configuration commands. This command lists networks that
are candidates if they appear in the routing table.
Using redistribution from another routing protocol
Route Summarization
Automatic summarization
To manually define a network for advertisement by BGP, use the following router
configuration command in the process level:
Take into consideration that the network command reveals the actual subnet to
advertise, not the interface participating in the routing process like in all other routing
protocols.
If you would like to modify attributes before inserting prefixes into the BGP table, you
can use a route map in the network command in router configuration mode in the
process level:
network network-number [mask network-mask][route-map map-tag]
Route filtering
Route filtering empowers a BGP speaker to choose what routes to exchange with
any of its BGP peers. For example, an AS can identify inbound traffic that it is
willing to accept by filtering its outbound advertisements. Conversely, an AS can
control what routes its outbound traffic uses by specifying the routes to accept
from EBGP neighbors.
Both the inbound and outbound filtering concepts can be applied between peers
and between routing protocols running on a single router. At the peer level,
inbound filtering indicates that the BGP speaker is filtering routing updates coming
from other peers. The outbound filtering limits the routing updates advertised from
this BGP speaker towards other peers.
Inbound filtering limits the updates being redistributed from other protocols into
BGP. Outbound filtering limits the updates being redistributed from BGP into an
IGP.
Route maps are very powerful filtering tools, they can be used to accomplish the
following tasks:
Origin
Next hop
Weight
Community
Local preference
MED
You can apply a route map on incoming or outgoing routing information for a
neighbor. The routing information must be permitted by the route map to be accepted.
If the route map has no statement explicitly permitting a route, the route is implicitly
denied and dropped. The syntax required is as follows:
The show ip bgp route-map command displays selected routes from a BGP routing
table based on the contents of a route map.
When you have completed the changes to filters and route maps that are applied on
the outgoing information, execute
clear ip bgp ip-address soft out
Route refresh is another new feature in the Cisco implementation of BGP. Routers use
the route refresh feature to ask a neighbor to resend all the routing information when
needed. Use the clear ip bgp * command to send a route refresh message to all
neighbors or clear ip bgp ip-address to send a route refresh message to a specific
neighbor.
Using weight
You can use weight to provide local routing policy, and you can use local preference to
establish autonomous system-wide routing policy.
This approach assigns a weight value to all route updates from the neighbor. Higher
weights are preferred.
You can also configure the router so that all incoming routes that match an
autonomous system filter receive the configured weight. Use the following router
configuration command to do so:
You can also set weight with a route map in more complex scenarios.
The default weight value is 32,768 for locally originating networks (including those via
redistributing) and is 0 for all other networks.
Local preference can be used to influence route selection within the local autonomous
system; in fact, this attribute is stripped from outgoing updates via eBGP. You should
decide between the use of weight or local preference. The default local preference for
iBGP and local routes is 100; all other are 0 by default.
You can configure manual manipulation of the autonomous system path attribute
(prepending) using a route map with the set as-path prepend set clause.
You can apply the MED attribute on outgoing updates to a neighboring autonomous
system to influence the route selection process in that autonomous system. The MED
attribute is useful only when you have multiple entry points into an autonomous
system.
The default value of the MED attribute is 0. A lower value of MED is more preferred. A
router prefers a path with the smallest MED value but only if weight, local preference,
autonomous system path, and origin code are equal.