Require:
1. R1, R2, and R3 establish an IBGP peer with AS number 65001. R1, R3, R4 established
EBGP peer, R4 peer number is 65002.
2. IBGP uses the loopback interface to establish a neighbor, and EBGP uses a direct connection interface to establish a neighbor
3. The next hop from the 192.168.2.1 network segment of R2 to the 192.168.1.1 network segment of R4 needs to be R1
1. Basic configuration:
R1 ip location
int g0/0
no swi
ip a 12.0.0.1 24
int g0/1
no swi
ip a 14.0.0.1 24
int l 0
ip a 1.1.1.1 32
R2 ip location
int g0/0
no swi
ip a 12.0 .0.2 24
int g0/1
no swi
ip a 23.0.0.1 24
int l 0
ip a 2.2.2.2 32
R3 ip location
int g0/1
no swi
ip a 23.0.0.2 24
int g0/2
no swi
ip a 34.0. 0.1 24
int l 0
ip a 3.3.3.3 32
R4 ip location
int g0/1
no swi
ip a 14.0.0.2 24
int g0/2
no swi
ip a 34.0.0.2 24
int l 0
ip a 4.4.4.4 32
int l 1
ip a 192.168.1.1 24
2. Use ospf to make the loopback port of the IBGP peer reachable
R1 ospf配置
router ospf 1
graceful-restart
network 1.1.1.1 0.0.0.0 area 0
network 12.0.0.0 0.0.0.3 area 0
R2 ospf配置
router ospf 1
graceful-restart
network 2.2.2.2 0.0.0.0 area 0
network 12.0.0.0 0.0.0.3 area 0
network 23.0.0.0 0.0.0.3 area 0
R2 ospf配置
router ospf 1
graceful-restart
network 3.3.3.3 0.0.0.0 area 0
network 23.0.0.0 0.0.0.3 area 0
Use R1 to test that the loopback ports of R2 and R3 are reachable through ping
3. BGP configuration
R1
router bgp 65001
neighbor 2.2.2.2 remote-as 65001
neighbor 2.2.2.2 update-source Loopback 0
neighbor 3.3.3.3 remote-as 65001
neighbor 3.3.3.3 update-source Loopback 0
neighbor 14.0.0.2 remote-as 65002
R2
router bgp 65001
neighbor 1.1.1.1 remote-as 65001
neighbor 1.1.1.1 update-source Loopback 0
neighbor 3.3.3.3 remote-as 65001
neighbor 3.3.3.3 update-source Loopback 0
network 192.168.2.0 mask 255.255.255.0
R3
router bgp 65001
neighbor 1.1.1.1 remote-as 65001
neighbor 1.1.1.1 update-source Loopback 0
neighbor 2.2.2.2 remote-as 65001
neighbor 2.2.2.2 update-source Loopback 0
neighbor 34.0.0.2 remote-as 65002
R4
route bgp 65002
neighbor 14.0.0.1 remote-as 65001
neighbor 34.0.0.1 remote-as 65001
network 192.168.1.0 mask 255.255.255.0
At this time, due to the characteristics of IBGP, when the route learned from EBGP is passed to IBGP, the next hop attribute will not be modified. Therefore, if you check the route on R2, you can find that the next hop is the interface of R4, and communication is not possible at this time.
A command needs to be added in BGP on R1
neighbor 2.2.2.2 next-hop-self #Modify the next hop attribute to yourself
At this time, it can be found on R2 that the next hop is 1.1.1.1, and do not *> indicate the effective and optimal state
At this point, the next hop from R2 to R4 is R1.