Border Gateway Protocol BGP

Keywords: network Network Protocol TCP/IP

Partition of dynamic routing protocols

1. Algorithm

1) , distance vector type - RIP, EIGRP (Cisco, fastest convergence), BGP (path information)

2) , link state - OSPF, ISIS

3) Path vector BGP

2. Scope AS

1) , IGP (internal Gateway Protocol)

2) EGP (border gateway protocol)

BGP partition AS 1~65535 64512~65535 private AS 2^16AS number is insufficient

BGP features:

1. Neighbors can be established across hops

2. A protocol that emphasizes routing delivery control: routing learning, selectivity, routing control

3. Manually establish neighbors

4. BGP has many attributes

Establishment of BGP

BGP uses TCP for neighbor building through unicast, and the port number is 179

 

Neighbor type:

IBGP neighbors: BGP neighbors established within the AS, and the AS numbers of neighbor routers are consistent

EBGP neighbors: BGP neighbors are established between 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.

As follows:

bgp 200
 router-id 2.2.2.2
 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 certification

bgp 100
 router-id 1.1.1.1
 peer 10.1.13.2 as-number 300
 peer 10.1.13.2 password simple 123 //BGP certification

BGP neighbor state and packet (state machine)

BGP does not have periodic updates, but only triggers updates. The update package can update the route or revoke the route. The update speed of BGP is very slow.

BGP route generation

1,network

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

2,import

The Import command is used to import to BGP according to the running Routing Protocols (RIP, OSPF, ISIS, etc.)

BGP routing learning

Notification principle:

1. Only publish your best route to your neighbors

2. The optimal route obtained through EBGP is published to all BGP neighbors

3. Transfer routing cannot be performed between IBGP - the reason is that ring prevention is a horizontal segmentation setting - ring prevention calculation is not set between IBGP

4. Synchronization between BGP and IGP - BGP will check whether its route has been republished to IGP. If so, it will be synchronized

If not, it is out of sync (out of sync routing is not optimal in BGP)

Routing black hole problem

Solutions: 1) configure BGP on the black hole router and establish neighbors with other BGP routers

            2) . republish: introduce BGP routing into IBGP

            3) And mpls as tunnels

5. 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 unchanged

6. When routing is transferred between EBGP, the next hop of the route will be modified to its own update address (creation address)

BGP routing update

Local routing (BGP-RIB) -- filtering -- > outgoing BGP-RIB -- update -- > neighbor incoming BGP-RIB -- > filtering -- >

Neighbor's local BGP-RIB

BGP filtering

  1. Use prefix list to implement filtering

bgp 100
router-id 1.1.1.1
peer 10.1.13.2 as-number 300
#
ipv4-family unicast
undo synchronization
network 30.1.1.1 255.255.255.255
network 100.1.1.1 255.255.255.255
network 100.2.2.2 255.255.255.255
network 100.3.3.3 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 100.3.3.3 32
ip ip-prefix 3 index 20 permit 0.0.0.0 0 less-equal 32

2. Use route policy to implement filtering

bgp 300
router-id 4.4.4.4
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 20.4.4.4 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 100.2.2.2 32

Posted by jwilliam on Sun, 10 Oct 2021 08:13:21 -0700