BGP local router ID : 1.1.1.1
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
192.168.12.2 4 200 8 10 0 00:06:21 Established
0
R2
sys
[Huawei]sys R2
[R2]int LoopBack 0
[R2-LoopBack0]ip address 20.20.2.2 24
[R2-LoopBack0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.12.2 24
[R2-GigabitEthernet0/0/1]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.23.2 24
[R2-GigabitEthernet0/0/0]q
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.23.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 20.20.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]q
[R2-ospf-1]q
[R2]bgp 200
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 192.168.12.1 as-number 100
[R2-bgp]peer 20.20.3.3 as-number 200
[R2-bgp]peer 20.20.3.3 connect-interface LoopBack0 //使用回环接口建立邻居
[R2-bgp]peer 20.20.3.3 next-hop-local //告诉3.3 下一跳地址改为自己
[R2-bgp]dis bgp peer
BGP local router ID : 2.2.2.2
Local AS number : 200
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
20.20.3.3 4 200 5 7 0 00:00:51 Established
3
192.168.12.1 4 100 75 83 0 01:12:25 Established
1
[R2-bgp]q
[R2]dis ospf peer brief
OSPF Process 1 with Router ID 2.2.2.2
Peer Statistic Information
[R2]
R3
sys
[Huawei]sys R3
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.23.3 24
[R3-GigabitEthernet0/0/1]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.34.3 24
[R3-GigabitEthernet0/0/0]q
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]ar
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 192.168.23.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 192.168.34.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]q
[R3-ospf-1]q
[R3]bgp 200
[R3-bgp]peer 20.20.2.2 as-number 200
[R3-bgp]peer 20.20.2.2 connect-interface LoopBack 0
[R3-bgp]peer 20.20.4.4 as-number 200
[R3-bgp]peer 20.20.4.4 connect-interface LoopBack 0
[R3-bgp]dis bgp peer
BGP local router ID : 3.3.3.3
Local AS number : 200
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
20.20.2.2 4 200 6 5 0 00:00:57 Established
4
20.20.4.4 4 200 5 6 0 00:00:44 Established
3
[R3-bgp]q
[R3]dis ospf peer brief
OSPF Process 1 with Router ID 3.3.3.3
Peer Statistic Information
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 2.2.2.2 Full
0.0.0.0 GigabitEthernet0/0/0 4.4.4.4 Full
------------------------------------------------------------------- [R3]
R4
sys
[Huawei]sys R4
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.34.4 24
[R4-GigabitEthernet0/0/1]int g0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.45.4 24
[R4-GigabitEthernet0/0/0]q
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]are
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 192.168.34.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 192.168.45.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]q
[R4-ospf-1] bgp 200
[R4-bgp]peer 20.20.3.3 as-number 200
[R4-bgp]peer 20.20.3.3 connect-interface LoopBack 0
[R4-bgp]peer 20.20.5.5 as-number 200
[R4-bgp]peer 20.20.5.5 connect-interface LoopBack 0
[R4-bgp]dis bgp peer
BGP local router ID : 4.4.4.4
Local AS number : 200
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
20.20.3.3 4 200 5 5 0 00:00:51 Established
3
20.20.5.5 4 200 3 5 0 00:00:51 Established
1
[R4-bgp]q
[R4]dis ospf peer brief
OSPF Process 1 with Router ID 4.4.4.4
Peer Statistic Information
[R4]
R5
sys
[Huawei]sys R5
[R2]int LoopBack 0
[R2-LoopBack0]ip address 20.20.5.5 24
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]ip address 192.168.45.5 24
[R5-GigabitEthernet0/0/1]int g0/0/0
[R5-GigabitEthernet0/0/0]ip address 192.168.56.5 24
[R5-GigabitEthernet0/0/0]q
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 192.168.45.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 20.20.5.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]q
[R5-ospf-1]q
[R5]bgp 200
[R5-bgp]route-select
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 192.168.56.6 as-number 600
[R5-bgp]peer 20.20.4.4 as-number 200
[R5-bgp]peer 20.20.4.4 connect-interface LoopBack0 //使用回环接口建立邻居
[R5-bgp]peer 20.20.4.4 next-hop-local //更改下一跳地址为自己
[R5-bgp]dis bgp peer
BGP local router ID : 5.5.5.5
Local AS number : 200
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
20.20.4.4 4 200 6 5 0 00:01:03 Established
3
192.168.56.6 4 600 77 83 0 01:12:54 Established
2
[R5-bgp]q
[R5]dis ospf peer brief
OSPF Process 1 with Router ID 5.5.5.5
Peer Statistic Information
[R5]
R6
sys
[Huawei]sys R6
[R6]int g0/0/1
[R6-GigabitEthernet0/0/1]ip address 192.168.56.6 24
[R6-GigabitEthernet0/0/1]int loopback 0
[R6-LoopBack0]ip address 10.10.2.1 24
[R6-LoopBack0]q
[R6]bgp 600
[R6-bgp]router-id 6.6.6.6
[R6-bgp]peer 192.168.56.5 as-number 200
[R6]bgp 600
[R6-bgp]network 10.10.2.1 24
[R6-bgp]dis bgp peer
BGP local router ID : 6.6.6.6
Local AS number : 600
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
192.168.56.5 4 200 3 3 0 00:01:10 Established
0
[R6-bgp]
问题:
R3 ------>R4 传输路由表时,容易形成环路,为避免此情况:
引出IBGP水平分割机制:
-从内部邻居学习过来的路由不转发给另一个内部邻居
解决1----->问题
IBGP设备之间“全互联”两两互联
缺点:
@命令配置量大
@消耗大量的设备资源
解决2
BGP联盟(将原来的IBGP邻居,变成EBGP邻居)
缺点:
@每个小AS内部,只能有两个路由器
解决3:
BGP 路由反射器(route reflector 即RR)
#当我们将一个BGP路由器配置成“路由反射器”之后,该路由器就会临时关闭“水平分割”。
#路由反射器客户端(RR-C)
#总结:
反射器,仅仅为“反射器客户端”进行路由反射。
扩展:
在建立EBGP邻居时,必须满足两个机制:
在 R2 - R5 每个路由器上删除bgp 200
[R2]undo bgp 200
Warning: All BGP configurations will be deleted. Continue? [Y/N]: y
R2
Bgp 64523
router-id 2.2.2.2
confederation id 200
confederation peer-as 64545
peer 192.168.12.1 as-number 100
peer 20.20.3.3 as-number 64523
peer 20.20.3.3 connect-interface loopback 0//更改连接端口
peer 20.20.3.3 next-hop-local //更改下一跳为自己
quit
R3
Bgp 64523
router-id 3.3.3.3
confederation id 200
confederation peer-as 64545
peer 20.20.2.2 as-number 64523
peer 20.20.2.2 connect-interface loopback 0//更改连接端口
peer 20.20.4.4 as-number 64545
peer 20.20.4.4 connect-interface loopback 0//更改连接端口
peer 20.20.4.4 ebgp-max-hop 255 //修改TTL为255
quit
R4
Bgp 64545
router-id 4.4.4.4
confederation id 200
confederation peer-as 64523
peer 20.20.3.3 as-number 64523
peer 20.20.3.3 connect-interface loopback 0//更改连接端口
peer 20.20.5.5 as-number 64545
peer 20.20.5.5 connect-interface loopback 0//更改连接端口
peer 20.20.3.3 ebgp-max-hop 255 //修改TTL为255
quit
R5
Bgp 64545
router-id 5.5.5.5
confederation id 200
confederation peer-as 64523
peer 192.168.56.6 as-number 600
peer 20.20.4.4 as-number 64545
peer 20.20.4.4 connect-interface loopback 0//更改连接端口
peer 20.20.4.4 next-hop-local // 更改下一跳地址为自己
quit
反射器配置
1.修改 R3/R4/R5 之间的邻居关系;
2.在R3 上配置,将 R4 指定为自己的 RR-C ;
R3:
Bgp 64523
Peer 20.20.4.4 reflect-client
//将20.20.4.4视为自己的路由反射客户端
R3:
bgp 64523
undo peer 20.20.4.4
peer 20.20.4.4 as-number 64523
peer 20.20.4.4 connect-interface loopback 0
quit
R4:
undo bgp 64545
Warning: All BGP configurations will be deleted. Continue? [Y/N]:y
bgp 64523
router-id 4.4.4.4
confederation id 200
confederation peer-as 64545
peer 20.20.5.5 as-number 64545
peer 20.20.5.5 connect-interface loopback 0
peer 20.20.5.5 ebgp-max-hop 2
peer 20.20.3.3 as-number 64523
peer 20.20.3.3 connect-interface loopback 0
quit
R5:
bgp 64545
router-id 5.5.5.5
confederation id 200
confederation peer-as 64523
peer 192.168.56.6 as-number 600
peer 20.20.4.4 as-number 64523
peer 20.20.4.4 connect-interface loopback 0
peer 20.20.4.4 ebgp-max-hop 2
peer 10.10.4.4 next-hop-local
quit
R3:
Bgp 64523
Peer 20.20.4.4 reflect-client
需求:
取消联盟,利用路由反射器实现R1与R6通信
思路:
R3
[R4]un bgp 64523
Warning: All BGP configurations will be deleted. Continue? [Y/N]: y
[R4]bgp 200
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 20.20.2.2 as-number 200
[R4-bgp]peer 20.20.2.2 connect-interface LoopBack 0
[R4-bgp]peer 20.20.4.4 as-number 200
[R4-bgp]peer 20.20.4.4 connect-interface LoopBack 0
[R4-bgp]import-route direct
R4
[R4]un bgp 64523
Warning: All BGP configurations will be deleted. Continue? [Y/N]: y
[R4]bgp 200
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 20.20.3.3 as-number 200
[R4-bgp]peer 20.20.3.3 connect-interface LoopBack 0
[R4-bgp]peer 20.20.5.5 as-number 200
[R4-bgp]peer 20.20.5.5 connect-interface LoopBack 0
[R4-bgp]import-route direct
R5
[R5]un bgp 64545
Warning: All BGP configurations will be deleted. Continue? [Y/N]: y
[R5]bgp 200
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 192.168.56.6 as-number 600
[R5-bgp]peer 20.20.4.4 as-number 200
[R5-bgp]peer 20.20.4.4 connect-interface LoopBack 0
[R5-bgp]peer 20.20.4.4 next-hop-local
[R5-bgp]import-route direct
R3 R4 分别建立反射器互为反射器和客户端
R3
Bgp 200
Peer 20.20.4.4 reflect-client
R4
Bgp 200
Peer 20.20.3.3 reflect-client
Save
Y