r1:
//1.配置物理接口作为TCP路由可达的接口
【资料图】
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
//配置子接口作为要引入的外部直连路由
[r1-LoopBack2]ip address 10.1.1.1 32
[r1-LoopBack2]ip address 10.1.1.2 32 sub
[r1-LoopBack2]ip address 10.1.1.3 32 sub
[r1-LoopBack2]ip address 10.1.1.4 32 sub
//创建BGP不同的AS号之间建立对等体
bgp 100
peer 192.168.1.2 as-number 200
#
ipv4-family unicast
undo synchronization
//精确注入BGP路由
network 1.1.1.1 255.255.255.255
//批量注入BGP路由
import-route direct
peer 192.168.1.2 enable
r2:
//1.配置逻辑回环接口作为TCP路由可达的接口
interface GigabitEthernet0/0/0
ip address 192.168.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.2.2 255.255.255.0
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
//静态路由(TCP协议是双向奔赴)
ip route-static 3.3.3.3 255.255.255.255 192.168.2.3
ip route-static 4.4.4.4 255.255.255.255 192.168.2.3
//2.配置
bgp 200
//创建BGP相同的AS号之间建立对等体
peer 3.3.3.3 as-number 200
//指定建立邻居关系时使用的接口,使用环回口建立TCP连接,增加BGP的稳定性
peer 3.3.3.3 connect-interface LoopBack0
peer 4.4.4.4 as-number 200
//指定建立邻居关系时使用的接口,使用环回口建立TCP连接,增加BGP的稳定性
peer 4.4.4.4 connect-interface LoopBack0
peer 192.168.1.1 as-number 100
#
ipv4-family unicast
undo synchronization
//把明细路由变成聚合路由并且抑制明细路由发给BGP对等体
aggregate 10.1.1.0 255.255.255.0 detail-suppressed
peer 3.3.3.3 enable
//最优路径*>i
peer 3.3.3.3 next-hop-local
peer 4.4.4.4 enable
//最优路径*>i
peer 4.4.4.4 next-hop-local
peer 192.168.1.1 enable
r3:
interface GigabitEthernet0/0/0
ip address 192.168.2.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.3.3 255.255.255.0
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
bgp 200
peer 2.2.2.2 as-number 200
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 4.4.4.4 enable
#
ip route-static 2.2.2.2 255.255.255.255 192.168.2.2
ip route-static 4.4.4.4 255.255.255.255 192.168.3.4
#
r4:
interface GigabitEthernet0/0/0
ip address 192.168.3.4 255.255.255.0
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
interface GigabitEthernet0/0/2
ip address 192.168.5.4 255.255.255.0
bgp 200
peer 2.2.2.2 as-number 200
peer 3.3.3.3 as-number 200
peer 192.168.5.6 as-number 300
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 3.3.3.3 enable
peer 192.168.5.6 enable
#
ip route-static 2.2.2.2 255.255.255.255 192.168.3.3
ip route-static 3.3.3.3 255.255.255.255 192.168.3.3
#
r6:
interface GigabitEthernet0/0/0
ip address 192.168.5.6 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.7.6 255.255.255.0
interface LoopBack0
ip address 6.6.6.6 255.255.255.255
#
bgp 300
peer 7.7.7.7 as-number 300
peer 192.168.5.4 as-number 200
#
ipv4-family unicast
undo synchronization
peer 7.7.7.7 enable
peer 192.168.5.4 enable
#
ip route-static 4.4.4.4 255.255.255.255 192.168.5.4
#
关键词: