BGP Lecture
BGP Lecture
Use BGP when the effects of BGP are well understood and one of the
following conditions exist:
• The AS allows packets to transit through it to reach another AS (transit
AS).
• The AS has multiple connections to other AS’s.
• The flow of traffic entering or exiting the AS must be manipulated. This
is policy based routing and based on attributes.
Do not use BGP if you have one or more of the following conditions:
• A single connection to the Internet or another AS
• No concern for routing policy or routing selection
• A lack of memory or processing power on your routers to handle
constant BGP updates
• A limited understanding of route filtering and BGP path selection
process
• Low bandwidth between AS’s
Department of Computer and Systems Engineering 5
Who needs BGP?
AS Numbers
• Each AS has an identifying number that is assigned by an Internet
registry or a service provider.
• This number is between 1 and 65,535.
• AS numbers within the range of 64,512 through 65,535 are reserved
for private use.
• This is similar to RFC 1918 IP addresses.
• Because of the finite number of available AS numbers, an organization
must present justification of its need before it will be assigned an AS
number.
Department of Computer and Systems Engineering 8
Overview of autonomous systems
Static Route
• Use an IGP – Both the provider and the customer use an IGP to share
information regarding the customer's networks.
• This provides the benefits associated with dynamic routing.
• BGP is not normally needed in this situation.
• Use an EGP – The third method by which the ISP can learn and
advertise the customer's routes is to use an EGP such as BGP.
• In a single-homed autonomous system the customer's routing
policies are an extension of the policies of the provider.
– For this reason the Internet number registries are unlikely to assign
an AS number.
– Instead, the provider can give the customer an AS number from the
private pool of AS numbers, 64,512 to 65,535.
– The provider will strip off these numbers when advertising the
customer's routes towards the core of the Internet.
Department of Computer and Systems Engineering 12
Multi-homed to a Single Autonomous
Systems
ISP
Edge Router
• Your ISP will show little patience with you if you make mistakes in
your BGP configuration.
• Suppose, for example, that through some misconfiguration you
advertise 207.46.0.0/16 to your ISP.
• On the receiving side, the ISP does not filter out this incorrect route,
allowing it to be advertised to the rest of the Internet.
• This particular CIDR block belongs to Microsoft, and you have just
claimed to have a route to that destination.
• A significant portion of the Internet community could decide that the
best path to Microsoft is through your domain.
• You will receive a flood of unwanted packets across your Internet
connection and, more importantly, you will have black-holed traffic
that should have gone to Microsoft.
• They will be neither amused nor understanding.
3 4
5 6
Sees its own AS
(6, 5, 3, 1) AS7
AS4
AS6
AS2
AS8
172.16.0.0/16
(8,7,4,2,1)
AS9 172.16.0.0/16
(4, 2, 1)
X AS7
172.16.0.0/16
(9,8,7,4,2,1)
AS4
AS6
AS2
• BGP always begins in the Idle state, in which it refuses all incoming
connections.
• It is normally initiated by an administrator or a network event.
• When Start event occurs, the BGP process:
– Initializes all BGP resources
– Starts the ConnectRetry timer
– Initializes a TCP connection the the neighbor
– Listens for a TCP initialization from the neighbor
– Changes its state to Connect
Department of Computer and Systems Engineering 42
Connect State
• In this state, the BGP process is waiting for the TCP connection to be
completed.
• If the connection is successful, the BGP process:
– Clears the ConnectRetry timer
– Completes initialization
– Sends an Open message to the neighbor
– Transitions to the OpenSent state
• If the ConnectRetry timer expires while BGP is in the Active State, the
BGP process:
– Transitions back to the Connect state
– Resets the ConnectRetry timer
• In general, a neighbor state that is switching between "Connect" and
"Active" is an indication that something is wrong and that there are
problems with the TCP connection.
• It could be because of many TCP retransmissions, or the incapability
of a neighbor to reach the IP address of its peer.
Department of Computer and Systems Engineering 46
OpenSent State
errors
No errors
• In this state an Open message has been sent and BGP is waiting to
hear an Open message from its neighbor.
• When an Open message is received, all its fields are checked.
– If errors exist, a Notification message is sent and the state
transitions to Idle.
– If no errors exist, a Keepalive message is sent and the Keepalive
timer is set, the peer is determined to be internal or external, and
state is changed to OpenConfirm.
Department of Computer and Systems Engineering 47
OpenConfirm
State
error
No errors
• In this state, the BGP connection is fully established and the peers
can exchange Update, Keepalive and Notification messages.
• If an Update or Keepalive message is received, the Hold timer is
restarted.
• If a Notification message is received, the state transitions to Idle.
• Since you will use path attributes extensively when configuring routing
policy, you should note that not all vendor implementations of BGP
recognize the same attributes.
• In fact, path attributes come in four different types:
– Well-known mandatory
– Well-known discretionary
– Optional transitive
– Optional non-transitive
Department of Computer and Systems Engineering 51
Path Attributes
Well-known mandatory
• An attribute that has to exist in the BGP UPDATE packet.
• It must be recognized by all BGP implementations.
• If a well-known attribute is missing, a notification error will be
generated; this ensures that all BGP implementations agree on a
standard set of attributes.
Example: AS_PATH attribute.
Well-known discretionary
• An attribute that is recognized by all BGP implementations
• But may or may not be sent in the BGP UPDATE message.
Example: LOCAL_PREF
Optional transitive
• An attribute that may or may not be, recognized by all BGP
implementations (thus, optional).
• Because the attribute is transitive, BGP should accept and
advertise the attribute even if it isn’t recognized.
Example: COMMUNITY
Optional non-transitive
• An attribute that may or may not be, recognized by all BGP
implementations.
• Whether or not the receiving BGP router recognizes the attribute, it is
non-transitive, and should not be passed along to other BGP
peers.
Example: ORIGINATOR_ID
• RTB: Note that the neighbor command’s remote-as value, 100, is different
from the AS number specified by the router bgp command (200).
• Because the two AS numbers are different, BGP will start an EBGP connection
with RTA.
• Communication will occur between autonomous systems.
• Since the remote-as value (200) is the same as RTB’s BGP AS number, BGP
recognizes that this connection will occur within AS 200, so it attempts to establish
an IBGP session.
• In reality, AS 200 is not a remote AS at all; it is the local AS, since both routers live
there. But for simplicity, the keyword remote-as is used when configuring both
EBGP ofand
Department IBGP
Computer sessions.
and Systems Engineering 65
RTB(config-router)#neighbor 172.16.1.2 update-source loopback 0
RTC(config-router)#neighbor 172.16.1.1 update-source loopback 0
• The first two network commands in include the mask keyword, so that only a
particular subnet is specified.
• The third network command results in the OSPF route being advertised by BGP
without redistribution.
• Remember that the BGP network command works differently than the IGP
network command!
EBGP Multihop
EBGP Multihop
EBGP Multihop
I do not speak BGP. But RTW and
RTU can use EBGP multihop to
speak BGP.
AS200 1.1.1.1
AS300
1.1.1.2
• Finally, whenever you are configuring BGP, you will notice that
changes you make to an existing configuration may not appear
immediately.
• To force BGP to clear its table and reset BGP sessions, use the clear
ip bgp command. The easiest way to enter this command is as follows:
Router#clear ip bgp *
Router#clear ip bgp 10.0.0.0
Use this command with CAUTION, better yet, not at all, in a production
network. From the net…
• “clear ip bgp * OOPS! Not me but a colleague who was an employee of a large
ISP with a 3 letter title. Got back from a Cisco routing course and thought they
would try out some commands on the core network. It took 45 minutes for the
coreofto
Department reconverge.
Computer P45 followed”
and Systems Engineering 75
Example
• If the router has not installed the BGP routes you expect, you can use the
show ip bgp command to verify that BGP has learned these routes.
• More later…
RTA#show ip bgp
BGP table version is 3, local router ID is 10.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
• If an expected BGP route does not appear in the BGP table, you can use
the show ip bgp neighbors command to verify that your router has
established a BGP connection with its neighbors.
• Routes learned via IBGP peers are not propagated to other IBGP peers.
– BGP Split Horizon Rule
• If they did, BGP routing inside the AS would present a dangerous
potential for routing loops.
• For IBGP routers to learn about all BGP routes inside the AS, they must
connect to every other IBGP router in a logical full IBGP mesh.
– You can create a logical full mesh even if the routers aren’t directly
connected, as long as the IBGP peers can connect to each other
using TCP/IP.
• If the route is not reachable through the IGP running within the AS,
non-BGP routers will not be able to route traffic passing through the AS
towards this destination.
• It is pointless to advertise destinations to external peers if traffic sent
through this AS is going to be dropped by some non-BGP router within
the AS anyway.
• The BGP synchronization rule states that a BGP router (RTC) should
not advertise to external neighbors (ISP2) destinations (192.213.1.0/24)
learned from inside BGP neighbors (RTA) unless those destinations are
also known via an IGP (RTD and RTB).
• If a router knows about these destinations via an IGP, it assumes that
the route has already been propagated inside the AS, and internal
reachability is guaranteed.
Department of Computer and Systems Engineering 87
AS Synchronization
• If the IBGP router (RTC) does have an IGP route to this destination, the
route is considered synchronized, and the router will announce it to
other BGP peers (ISP2).
• Otherwise, the router will treat the route as not being synchronized with
the IGP and will not advertise it.
• BGP input and output policies are defined, generally, using route maps.
• Route maps are used with BGP to control and modify routing information and
to define the conditions by which routes are redistributed between routing
domains.
• Note that map-tag is a name that identifies the route map; the sequence-
number indicates the position that an instance of the route map is to have in
relation to other instances of the same route map.
• Instances are ordered sequentially, starting with the number 10 by default.