1. 程式人生 > >BGP路由解決黑洞

BGP路由解決黑洞

peer -group解決資料層面的黑洞:

###在這裡插入圖片描述
GNS3:拓撲圖:
在這裡插入圖片描述
#配置:EBGP與IBGP建立鄰居,使用物理介面建立,
R1#conf
R1(config)#int lo0
*Oct 26 22:44:52.807: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#int s1/1
R1(config-if)#ip add 12.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config)#
R1(config)#router bgp 1
R1(config-router)#neighbor 12.1.1.2 remote-as 234
R1(config-router)#network 1.1.1.0 mask 255.255.255.0
R1(config-router)#
*Oct 26 22:55:53.659: %BGP-5-ADJCHANGE: neighbor 12.1.1.2 Up

R5配置:
R5(config)#int lo0
R5(config-if)#ip add 5.5.5.5 255.255.255.0
R5(config-if)#int s1/0
R5(config-if)#ip add 45.1.1.2 255.255.255.0
R5(config-if)#no shutdown
R5(config-if)#
R5(config)#router bgp 5
R5(config-router)#b router-id 5.5.5.5
R5(config-router)#neighbor 45.1.1.1
R5(config-router)#neighbor 45.1.1.1 remote-as 234
R5(config-router)#network 5.5.5.0 mask 255.255.255.0

#R2,R3,R4屬於IBGP,使用 BGP建立鄰居時,每個路由器存在多條相似的 命令,對於路由器個數大量時,對網路工程師的效率要求賊高:
在該種情況下,通常使用peer-group來配置

R2(config)#router eigrp 100
R2(config-router)#no auto-summary
R2(config-router)#network 23.1.1.0 0.0.0.255
R2(config-router)#network 2.2.2.0 0.0.0.255
R2(config)#router bgp 234
R2(config-router)#b router-id 2.2.2.2
R2(config-router)#neighbor 12.1.1.1 remote-as 1
R2(config-router)#neighbor ccna peer-group
R2(config-router)#neighbor 3.3.3.3 update-source loopback 0
R2(config-router)#neighbor ccna remote-as 234
R2(config-router)#neighbor ccna update-source loopback 0
R2(config-router)#neighbor ccna next-hop-self
R2(config-router)#neighbor 3.3.3.3 peer-group ccna
R2(config-router)#neighbor 4.4.4.4 peer-group ccna

R3(config)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#int s1/0
R3(config-if)#ip add 23.1.1.2 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int s1/1
R3(config-if)#ip add 34.1.1.1 255.255.255.0
R3(config-if)#no shutdown
R3(config)#router eigrp 100
R3(config-router)#no auto-summary
R3(config-router)#net
R3(config-router)#network 23.1.1.0 0.0.0.255
R3(config-router)#network 3.3.3.0 0.0.0.255
R3(config-router)#network 34.1.1.0 0.0.0.255

R3(config)#router bgp 234
R3(config-router)#bgp router-id 3.3.3.3
R3(config-router)#neighbor ccnp peer-group
R3(config-router)#neighbor ccnp remote-as 234
R3(config-router)#neighbor ccnp update-source loopback 0
R3(config-router)#neighbor 2.2.2.2 peer-group ccnp
R3(config-router)#neighbor 4.4.4.4 peer-group ccnp

R4(config)#int lo0
R4(config-if)#ip add 4.4.4.4 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#int s1/0
R4(config-if)#ip add 34.1.1.2 255.255.255.0
R4(config-if)#no sh
R4(config-if)#int s1/1
R4(config-if)#ip add 45.1.1.1 255.255.255.0
R4(config-if)#no s

R4(config)#router eigrp 100
R4(config-router)#no auto-summary
R4(config-router)#network 34.1.1.0 0.0.0.255
R4(config-router)#network 4.4.4.0 00.0.0.255
R4(config-router)#do ping 2.2.2.2 sou

R4(config)#router bgp 234
R4(config-router)#neighbor 45.1.1.2 remote-as 5

R4(config)#router bgp 234
R4(config-router)#bgp router-id 4.4.4.4
R4(config-router)#neighbor ccie peer-group
R4(config-router)#neighbor ccie remote-as 234
R4(config-router)#neighbor ccie update-source loopback 0
R4(config-router)#neighbor ccie next-hop-self
R4(config-router)#neighbor 2.2.2.2 peer-group ccie
R4(config-router)#neighbor 3.3.3.3 peer-group ccie

R2,R3,R4上的peer-group 名字相互獨立可相同也可不同,在IBGP邊界路由器設定時,要將路由器的下一跳屬性改為自己(neighbor x.x.x.x next-hop-self ).並且設定peer-group組中的成員 (neighbor x.x.x.x … x.x.x.x)