BGP protocol learning and some features

Source: Internet
Author: User
Tags connection reset


Write a little bit of knowledge about BGP recently started to be exposed (part of it is intercepted from the Network)
Rfc4271 defines that a vro belongs to only one as, and the as value range is 1-65535 64521-65535, which is the private as number.
The BGP protocol is a route selection protocol between regions. The self-help system can exchange route selection information without loops, and the BGP Route exchange has the path information to the target network.
BGP does not consider speed when selecting routes, but enables as to control the transmission of data streams based on multiple BGP attributes.

1. BGP is connected over TCP, so it is necessary to ensure the accessibility of the layer-3 IP; port number tcp179 (Target Port)
2. BGP creates a neighbor in the form of unicast, so you need to manually specify the neighbor after the announcement; similar to the hello packet of OSPF and ISIS routing protocols, while BGP uses keeplive to periodically send and maintain
The adjacent survival information (60 s) is used to maintain the neighbor relationship. bgp0 uses the update trigger mechanism and does not need to use the regular update mechanism.
3. The BGP source detection feature. Therefore, the neighbor address must be consistent with the update address to be sent. TCP uses the sliding window mechanism when the receiver reaches half of the update group.
Confirm that the 1-to-1 window is different from that of OSPF.
4. the TTL value of the ebgp neighbor open package is 1. If the loopback interface creates a neighbor, it needs to be increased. BGP has a wide range of attribute values to form a scalable huge network.
5. BGP is automatically aggregated by default, because when a router is advertised to its neighbor peer, the border aggregation is not like that of primary routes such as rip.
6. BGP synchronization rules. transmitted as does not transmit route entries. (entries transmitted from external as are not transmitted to other as.) If this synchronization is disabled, a routing black hole will occur.
7. BGP is horizontally split and only one hop is passed for Route entries in the same as. Therefore, route reflection is required if ibgp is fully interconnected;
8. The next hop of BGP is counted as. To ensure correct encapsulation of data packets, we should change the scare hop to the next hop of the physical connection.

Three BGP tables
Neighbor Relationship table (all BGP neighbors)
Forwarding database (records the network information of each neighbor, and routes to the optimal path with different attributes for the same purpose)
Route table (Optimal Path) ebgp route ad is 20 ibgp route ad is 200

View the neighbor table show ip bgp Summary
View the forwarding table show ip bgp (route entries obtained from neighbors are added to the BGP Forwarding Table

Route table BGP call selection process select the optimal path to each network join the routing table use show IP Route BGP View

BGP Message Type
Open packets are used to establish the initial BGP connection.
The keeplive peer periodically exchanges this message to keep the session effective (60 s)
Update updates the network-level accessibility information of the message exchange between message peers.
Notification error message
Several States of creating a neighbor relationship
Idle does not allocate network resources and does not allow incoming BGP connections (in this status, A Connection reset timer is set, and the initial retry time of BGP is restarted 60 s only when it expires.
The reset time is exponential increase, double the previous time
Connect has already established TCP three-way handshake. BGP waits for the TCP connection. If the connection is successful, the BGP sends an open group to the other party and the state machine changes to the opensent State. If the connection fails
Change to active or connect or return idle status
Active
In this status, a TCP connection is established to establish the BGP peer relationship. If the BGP peer connection is established successfully, the Open Group is sent to the peer end in the opensent status. If the BGP peer connection fails, the BGP peer connection is still in the active or idle status.
Opensent waits for the open response to respond. The received status changes to openconfirm and sends a keeplive group to the other party. If this group is not received, the status changes to external idle or active.
Established: information exchange between BGP peers. The status includes Update group keepalive group and Notification group. (connect and active are TCP connections. Active is the initiator.
Connect is the responder

Ibgp runs in the as, without direct connection. We recommend that you use full mesh instead of full mesh to solve the ibgp full mesh problem, and use Route reflectors and Federation.
To solve the problem, mainly solve the routing in backbone IGP
Neighbor indicates that the address is reachable.
Two methods for creating IGP neighbors
Physical interfaces between neighbors establish a peering relationship through which they share the same subnet.
Use the exchange interface to establish a peering relationship. If ibgp is unlikely to be directly connected to a physical connection, set the TTL value to 255.
 
Ebgp build neighbors

Direct Connection or static routing is used by default on the border router between AS and as. If it is not a direct connection, multiple hops must be specified. Neighbor x. x ebpg-multihop (1-255)
Peers can establish a peering relationship through a physical interface.
You can also use the notification loop interface to establish a peering relationship.
Neighborip-address remote-as number command: Specify the neighbor IP address in which the peer belongs
Allow updating the source address to access port 179, but do not specify the address used to access the vro. Only the source address is detected,
The vro uses the updated source address to access port 179 next to the neighbor address. Whether a TCP connection can be established depends on whether or not the vro allows me to update the source to access it.
Example:
Neighbor192.168.1.1 remote-as 1 r1
Neighbor 10.0.0.1 remote-as 1 r2
Neither party has an update source. neighborx. x updade-soure lo0 indicates that the update source of the vro is the BGP package of the l0o port, and the interface address is sent as the source address.
One side of the ring interface and one side of the direct connection interface can establish a neighbor. Here two TCP sessions, only R1 can access the TCP session of port 179 of R2.
Use show TCP brief to view
At this time, write the update source command neighbor10.0.0.1 Update-source lo0 on R2 to create two tcpsessions. When one establish and the other disappears
The two are for redundancy.


Ibgp Synchronization
By default, BGP routes do not use the routes obtained by ibgp or advertise them to external neighbors, unless the routers are local or learned by IGP.
Synchronous enabling means that Routes learned from an ibgp neighbor cannot be selected as the optimal route unless they are also learned from the IGP.
If the IGP is OSPF, then the router-ID with the prefix matches the router-id of BGP.

Therefore, the synchronization condition is disabled.
Route the ebgp to the IGP
This as does not provide the traversal Service (stub as) for other)
The router runs BGP on the traversal path.
 

BGP attributes

It is recognized as mandatory and free-to-pass, optional, and optional
Optional attributes are not required. Therefore, BGP is supported.
For optional transmission properties that are not supported, the router will pass the original seal to other BGP routers. This situation is marked as partial
For optional non-pass attributes, the router deletes them and does not pass them to other BGP routes.


As-Path)
As_path is a recognized and mandatory attribute. It describes the path between AS and the route to the destination specified by NLRI in the order of,
When each router running BGP initiates a hop route (when it publishes an NLRI of the relevant destination in its own as domain, it attaches its as to the as-path)
When the router running BGP subsequently publishes a route to the external peer, he attaches his as number to the as-path. As can describe the autonomous system that he passes through.
As. ends with the as of the initiator. The as is added to the as-path only when BGP is the neighbor that sends the UPDATE message to another as domain.
You can use as to change the as-path of the published route to influence the flow of data streams.
Another attribute of as-path is to avoid loops. If BGP receives a route from its external neighbor, and the route as-path contains its own as number
The router knows that it is a loop route. The method seems to be to hide the private as command neighbor x. x remove-private-as when the router sends an update
The private as number is denied and its route is not sent to other routers.
IP as-path access-List 1 deny ^ 100 $
IP as-path access-List 1 deny *
Neighbor x. x gilter-List 1 out

Increase the length of as-path. Set as-path prepend in route-map can be used.

The BGP bestpath as-path ignore (hidden command) command allows us to skip the as-path route selection and continue to select the optimal path.
 

Origin)
Recognized mandatory attributes (defined path Source Information)
IGP uses BGP to advertise the network within the starting as. This is usually the case where the BGP table has an I Representation
EGP routes are advertised to EGP and are represented by E in the BGP table.
If the source of the incomplete route is unknown or is learned by other methods, what is displayed on the header?

Next Hop attribute
It is recognized as a required attribute and describes the next hop router IP address to the stock route
Use Static Routing and next-hop-self to prevent the IGP where the target is inaccessible or where the ibgp neighbor is located, and re-distribute it to the IGP directly connected to EGP.
We recommend that you use loopback to build a neighbor.


Local priority attribute
It is accepted that attributes are free to be determined. It tells the router in as that path to leave the preferred path of AS. The higher the local priority, the more likely the path will be selected. Pay attention to the priority.
The attribute can only be exchanged between routers in the as, and only applies to internal neighbors. It is used for update messages between neighbor peers.

The local priority can be transmitted in the AS and the consortium. The larger the priority, the higher the priority. The local-preference is 100 by default, which affects the outbound traffic of the router.


Weight attribute
The Cisco private parameter is valid locally. By default, the local originating path has the same weight value (that is, 32768). All other paths have zero weight values. The larger the value, the higher the priority.
The weight only affects the current vro. The weight of the specified neighbor is neighbor IP address. | peer-group-name wiight weight can be set to 0-65535 In the Inbound direction of neighbor.


Med attributes
It is called a measurement value and is an optional non-pass attribute. The smaller the preferred path for the as to be accessed, the higher the priority of the update message that carries ebgp.


Community attributes
Is a set of destinations that share certain common features. It is used to simplify the execution of routing policies.
The value of a group of four eight-bit groups. The first two eight-bit groups represent Autonomous Systems, and the last two eight-bit groups represent management identifiers in the format of NN: AA.
The group property is a passed property type code of 8


BGP Route Summary
2 types
Summary
Manual Summary of static routes pointing to null 0 introducing BGP in the network (lack of flexibility)
When the detailed route is disconnected, the summary will still be introduced.
Aggregate Aggregation
Which of the following is the next hop of an aggregation route generated on the current vro: 0.0.0.0?
Configuration:

Aggregate-address 172.16.12.0 255.255.252.0?

Advertise-map set condition to advertise attribute

As-set generate as set path information

Attribute-map set attributes of aggregate

Route-map set parameters of aggregate

Summary-only filter more specific routes from updates

Suppress-map conditionally filter more specific routes from updates

NLRI
Advertise-Map

BGP Route Decision-Making
The rib of BGP consists of three parts:
The adj-ribs-in stores the route information to be processed in the route update learned from the peer. It is considered as a feasible route in the adj
The LOC-RIB contains the routes selected after BGP speakers apply local policies to the routes in the ADJ-RIBS-IN
Adj-ribs-out includes the BGP speaker declaring a route to the peer
Select three phases
Calculate the priority of each feasible route
Select the best route for a specific destination from so available route and install it in the LOC-RIB
3. Add the corresponding route to the ADJ-RIBS-OUT to advertise to the peer
13 routing principles
Weight (Cisco private) is valid locally
Local-preference local priority is used for passing the default 100 in the AS and large consortium
The local route of the local origin router takes precedence over 0.0.0.0 in fib.
The as-path evaluates the length of as-path, and the shortest path takes precedence.
Source code
The smaller the origin code attribute, the higher the priority.
Med metric transmission cannot be passed out. Except for the AS, the originating vro is sent. metric can be passed to the neighbor. It can be ibgp/EBP, but ebgpbu cannot be passed out.
Ebgp and ibgp
The nearest IGP neighbor indicates that the Peer update source is shown in my vro.
Whether or not o, OIA, oe1, and oe2 are considered as OSPF. Only cost is used, and no o, oi, or OE is used.
If maximum-path (ibgp) is configured, multiple equal paths are inserted. The default value is 1.
The oldest peer is the first peer to establish a neighbor relationship with the local end.
Optimal Route-ID
If the initiator router ID of the multi-hop path is the same
Preferably the path of the lowest neighbor address


Route flaps and route dampening)
There are many reasons for Route flip, such as link instability, interface instability, interface failure, ISP engineering construction, and configuration error.
Solution ebgp creating a neighbor does not seem to introduce the ring port into the BGP Network + Backdoor
Route reflectors
Due to the horizontal split of RIP, ibgp needs full mesh. Because the whole ibgp full mesh requires the number of sessions to be created N * (n-1)/2,
Non-scalability. One is the route reflector, and the other is the federated (with ebgp features)

In the future, I will take the time to write more detailed knowledge and share some of the content with you. Some of the content is shared by other friends. It is essential to learn about BGP.


This article from the "Technical Achievement dream @ yuan" blog, please be sure to keep this http://iyuan.blog.51cto.com/8506693/1552650

BGP protocol learning and some features

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.