本文主要是介绍08 BGP 华为官方文档 十一条选路原则,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
BGP 华为官方文档 十一条选路原则
丢弃下一跳不可达的路由
1)比较“协议首选值-pref-val”属性,数值越大越好,默认值是0,只在本设备生效,不在网络中传递
2)比较“本地优先级-local_pref”属性,数值越大越好,默认值是100
3)比较:是本地始发的路由,还是从对等体学来的路由, 本地始发的BGP路由优于从其他对等体学习到的路由,**本地始发的路由优先级:优选手动聚合>自动聚合>network>import>**从对等体学到的。
4)比较“as-path” 属性-as号越短越好
5)比较“起源属性”-指的是已什么方式注入进BGP协议的
6)比较“MED”属性,指的是一个路由器去往一个BGP路由网段的距离,类似cost
7)比较EBGP邻居优先于IBGP邻居,-EBGP路由优先级高于IBGP路由
8)比较“去往BGP路由的下一跳IP地址”的cost开销值-越小越好
—如果前面8条选路规则无法选出最优的路由,我们就可以做负载均衡了
备注:AS号一致, 在要负载均衡的那台设备上开启负载均衡功能
9)比较“cluster-list”的长度,越短越好
10)比较Router ID(Orginator_ID)的大小,越小越好
11)比较“peer 后面的IP地址的大小”,越小越好
验证 下一跳是否可达
R1
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]bg
[R1]bgp 100
[R1-bgp]dis
[R1-bgp]display th
[R1-bgp]display this
[V200R003C00]
#
bgp 100peer 10.10.2.2 as-number 100 peer 10.10.2.2 connect-interface LoopBack0peer 10.10.3.3 as-number 100 peer 10.10.3.3 connect-interface LoopBack0#ipv4-family unicastundo synchronizationpeer 10.10.2.2 enablepeer 10.10.3.3 enable
#
return
[R1-bgp]q
[R1]dis
[R1]display bg
[R1]display bgp rou
[R1]display bgp routing-table BGP Local router ID is 192.168.12.1 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 4Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.2.2 0 100 0 200i* i 10.10.3.3 0 100 0 200i*>i 10.10.8.8/32 10.10.2.2 0 100 0 200i* i 10.10.3.3 0 100 0 200i
[R1]dis
[R1]display ip
[R1]display ip roi
[R1]display ip ro
[R1]display ip routing-table 10.10.4.4
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface10.10.4.4/32 IBGP 255 0 RD 10.10.2.2 GigabitEthernet
0/0/0[R1]dis
[R1]display bg
[R1]display bgp ro
[R1]display bgp routing-table BGP Local router ID is 192.168.12.1 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 4Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.3.3 0 100 0 200ii 192.168.24.4 0 100 0 200i*>i 10.10.8.8/32 10.10.3.3 0 100 0 200ii 192.168.24.4 0 100 0 200i
[R1]dis
[R1]display bg
[R1]display bgp ro
[R1]display bgp routing-table BGP Local router ID is 192.168.12.1 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 4Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.3.3 0 100 0 200ii 192.168.24.4 0 100 0 200i*>i 10.10.8.8/32 10.10.3.3 0 100 0 200ii 192.168.24.4 0 100 0 200i
[R1]dis
[R1]display bg
[R1]display bgp ro
[R1]display bgp routing-table BGP Local router ID is 192.168.12.1 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 4Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.2.2 0 100 0 200i* i 10.10.3.3 0 100 0 200i*>i 10.10.8.8/32 10.10.2.2 0 100 0 200i* i 10.10.3.3 0 100 0 200i
[R1]
R2
<R2>dis
<R2>display bg
<R2>display bgp r
<R2>display bgp routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.24.4 0 0 200i*> 10.10.8.8/32 192.168.24.4 0 0 200i
<R2>Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R2>sys
Enter system view, return user view with Ctrl+Z.
[R2]bg
[R2]bgp 100
[R2-bgp]dis
[R2-bgp]display th
[R2-bgp]display this
[V200R003C00]
#
bgp 100router-id 2.2.2.2peer 10.10.1.1 as-number 100 peer 10.10.1.1 connect-interface LoopBack0peer 192.168.24.4 as-number 200 #ipv4-family unicastundo synchronizationpeer 10.10.1.1 enablepeer 10.10.1.1 next-hop-local peer 192.168.24.4 enable
#
return
[R2-bgp]un
[R2-bgp]undo peer 10.10.1.1 next-hop-local
[R2-bgp]q
[R2]dis
[R2]display bg
[R2]display bgp ro
[R2]display bgp routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.24.4 0 0 200i*> 10.10.8.8/32 192.168.24.4 0 0 200i
[R2]display bgp routing-table 10.10.4.4BGP local router ID : 2.2.2.2Local AS number : 100Paths: 1 available, 1 best, 1 selectBGP routing table entry information of 10.10.4.4/32:From: 192.168.24.4 (4.4.4.4)Route Duration: 00h13m43s Direct Out-interface: GigabitEthernet0/0/1Original nexthop: 192.168.24.4Qos information : 0x0AS-path 200, origin igp, MED 0, pref-val 0, valid, external, best, select, acti
ve, pre 255Advertised to such 1 peers:10.10.1.1
[R2]display ip routing-table 10.10.4.4
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface10.10.4.4/32 EBGP 255 0 D 192.168.24.4 GigabitEthernet
0/0/1[R2]bg
[R2]bgp 100
[R2-bgp]peer 10.10.1.1 next-hop-local
[R2-bgp]dis
[R2-bgp]display bg
[R2-bgp]display bgp ro
[R2-bgp]display bgp routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.24.4 0 0 200i*> 10.10.8.8/32 192.168.24.4 0 0 200i
[R2-bgp]undo peer 10.10.1.1 next-hop-local
[R2-bgp]peer 10.10.1.1 next-hop-local
[R2-bgp]dis
[R2-bgp]display bg
[R2-bgp]display bgp ro
[R2-bgp]display bgp routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.24.4 0 0 200i*> 10.10.8.8/32 192.168.24.4 0 0 200i
[R2-bgp]display bgp routing-tableBGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.24.4 0 0 200i*> 10.10.8.8/32 192.168.24.4 0 0 200i
[R2-bgp]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on
R3
The device is running!<R3>dis
<R3>display bg
<R3>display bgp p
<R3>display bgp pathsTotal Number of Routes: 0Total Number of Paths: 0
<R3>display bgp pe
<R3>display bgp peer BGP local router ID : 3.3.3.3Local AS number : 100Total number of peers : 2 Peers in established state : 2Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv10.10.1.1 4 100 3 3 0 00:01:27 Established 0192.168.34.4 4 200 3 4 0 00:01:56 Established 0
<R3>dis
<R3>display bg
<R3>display bgp ro
<R3>display bgp routing-table BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 1Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.34.4 0 0 200i
<R3>dis
<R3>display bg
<R3>display bgp r
<R3>display bgp routing-table BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.34.4 0 0 200i*> 10.10.8.8/32 192.168.34.4 0 0 200i
<R3>Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R3>sys
Enter system view, return user view with Ctrl+Z.
[R3]bg
[R3]bgp 100
[R3-bgp]un
[R3-bgp]undo peer 10.10.1.1 next-hop-local
[R3-bgp]peer 10.10.1.1 next-hop-local
[R3-bgp]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on
R4
The device is running!<R4>dis
<R4>display bg
<R4>display bgp pe
<R4>display bgp peer BGP local router ID : 4.4.4.4Local AS number : 200Total number of peers : 2 Peers in established state : 2Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv192.168.24.2 4 100 4 4 0 00:02:06 Established 0192.168.34.3 4 100 4 4 0 00:02:06 Established 0
<R4>sys
Enter system view, return user view with Ctrl+Z.
[R4]bg
[R4]bgp 200
[R4-bgp]dis
[R4-bgp]display
[R4-bgp]display th
[R4-bgp]display this
[V200R003C00]
#
bgp 200router-id 4.4.4.4peer 192.168.24.2 as-number 100 peer 192.168.34.3 as-number 100 #ipv4-family unicastundo synchronizationpeer 192.168.24.2 enablepeer 192.168.34.3 enable
#
return
[R4-bgp]ne
[R4-bgp]network 10.10.4.4 32
[R4-bgp]q
[R4]dis
[R4]display bg
[R4]display bgp pe
[R4]display bgp peer BGP local router ID : 4.4.4.4Local AS number : 200Total number of peers : 2 Peers in established state : 2Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv192.168.24.2 4 100 7 8 0 00:05:05 Established 0192.168.34.3 4 100 7 8 0 00:05:05 Established 0
[R4]int
[R4]interface lo
[R4]interface LoopBack 1
[R4-LoopBack1]ip add 10.10.8.8 32
[R4-LoopBack1]q
[R4]bg
[R4]bgp 200
[R4-bgp]net
[R4-bgp]network 10.10.8.8 32
[R4-bgp]
[R4-bgp]q
[R4]dis
[R4]display bg
[R4]display bgp pe
[R4]display bgp peer BGP local router ID : 4.4.4.4Local AS number : 200Total number of peers : 2 Peers in established state : 2Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv192.168.24.2 4 100 10 12 0 00:08:50 Established 0192.168.34.3 4 100 10 12 0 00:08:50 Established 0
[R4]dis
[R4]display bg
[R4]display bgp r
[R4]display bgp routing-table BGP Local router ID is 4.4.4.4 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 0.0.0.0 0 0 i*> 10.10.8.8/32 0.0.0.0 0 0 i
[R4]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R4>
<R4>
<R4>
<R4>dis
<R4>display bg
<R4>display bgp ro
<R4>display bgp routing-table BGP Local router ID is 4.4.4.4 Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 0.0.0.0 0 0 i*> 10.10.8.8/32 0.0.0.0 0 0 i
<R4>Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on
[R4]display bgp peer
BGP local router ID : 4.4.4.4
Local AS number : 200
Total number of peers : 2 Peers in established state : 2Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv192.168.24.2 4 100 10 12 0 00:08:50 Established 0
192.168.34.3 4 100 10 12 0 00:08:50 Established 0[R4]display bgp routing-table
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 0.0.0.0 0 0 i
*> 10.10.8.8/32 0.0.0.0 0 0 i
R2:
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.24.4 0 0 200i
*> 10.10.8.8/32 192.168.24.4 0 0 200i
R3:
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.34.4 0 0 200i
*> 10.10.8.8/32 192.168.34.4 0 0 200i
R1:
Total Number of Routes: 4
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.2.2 0 100 0 200i
* i 10.10.3.3 0 100 0 200i
*>i 10.10.8.8/32 10.10.2.2 0 100 0 200i
* i 10.10.3.3 0 100 0 200i
1)比较“协议首选值-pref-val”属性,数值越大越好,默认值是0,只在本设备生效,不在网络中传递。
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]ip ip-p
[R1]ip ip-prefix ?
STRING<1-169> Specify prefix-list name
[R1]ip ip-prefix 3.3 pe
[R1]ip ip-prefix 3.3 permit 10.10.4.4 32
[R1]rou
[R1]route
[R1]route-policy 3.3 pe
[R1]route-policy 3.3 permit no
[R1]route-policy 3.3 permit node 10
Info: New Sequence of this List.
[R1-route-policy]if-match ip-prefix 3.3
[R1-route-policy]apply preferred-value 234
[R1]bgp 100
[R1-bgp]peer 10.10.3.3 route-policy 3.3 import
[R1-bgp]
<R1>refresh bgp all import
<R1>display bgp routing-tableBGP Local router ID is 192.168.12.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 3
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.3.3 0 100 234 200i
* i 10.10.2.2 0 100 0 200i
*>i 10.10.8.8/32 10.10.2.2 0 100 0 200i
<R1>display bgp routing-table 10.10.4.4BGP local router ID : 192.168.12.1
Local AS number : 100
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 10.10.4.4/32:
From: 10.10.3.3 (3.3.3.3)
Route Duration: 00h00m48s
Relay IP Nexthop: 192.168.13.3
Relay IP Out-Interface: GigabitEthernet0/0/1
Original nexthop: 10.10.3.3
Qos information : 0x0
AS-path 200, origin igp, MED 0, localpref 100, pref-val 234, valid, internal, b
est, select, active, pre 255, IGP cost 1
Not advertised to any peer yetBGP routing table entry information of 10.10.4.4/32:
From: 10.10.2.2 (2.2.2.2)
Route Duration: 00h00m48s
Relay IP Nexthop: 192.168.12.2
Relay IP Out-Interface: GigabitEthernet0/0/0
Original nexthop: 10.10.2.2
Qos information : 0x0
AS-path 200, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre
255, IGP cost 1, not preferred for PreVal
Not advertised to any peer yet
2)比较“本地优先级-local_pref”属性,数值越大越好,默认值是100。
[R1]route-policy 3.3 permit node 10
Info: You are overwriting this sequence.
[R1-route-policy]undo apply preferred-value
[R1]route-policy 3.3 permit node 20
Info: New Sequence of this List.
[R1-route-policy]ap
[R1-route-policy]apply lo
[R1-route-policy]apply local-preference 300
[R1-route-policy]q
[R1]bg
[R1]bgp 100
[R1-bgp]peer 10.10.3.3 route-policy 3.3 import
<R1>display bgp routing-tableBGP Local router ID is 192.168.12.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 4
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.2.2 0 100 0 200i
* i 10.10.3.3 0 100 0 200i
*>i 10.10.8.8/32 10.10.3.3 0 300 0 200i
* i 10.10.2.2 0 100 0 200i
3)比较:是本地始发的路由,还是从对等体学来的路由, 本地始发的BGP路由优于从其他对等体学习到的路由,**本地始发的路由优先级:优选手动聚合>自动聚合>network>import>从对等体学到的。
4)比较“as-path” 属性-as号越短越好。
[R1-bgp]display this
[V200R003C00]
#
bgp 100
peer 10.10.2.2 as-number 100
peer 10.10.2.2 connect-interface LoopBack0
peer 10.10.3.3 as-number 100
peer 10.10.3.3 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 10.10.2.2 enable
peer 10.10.3.3 enable
#
return
[R1-bgp]display bgp routing-tableBGP Local router ID is 192.168.12.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 4
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.2.2 0 100 0 200i
* i 10.10.3.3 0 100 0 200i
*>i 10.10.8.8/32 10.10.2.2 0 100 0 200i
* i 10.10.3.3 0 100 0 200i
[R1]route-policy 3.3 permit node 10
Info: You are overwriting this sequence.
[R1-route-policy]undo apply local-preference
[R1-route-policy]apply as-path 300 300 additive
[R1-bgp]peer 10.10.2.2 route-policy 3.3 import
<R1>display bgp routing-tableBGP Local router ID is 192.168.12.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 4
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.3.3 0 100 0 200i
* i 10.10.2.2 0 100 0 300 300 20
0i
*>i 10.10.8.8/32 10.10.2.2 0 300 0 200i
* i 10.10.3.3 0 100 0 200i
<R1>
5)比较“起源属性”-指的是已什么方式注入进BGP协议的。
Origin : i - IGP, e - EGP, ? - incomplete
[R2-route-policy]apply origin ?
egp Remote EGP
igp Local IGP
incomplete Unknown heritage
[R2-route-policy]apply origin
Origin : i - IGP, e - EGP, ? - incomplete (优先级)
&:IGP:优先级高,通过network命令注入到BGP路由表的路由,其Origin属性为'i'。
&: e - EGP : 次优的,
&:Incomplete:优先级低,如:通过import-route注入的路由,其Origin属性为 '?'。
<R2>sys
Enter system view, return user view with Ctrl+Z.
[R2]ip ip-prefix 4.4 permit 10.10.4.4 32
[R2]route-policy 4.4 permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix 4.4
[R2-route-policy]apply origin incomplete
[R2-bgp]peer 10.10.1.1 route-policy 4.4 export
[R2-bgp]display bgp routing-tableBGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.24.4 0 0 200i
*> 10.10.8.8/32 192.168.24.4 0 0 200i
[R1]bgp 100
[R1-bgp]undo peer 10.10.2.2 route-policy 3.3 import
[R1-bgp]q
[R1]undo route-policy 3.3
[R1]display bgp routing-tableBGP Local router ID is 192.168.12.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 4
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.2.2 0 100 0 200i
* i 10.10.3.3 0 100 0 200i
*>i 10.10.8.8/32 10.10.2.2 0 100 0 200i
* i 10.10.3.3 0 100 0 200i
[R1]ip ip-p
[R1]ip ip-prefix 4.4 pe
[R1]ip ip-prefix 4.4 permit 10.10.4.4 32
[R1]un
[R1]undo ip ip-prefix 4.4 permit 10.10.4.4 32
<R1>display bgp routing-tableBGP Local router ID is 192.168.12.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 3
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.3.3 0 100 0 200i
* i 10.10.2.2 0 100 0 200?
*>i 10.10.8.8/32 10.10.3.3 0 100 0 200i
<R1>display bgp routing-table 10.10.4.4BGP local router ID : 192.168.12.1Local AS number : 100Paths: 2 available, 1 best, 1 selectBGP routing table entry information of 10.10.4.4/32:From: 10.10.3.3 (3.3.3.3)Route Duration: 00h13m25s Relay IP Nexthop: 192.168.13.3Relay IP Out-Interface: GigabitEthernet0/0/1Original nexthop: 10.10.3.3Qos information : 0x0AS-path 200, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, bes
t, select, active, pre 255, IGP cost 1Not advertised to any peer yetBGP routing table entry information of 10.10.4.4/32:From: 10.10.2.2 (2.2.2.2)Route Duration: 00h01m02s Relay IP Nexthop: 192.168.12.2Relay IP Out-Interface: GigabitEthernet0/0/0Original nexthop: 10.10.2.2Qos information : 0x0AS-path 200, origin incomplete, MED 0, localpref 100, pref-val 0, valid, intern
al, pre 255, IGP cost 1, not preferred for OriginNot advertised to any peer yet<R1>
6)比较“MED”属性,指的是一个路由器去往一个BGP路由网段的距离,类似cost。
第一步:在R2中删除调用
[R2-bgp]undo peer 10.10.1.1 route-policy 4.4 export第二步:验证R1的路由表:检查是否恢复默认
[R1]dis bgp routing-table Total Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.2.2 0 100 0 200i* i 10.10.3.3 0 100 0 200i第三步:在R2中-进入路由策略,删除修改的起源属性值
[R2]route-policy 4.4 permit node 10
[R2-route-policy]undo apply origin //删除修改的起源属性值,恢复默认[R2-route-policy]apply cost 999 //修改路由的MED属性值为999第四步:在R2中调用路由策略
[R2]bgp 100
[R2-bgp]peer 10.10.1.1 route-policy 4.4 export //R2在给R1发路由的时候,在出方向修改路由的MED值为999第五步:验证结果
<R1>display bgp routing-table Total Number of Routes: 2Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.3.3 0 100 0 200i* i 10.10.2.2 999 100 0 200i
7)比较EBGP邻居优先于IBGP邻居,-EBGP路由优先级高于IBGP路由。
8)比较“去往BGP路由的下一跳IP地址”的cost开销值-越小越好。
—如果前面8条选路规则无法选出最优的路由,我们就可以做负载均衡了
备注:AS号一致, 在要负载均衡的那台设备上开启负载均衡功能
9)比较“cluster-list”的长度,越短越好。反射器
10)比较Router ID(Orginator_ID)的大小,越小越好。
R2
<R2>dis
<R2>display bg
<R2>display bgp r
<R2>display bgp routing-tableBGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.24.4 0 0 200i
*> 10.10.8.8/32 192.168.24.4 0 0 200i
[R2-bgp]router-id 8.8.8.8[R2-bgp]display bgp routing-table
BGP Local router ID is 8.8.8.8
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn*> 10.10.4.4/32 192.168.24.4 0 0 200i
*> 10.10.8.8/32 192.168.24.4 0 0 200i
R1
[R1]display bgp routing-tableBGP Local router ID is 192.168.12.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 4
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.2.2 0 100 0 200i
* i 10.10.3.3 0 100 0 200i
*>i 10.10.8.8/32 10.10.2.2 0 100 0 200i
* i 10.10.3.3 0 100 0 200i
[R1]display bgp routing-table
Total Number of Routes: 4
Network NextHop MED LocPrf PrefVal Path/Ogn*>i 10.10.4.4/32 10.10.3.3 0 100 0 200i
* i 10.10.2.2 0 100 0 200i
*>i 10.10.8.8/32 10.10.3.3 0 100 0 200i
* i 10.10.2.2 0 100 0 200i
[R1]display bgp routing-table 10.10.4.4BGP local router ID : 192.168.12.1 //bgp的ip地址 192.168.12.1
Local AS number : 100 //领据号 100
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 10.10.4.4/32:
From: 10.10.3.3 (3.3.3.3)
Route Duration: 00h14m46s
Relay IP Nexthop: 192.168.13.3
Relay IP Out-Interface: GigabitEthernet0/0/1
Original nexthop: 10.10.3.3
Qos information : 0x0
AS-path 200, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, bes
t, select, active, pre 255, IGP cost 1
Not advertised to any peer yetBGP routing table entry information of 10.10.4.4/32:
From: 10.10.2.2 (8.8.8.8)
Route Duration: 00h00m52s
Relay IP Nexthop: 192.168.12.2
Relay IP Out-Interface: GigabitEthernet0/0/0
Original nexthop: 10.10.2.2
Qos information : 0x0
AS-path 200, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre
255, IGP cost 1, not preferred for router ID
Not advertised to any peer yet
11)比较“peer 后面的IP地址的大小”,越小越好
这篇关于08 BGP 华为官方文档 十一条选路原则的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!