1, Dynamic routing protocol partition
- Distance vector RIP EIGRP (fastest convergence) BGP (path information)
- Link state OSPF ISIS
- Path vector BGP
- IGP internal gateway protocol
- EGP border gateway protocol
BGP partition AS 1-65535 64512-65535 private as 2 ^ 16 insufficient as number
- Neighbors can be established across hops
- A protocol that emphasizes routing delivery control: routing learning, selectivity, routing control
- Manually establish neighbors
- BGP has multiple routing attributes
3, Neighbor building of BGP
BGP uses TCP protocol to establish neighbor port number 179 through unicast
- The BGP neighbor established within the IBGP neighbor AS is consistent with the AS number of the neighbor router
- BGP neighbors are established between EBGP neighbors and AS, and the AS numbers of neighbor routers are different
Generally speaking, BGP's EBGP neighbor building will use direct connection and IBGP neighbor building will use loopback.
If we use loopback to establish EBGP neighbors, we need to modify the number of neighbor hops.
bgp 200 router-id 184.108.40.206 peer 10.1.24.2 as-number 300 peer 10.4.4.4 as-number 300 peer 10.4.4.4 ebgp-max-hop 2 //Modify the number of hops without adding a value. The default value is 255 peer 10.4.4.4 connect-interface LoopBack0 bgp 100 router-id 220.127.116.11 peer 10.1.13.2 as-number 300 peer 10.1.13.2 password simple 123 //BGP certification
BGP neighbor state transition and packet
BGP does not update periodically, but only triggers the update. The update package can update the route or revoke the route. The update speed of BGP is very slow.
4, BGP route generation
The Network command introduces the existing routes in the IP routing table into the BGP routing table one by one.
The mask declaration must correspond to the routing mask in the routing table, otherwise it will not be declared.
The Import command imports routes into the BGP routing table according to the running Routing Protocols (RIP, OSPF, ISIS, etc.), and
The import command can also introduce direct and static routes.
5, BGP routing learning
- Only publish your best route to your neighbors
- The optimal route obtained through EBGP is published to all BGP neighbors
- Transfer routing cannot be performed between IBGP - the reason is that ring prevention is a horizontal split setting - there is no ring prevention calculation between IBGP
- Synchronization between BGP and IGP - BGP will check whether its route has been republished to IGP. If yes, it is synchronous. If not, it is out of sync (out of sync routes are not superior in BGP)
-1 BGP full interconnection - configure BGP on the black hole router and establish neighbors with other BGP routers
-2 republish - introduce BGP routing into IBGP - synchronize BGP with IGP
-3 mpls as tunnel
- When routing is transferred between IBGP, the next hop of the route remains unchanged
Peer 10.4.4.4 next hop local / / solve the next hop unreachable problem
- When routing between EBGP, the next hop of the route will be modified to its own update address (neighbor building address)
6, BGP routing update
Local routing (BGP-RIB) - -- > filtering ----- > outgoing BGP-RIB - updata – > incoming BGP-RIB of neighbor – > filtering - > local BGP-RIB of neighbor
7, BGP filtering
- Use prefix lists to implement filtering
bgp 100 router-id 18.104.22.168 peer 10.1.13.2 as-number 300 # ipv4-family unicast undo synchronization network 22.214.171.124 255.255.255.255 network 126.96.36.199 255.255.255.255 network 188.8.131.52 255.255.255.255 network 184.108.40.206 255.255.255.255 peer 10.1.13.2 enable peer 10.1.13.2 ip-prefix 3 export # ip ip-prefix 3 index 10 deny 220.127.116.11 32 ip ip-prefix 3 index 20 permit 0.0.0.0 0 less-equal 32
- Use route policy to implement filtering
bgp 300 router-id 18.104.22.168 peer 10.1.24.1 as-number 200 peer 10.3.3.3 as-number 300 peer 10.3.3.3 connect-interface LoopBack0 # ipv4-family unicast undo synchronization network 22.214.171.124 255.255.255.255 import-route direct route-policy direct peer 10.1.24.1 enable peer 10.1.24.1 route-policy 2 export peer 10.3.3.3 enable peer 10.3.3.3 next-hop-local route-policy 2 deny node 10 if-match ip-prefix 3 # route-policy 2 permit node 20 # ip ip-prefix 3 index 10 permit 126.96.36.199 32