BGP Border Gateway Protocol
BGP Functions:
A large number of routes are transmitted in a stable manner over time between different large networks
And it allows flexible routing control while ensuring loop-free.
BGP work process:
1. Establish neighbor list;
2. Synchronous database;
3. Calculate the routing table
BGP routing principles:
1.preference-value, Huawei private attribute, only works locally on the device. The larger the value, the better;
It will not be transmitted to other routers along with the update message;
2.local-preference, local priority, the larger the better; default is 100;
3. Compare whether the route is "locally originated": locally generated is better than learned from other neighbors;
#self-generated: manual aggregation> automatic aggregation> network > import-route
#Learning from neighbors;
4.as-path , comparing the length of as-path, the shorter the better;
5. Compare origin attributes: i > e > ?
6. Compare MED, the smaller the better;
7. Compare route types, EBGP > IBGP
8. Compare the size of the Metric for the next hop to the BGP route, the smaller the better.
9. Compare the length of cluster-list, the shorter the better;
10. The comparison is originator-id, the smaller the better;
11. Compare router-id, the smaller the better;
12. Compare IP addresses of neighbor devices, the smaller the better;
BGP route announcement and delivery:
- Means of announcement:
network
--> Put the route into the BGP database;
- Transmission:
1. When routing between external BGP neighbors, the next hop is changed;
2. When routing between internal BGP neighbors, the next hop is invariant;
- If it does not change, it may cause the next hop to be unreachable.
Configuration command: [R1]bgp200[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 192.168.2.2 as-number 64512
Note: 192.168.2.2 must be the real IP address of the interface of the other device, and it can be communicated;
It cannot be the router-id of the other party; # as-number refers to the as number of the other party, not your own.
[R1-bgp]network 192.168.1.0 255.255.255.0
[Announcing Network Segment]
[R1-bgp]peer 192.168.2.2 next-hop-local
R1 sends routes to BGP neighbor 192.168.2.2, and the next-hop IP addresses are all
Set the IP address used when establishing neighbors with each other;
Note:
Routes in BGP databases, when optimized, have the following two behaviors:
1. putting the route into a local routing table;
2. Send the route to BGP neighbors
BGP Anti-Looping Mechanism in AS: IEGP Horizontal Split
A BGP router receives a route in a host's IBGP neighbor and does not reroute it to another of its IBGP neighbors.
IBGP horizontal segmentation solution:
1 -IBGP Neighborhood Full Interconnection
2 - BGP Alliance
3 - BGP route reflector
Attribute changes for BGP routes:
1. Grab routes of interest
2. Configure routing policies, change attributes for routes of interest
3. calls the policy
route-policy distinguished by different names
route-policy consists of multiple entries, each distinguished by a different node /sequence number;
route-policy During execution, policy matching is performed starting from the smallest node number to the largest node number
If a node entry matches, stop matching. You won't see the following entry;
If there is an explicit match, the match continues until the last "Implicit Deny All"
route-policy ends with an implicit rejection of all entries:
route-policy {name} deny node {maximum number}
It does not contain any "if-match" statements, meaning match all.
How route-policy indicates that all are allowed:
route-policy {name} permit node {maximum number}
There is no need to write any match statements;
[R3]ip ip-prefix 123 permit 20.20.20.0 24
[Allow ip prefix to match 20.20.20.0 segment]
[R3]route-policy 456 permit node 10
AAA routing policy sequence is 10
[R3-route-policy]if-match ip-prefix 123
Matching Strategy 123
[R3-route-policy]apply local-preference 200
[This policy will be applied if the match is successful. Priority is 200]
[R3-bgp]peer 192.168.2.1 route-policy 456 export
[Enable policy for neighbors to be applied on egress port]