Talking about BGP principle

BGP

Mind Map
· Concepts and Terminology
· BGP Features
· Establishment of BGP Neighbor Relationships and BGP Message Types
· BGP Table
· BGP Basic Deployment
· BGP Attributes
· BGP Path Selection
· BGP Advanced Attributes (Community, etc.)

1. The basic concept
of
BGP 1. The problem solved by BGP BGP is created to solve the interaction of messages between different routing domains, and its role is to provide a routing system between routing domains to ensure the exchange of loops between various autonomous systems Routing information

2. The concept of an
autonomous system The routers in the autonomous system use the same routing protocol, the autonomous system number is a 16-bit numeric range (1 ~ 65535), and the private autonomous system number 64512 ~ 65535

3. Relationship between BGP and IGP
ISP and his customers usually use an IGP to route messages within their network. The customer and another customer under the same ISP, the customer and the Internet, and the ISP and ISP will use BGP for routing exchange

2. BGP features
1.
BGP route advertisement selection BGP only advertises the route (optimum) used by it to the peer device of the neighboring AS (autonomous system). notice. Those marked with> will not necessarily be added to the routing table (administrative distance), but will be forwarded

2. BGP path selection
will be described in detail below

3.
BGP and TCP BGP uses TCP as his transmission protocol. TCP provides connection-oriented reliable transmission for BGP. All communication in all BGP tasks is reliable, and there is no control error and error retransmission mechanism. BGP uses port 179, and the data is stored in TCP segments, and then the data is encapsulated into IP packets

3. BGP neighbor relationship
1. Overview of neighbor establishment process
(1) Establish TCP connection
(2) BGP starts to send OPEN message
(3) After exchange of a pair of BGP OPEN messages, the neighbor will enter the established state, that is, two active BGP The stable state between the peers, at this time you can exchange BGP messages

2. Characteristics of
BGP neighbors (1) BGP uses port TCP179
(2) Set the keep-alive interval and hold time
(3) When BGP neighbors are ibgp neighbors in the same AS
When BGP neighbors are eBGP neighbors in different ASs
(4) BGP uses the Route-ID to identify the peer identity, and the election RID is similar to OSPF.
(5) Neighbors need to be specified manually.
(6) BGP neighbor authentication only supports MD5 authentication

3. BGP message types
· Initial (OPEN)
· Alive (Keepalive)
· Update (Update)
· Notification (Notification)

(1) Initial message and survival message After
establishing a TCP connection, the first message sent is the initial message. The BGP router that received the initial message sends a survival message to confirm the initial message. After confirming the initial message, the TCP connection is officially established
The main content included in the initial message
· local AS number
· hold time: how long did not receive the next survival message or update message BGP session will be disconnected

(2) Update messages are
used to cancel routing and advertise routes (network prefixes and attributes).
Insert picture description here
Each update message only contains information about one routing path. When multiple pieces of routing information have the same strategy, an update packet includes several pieces of path information.
Unfeasible Routes Legth: identifies the length of Withdrawn Routes.
Withdraw Routers: contains the list of routes to be revoked.
Total Path Attribute Length: indicates the length of the Path Attributes part and the Network Layer Reachability Information part. When the value is zero, it means that there is no route and its route attributes to be announced.
Path Attributes: Contains the list of routing attributes to be updated
Network Layer Reachability Information (NLRI): Contains the list of address prefixes to be updated

(3) Notification message
BGP router detects an error, sends a notification message, and disconnects immediately after sending the notification message

4. BGP neighbor status
· Idle
· Connect
· Active
· Active Send · Open Sent
· Initial Confirm (Open Conform)
· Establish (Established)

(1) The Idle
router is looking at the routing table
(2) The Connect
router finds the route to the neighbor and establishes a TCP three-way handshake
(3) Initial send (OPEN Sent) The
router will send the initial message and the status will be It becomes the initial sending
(4) The active
router is in the sending state. If it does not receive a reply (survival message) from the neighbor within 5S, it will become the active state
(5) The initial confirmation (Open Conform) The
router has received the message from the other party. Confirmation message
(6) Established (Established)
BGP neighbor relationship is established between the routers, which can send and receive updates and notification information

4. BGP table
1. Concept and function
BGP topology table (topology table), also known as BGP RIB (Routing Information Database), is responsible for maintaining the NRRI (Network Layer Reachability Message) received by BGP. BGP does not announce routes, but announces PA (path attribute) and a group of NRLIs sharing the same PA value

2. Relationship between the BGP table and the IP table
The relevant IGP content in the IP table can be entered into the BGP table through redistribution or network. BGP then announces this information to other routers. The best feasible route in the BGP table will be injected into the local BGP table

3. The way of routing entries in the IP table into the BGP table
· Redistribution into BGP
· Advertise the network under BGP When
configuring no-auto-summary, the IP route must be completely consistent with the routing table. When
configuring auto-summary, it is not necessary to be completely consistent. Subnet The
automatic summary is turned off by default
Insert picture description here

5. BGP deployment
1. Requirements for BGP neighbor establishment
· Same AS number (ibgp neighbor), different AS number
· Designated neighbor
· Reachability

2. TCP and fully interconnected
BGP routers will only send messages to BGP neighbors. By default, all BGP routers in the system have established neighbor relationships in pairs.

3. Basic BGP configuration
(1) Enter BGP routing mode in global configuration mode
(2) Establish or close neighbor relationship in routing mode
Optional configuration
(3) Use a loopback interface to establish neighbor relationship
(4) Change TTL to ensure EBGP The problem of neighbor multi-hop (default TTL = 1, if it is not directly connected, the default BGP message cannot be reached)
(5) Ibgp neighbor forces itself as the next hop (the default router sends the routing information to the IGBP neighbor, the next path The hop address is the address of the EBGP neighbor. Sometimes the route in the system cannot reach the EBGP neighbor, so the entry cannot be added to the routing table.)

6. BGP attributes
1. Attribute classification
· recognized and optional
· mandatory and self-determined
· transitive and non-transitive

Recognized attributes
Recognized attributes: Recognized attributes are attributes that all routers must be able to recognize. These attributes can be passed to BGP neighbors.
Recognized mandatory attributes: must appear in all BGP updates.
Recognized freely determined attributes: may not appear in BGP updates.

Optional attributes
Optional attributes: Non-recognized attributes are called optional attributes. BGP routers that implement optional attributes can propagate this attribute to other BGP neighbors based on the nature of the attribute. Optional attributes can be either transitive or non-transitive
optional transitive attributes: BGP routers that do not implement this attribute (ie BGP that does not support this attribute) should pass this attribute intact to other BGP routers.
Optional non-passing: BGP routers that do not implement this attribute should delete this attribute and cannot transmit it to other BGP routers

2. Types of attributes
(1) It is recognized that the
AS path must
be followed. If it is an internal autonomous system, the autonomous system number is not displayed in the PATH. If it is external, the autonomous system number is added to the PATH every time an autonomous system passes.

Next hop

Origin
i:
Does the router learn from the IGP routing table through the network ? : Redistributed BGP
e: Route imported by EGP

(2) The recognized self-determination
local priority
tells the router (to the same network) which path is the best path to leave the autonomous system. The higher the priority, the greater the possibility of being selected ------ only Send to IBGP peer

(3) Optional delivery
aggregation station
group

(4) The optional non-transmitting
MED (multi-exit discriminator)
in the BGP table is Metric, which is sent between EBGPs. The smaller the value, the better
. By comparing the MED worth, to choose which path to enter the autonomous system

7. BGP path selection
BGP controls the path selection based on a series of attributes and principles.
Principle 1: Optimal
weight (Weight, Cisco private, local router is valid) the highest route, initial weight 32768
Principle 2:
Optimal router has the highest priority Route. Generally, the default priority of all routes is 100, which affects how data leaves the local system.
Principle 3:
View the network in the AS, and prefer the network advertised by the autonomous system.
Principle 4: Choose the path that crosses the least AS, which is the most common result.
Principle 5 :
Check the way to enter BGP, and prefer the route with the smallest source code. IGP <EGP <incomplete
Principle 6: If you have the same source code, choose the route with the smallest MED.
Principle 7: If multiple route entries have the same MED value, the external route (EBGP) and the internal route (IBGP) will be selected first, which will not waste the bandwidth resources of the own system, which is the second most common result.
Principle 8:
If only the internal path is left, find the nearest IGP neighbor (the shortest path to BGP), look at the network protocol in the autonomous system

------------ With this as the boundary, the bottom is the load balancing entry.
Principle 9: For the EBGP neighbor relationship, the election is older, and the earlier route entry is established as the best route. Relatively stable
Principle 10:
If the time is equal, choose the smallest BGP router ID.
Principle 11:
If the router IDs of the BGP routers are also the same (two lines are connected to the same EBGP), choose the one with the smallest neighbor IP address

There are the following rules for adding multiple BGP routes to the IP routing table.
If the best route for a particular NLRI is elected from the first step to the eighth step in the election process, then BGP will only put this route into the route Table, because this route is the best route
. If the best route for a particular NLRI is determined after step 8, then BGP will consider many to put multiple BGP routes into the IP routing table.
Even if BGP will have multiple routes Routes are placed in the routing table, BGP will still only select one path for each NLRI as the best route, and the best route is the best route that BGP advertises to neighbors

8. Advanced attributes related to BGP
peers
· Peer Group · Community
· Route Reflector
· Confederation The
first two tools are used for multiple peers The
last two tools are mainly used to simplify the management of IBGP between a large number of peers

1. Peer group
solves the problem : it is used to simplify the configuration
idea when multiple BGP peers adopt the same strategy : add a group of routers executing the same strategy to the same peer group, and do not BGP neighbors perform routing strategies, and only need to operate on peer groups.
Configuration example:
Insert picture description here
configuration process
(1). Create EBGP / IBGP peer group
neighbor peer-group
(2). Specify EBGP peer group Neighbor
remote-as of which autonomous system
(3). Add neighbor to
neighbor peer-group
(4). Normal peer group operation, just like peer operation, IP address change Fame

2. The BGP community
solves the problem : implements operations on a group of routes.
Implementation method : using a routing map to set a group of routes with community attributes.
A peer group implements a routing policy for a group of routers, and a community implements a group of routes. Strategy , after the router sets the Community attribute to a value that identifies itself, you can add the route to the community, and you can set multiple Community attributes for a route. When the routes containing the Community attribute are aggregated, the aggregated route will inherit the Community attribute of all aggregated routes

To match the route carrying Community, the method is to use Community List, and there are two types of digital list and named list, each two statements are separated by 10, incremented by 10, a group of digital list supports up to 100 statements, while named list Not subject to this limitation, but not all IOS supports named lists. After using the Community List to match the specified route entry, you can use the route-map to call the Community List to set the corresponding parameters and policies for the specified route, and finally apply the route-map

Community List is used to identify matching route entries, and Route map operates on the route entries matched by Community List

Community attribute value
• If the received route carries this value, the route cannot be announced to EBGP peers (if the BGP confederation is configured, the route cannot be announced outside the confederation)
• No-Advertise if received
If the received route carries this value, the route cannot be announced at all. No matter whether it is an EBGP peer or an IBGP peer, if the received route carries this value, it will not be able to announce the route to the EBGP peer body

Configuration example
Insert picture description here
Configuration process:
Set a group of routes to a certain community attribute
1. Configure a routing map, in the routing table mode, to achieve the corresponding conditions and actions in the
routing map mode
match ip address "access-value"
set community local-AS
2 . Hang the route mapping table on a neighbor. In the
routing mode,
neighbor 192.168.212.1 route-map 1111
3. Turn on sending the community tag
neighbor 192.168.212.1 send-community to a neighbor

Put a group of routes into a community
Put a group of routes into a community
1. Configure the route mapping table, in the routing table mode, to realize the mapping of
routing items and community values ​​in the route mapping mode
match ip address "access-value"
set community NN: AA
2. Hang the route mapping table on a neighbor in
routing mode
neighbor 192.168.212.1 route-map 1111
3. Enable sending community tag
neighbor 192.168.212.1 send-community to a neighbor
4. Neighbor end pair Match community attributes and perform secondary operations
Define community table
ip community-list permit NN in global configuration mode: AA
route-map for matching and action mapping
match community
set ---------- Operation

3. Route reflector
solves the problem : solves the problem that the IBGP peers within the autonomous system must be fully interconnected.
Solution : configure a router as an RR (Route Reflector, route reflector), customers no longer need to communicate with each IGBP router To establish a peer relationship, you only need to establish a peer relationship with the RR. The router reflector and its customers are collectively called the
working principle of the cluster : the route reflector learns the routes of all customers. Unlike other IBGP routers, RR can reflect these routers to Other customers and other non-customer peers, that is, RR can reflect routes from IBGP peers to other customers . (By default, BGP routers will not forward routes from IBGP to IBGP neighbors.) To prevent the appearance of loops, the route reflector must not change the route attributes received from customers

The customer router in the route reflection cluster can establish an EBGP peer relationship with an external router of the autonomous system, but can only establish an IBGP peer relationship with the RR in the cluster or other customer routers. Route reflector can establish EBGP or IBGP peer relationship with routers outside the cluster.
Insert picture description here
RR advertises routing rules (non-non-non-transit)
. If the route is learned from a non-customer IBGP peer, it will only be announced to the customer router
. If the route Learning from a customer, it can be reflected to all customers and non-customer routers
. If the route is learned from an EBGP peer, it is reflected to all customers and non-customer routers
. If the customers are fully connected, RR will not route a customer. Reflected to other customers. Only reflect customer routes to non-client peers, and reflect non-customer peer routes to clients

RR shortcomings: easy to cause single point of failure, you can set up redundancy

The router itself can also be a client of other routers, that is, a nested route reflection cluster
Insert picture description here
configuration idea
1. Establish a BGP neighbor relationship
with the RR at the client 2. Establish a BGP client relationship with the customer at the RR 4. BGP
Insert picture description here
Insert picture description here
alliance
solves the problem :
Solution for controlling a large number of IBGP peers : subdivide an autonomous system into a group of autonomous systems, which we call member autonomous systems. Speakers in the alliance establish IBGP relationships with peers in the same member AS, and The peers in other ASs establish an EBGP relationship. BGP will assign an alliance ID to the alliance. This alliance ID is regarded by the peers outside the alliance as the AS number of the entire alliance. The AS is
the configured AS, and the AS number of the alliance is the alliance. Id
Insert picture description here

Configuration command
1. Normal establishment of the AS number inside the alliance
2. The announcement of the alliance ID in the
bgp mode is the AS number considered outside the alliance 3. The election of the peer-group within the alliance is selected in the bgp mode
4. When the neighbor AS is designated inside the alliance Configured AS
5. When specifying a neighbor AS outside the confederation, the specified community number is used
Insert picture description here
Insert picture description here

Published 24 original articles · won 10 · views 2378

Guess you like

Origin blog.csdn.net/flat0809/article/details/96831279