BGP neighbor

Principle overview :

Routing information protocol is divided into internal gateway protocol (IGP:Interior Gateway Protocol) And external gateway protocol (EGP:Exterior Gateway
Protocol) Two categories .IGP For autonomous systems AS(Autonomous
System) inside ,EGP be used for AS between . original IGP It's called GGP(Gateway-to-Gateway
Protocol) Routing protocol , And the earliest EGP It's a kind of EGP(Exterior-Gateway
protocol, be careful , It is related to class aliases EGP Same name , It has now been abolished ) Routing protocol . at present , common IGP include RIP,OSPF,IS-IS etc. , And common EGP only BGP(Border
Gateway Protocol).

Experimental purpose :

understand BGP Application scenarios of the protocol

understand IBGP and EBGP Concept of neighbor

to configure IBGP And EBGP Neighbor relationship

Experimental topology :

1: Basic configuration :

Will be in R1 and R2 Use a direct physical interface to configure IBGP Neighbor relationship , To achieve link redundancy ,R1 and
R2 Two links are deployed between , When one of the links fails , Another physical link can provide connectivity .
R1: # interface GigabitEthernet0/0/0  ip address 10.0.12.1 255.255.255.0 #
interface GigabitEthernet0/0/1  ip address 10.0.21.1 255.255.255.0 # interface
GigabitEthernet0/0/2 # interface NULL0 # interface LoopBack0  ip address
10.0.1.1 255.255.255.255 # bgp 100  router-id 10.0.1.1  peer 10.0.12.2
as-number 100  peer 10.0.21.2 as-number 100  #  ipv4-family unicast   undo
synchronization   network 10.0.1.1 255.255.255.255   peer 10.0.12.2 enable
  peer 10.0.21.2 enable R2:, # interface GigabitEthernet0/0/0  ip address
10.0.12.2 255.255.255.0 # interface GigabitEthernet0/0/1  ip address 10.0.21.2
255.255.255.0 # interface GigabitEthernet0/0/2  ip address 10.0.23.2
255.255.255.0 # interface GigabitEthernet4/0/0  ip address 10.0.32.2
255.255.255.0 # interface NULL0 # interface LoopBack0  ip address 10.0.2.2
255.255.255.255 # bgp 100  router-id 10.0.2.2  peer 10.0.12.1 as-number 100
 peer 10.0.12.2 as-number 100  peer 10.0.21.1 as-number 100  #  ipv4-family
unicast   undo synchronization   peer 10.0.12.1 enable   undo peer 10.0.12.2
enable   peer 10.0.21.1 enable R3: # interface GigabitEthernet0/0/0  ip address
10.0.23.3 255.255.255.0 # interface GigabitEthernet0/0/1  ip address 10.0.32.3
255.255.255.0 # interface GigabitEthernet0/0/2 # interface NULL0 # interface
LoopBack0  ip address 10.0.3.3 255.255.255.255
2: to configure IBGP neighbor :

We have finished the configuration based on the basic configuration , Next, let's look at BGP Neighbor relationship

Can see ,R2 Now there are two BGP neighbor , Use separately R1 of G0/0/0 and G0/0/1 Interface address ,AS Number is 100, And R2 own AS Same number , therefore R2 And R1 by IBGP neighbor , Current neighbor status is Established, Indicates that the neighbor relationship has been fully established .
[R1]bgp 100 [R1-bgp]network 10.0.1.1 32
After configuration , stay R2 View on BGP Routing table

In order to make R1 of Loopback 0 Interface and R2 of Loopback Interface established TCP conversation , Need in R1 and R2 Configure to arrive at the opposite party Loopback 0 Static routing of interface .
R1:Lo0 Static state of : [R1]ip route-static 10.0.2.2 32 10.0.12.2 [R1]ip ro [R1]ip route-s
[R1]ip route-static 10.0.2.2 32 10.0.21.2 R2:Lo0 Static state of : ip route-static 10.0.1.1
255.255.255.255 10.0.12.1 ip route-static 10.0.1.1 255.255.255.255 10.0.21.1
Delete the previous configuration with physical interface IBGP Neighbor's order , And use Loopback 0 Interface re establishment IBGP Neighbor relationship .
[R1]bgp 100 [R1-bgp]undo peer 10.0.12.2 [R1-bgp]un peer 10.0.21.2 [R1-bgp]peer
10.0.2.2 as-number 100 [R2]bgp 100 [R2-bgp]un peer 10.0.12.1 [R2-bgp]un peer
10.0.21.1 [R2-bgp]peer 10.0.1.1 as-number 100
After the above configuration is completed , stay R1 View on BGP Neighbor relationship

Can see ,R1 And R2 Our neighbors stay Active state , Not Extablished, This shows R1 And R2 It has not been established normally IBGP Neighbor relationship .

stay R1 Specify to use your own Loopback 0 Send as interface address BGP Source of message IP address ,R2 A similar command is required on
[R1]bgp 100 [R1-bgp]peer 10.0.2.2 connect-interface lo 0 [R2]bgp 100
[R2-bgp]peer 10.0.1.1 connect-interface lo 0
After the above configuration is completed , stay R2 View on BGP Routing table

 

Can see ,R2 of BGP There is only one destination in the routing table 10.0.1.1/32 Routing , Next jump is 10.0.1.1

View again R2 of IP Routing table

to configure EBGP neighbor

stay R2 and R3 Use on Loopback 0 Interface to establish EBGP Neighbor relationship
[R2]bgp 100 [R2-bgp]peer 10.0.3.3 as-number 200 [R3]bgp 200 [R3-bgp]router-id
10.0.3.3 [R3-bgp]peer 10.0.2.2 as-number 100
After the above configuration is completed , stay R3 View on BGP Neighbor relationship

Can see ,R2 And R3 Your neighbor status has been stuck in IdIe state , It indicates that the neighbor relationship has not been established normally .

We know ,BGP The precondition of establishing neighbor relationship is to be able to establish TCP conversation , And now R2 and R3 It doesn't exist in the world. Go to each other Loopback 0
Interface routing , Therefore, it cannot be established TCP conversation , To solve this problem , Can be in R2 and R3 Configuration arrival on Loopback 0 Static routing of interface .
[R2]ip route-static 10.0.3.0 24 10.0.23.3 [R2]ip route-static 10.0.3.0 24
10.0.32.3 [R3]ip route-static 10.0.2.0 24 10.0.23.2 [R3]ip route-static
10.0.2.0 24 10.0.32.2

After the above configuration is completed , stay R3 View on BGP Neighbor relationship

Can see ,R2 And R3 The relationship between neighbors has been stuck in Active state , It shows that the neighbor relationship has not been established normally
[R2-bgp]peer 10.0.3.3 connect-interface lo 0 [R3-bgp]peer 10.0.2.2
connect-interface lo 0
After configuration , stay R3 View on BGP Neighbor relationship

By default ,EBGP Sending between neighbors BGP Message time ,TTL by 1, therefore EBGP By default, neighbors must be physically connected . But when R2 and R3 use Loopback 0
When establishing neighbor relationship with interface , Because the physical direct connection interface is not used , therefore TTL Will be subtracted more than once , become 0, Eventually BGP The message will be discarded ; As a result, the neighbor relationship cannot be established , To solve this problem , Can be modified EBGP Sent by neighbors BGP Message TTL value , Make the message TTL Value greater than 1

stay R2 and R3 Upper configuration BGP Message TTL Value is 2
[R2-bgp]peer 10.0.3.3 ebgp-max-hop 2 [R3-bgp]peer 10.0.2.2 ebgp-max-hop 2
After the above configuration is completed , stay R3 View on BGP Neighbor relationship

Can see ,R2 And R3 Has been established between EBGP Neighbor relationship

It should be noted that , In the actual scene , Commonly used Loopback Interface to establish IBGP Neighbor relationship , Use physical interfaces to establish EBGP Neighbor relationship .

remarks : If there is an error , Please understand !

This article is my study note , For reference only ! If repeated !!! Please contact me !

Technology