08 BGP 华为官方文档 十一条选路原则

2024-01-27 05:28

本文主要是介绍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 : 2

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv

  192.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-table 

 BGP 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.4

 BGP 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 yet

 BGP 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-table 

 BGP 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-table 

 BGP 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-table 

 BGP 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-table 

 BGP 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-table 

 BGP 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-table 

 BGP 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-table 

 BGP 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-table

 BGP 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.4

 BGP 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 yet

 BGP 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 华为官方文档 十一条选路原则的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/649174

相关文章

Python自动化Office文档处理全攻略

《Python自动化Office文档处理全攻略》在日常办公中,处理Word、Excel和PDF等Office文档是再常见不过的任务,手动操作这些文档不仅耗时耗力,还容易出错,幸运的是,Python提供... 目录一、自动化处理Word文档1. 安装python-docx库2. 读取Word文档内容3. 修改

定价129元!支持双频 Wi-Fi 5的华为AX1路由器发布

《定价129元!支持双频Wi-Fi5的华为AX1路由器发布》华为上周推出了其最新的入门级Wi-Fi5路由器——华为路由AX1,建议零售价129元,这款路由器配置如何?详细请看下文介... 华为 Wi-Fi 5 路由 AX1 已正式开售,新品支持双频 1200 兆、配有四个千兆网口、提供可视化智能诊断功能,建

使用Python快速实现链接转word文档

《使用Python快速实现链接转word文档》这篇文章主要为大家详细介绍了如何使用Python快速实现链接转word文档功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 演示代码展示from newspaper import Articlefrom docx import

浅析如何使用Swagger生成带权限控制的API文档

《浅析如何使用Swagger生成带权限控制的API文档》当涉及到权限控制时,如何生成既安全又详细的API文档就成了一个关键问题,所以这篇文章小编就来和大家好好聊聊如何用Swagger来生成带有... 目录准备工作配置 Swagger权限控制给 API 加上权限注解查看文档注意事项在咱们的开发工作里,API

Mybatis官方生成器的使用方式

《Mybatis官方生成器的使用方式》本文详细介绍了MyBatisGenerator(MBG)的使用方法,通过实际代码示例展示了如何配置Maven插件来自动化生成MyBatis项目所需的实体类、Map... 目录1. MyBATis Generator 简介2. MyBatis Generator 的功能3

SpringBoot3集成swagger文档的使用方法

《SpringBoot3集成swagger文档的使用方法》本文介绍了Swagger的诞生背景、主要功能以及如何在SpringBoot3中集成Swagger文档,Swagger可以帮助自动生成API文档... 目录一、前言1. API 文档自动生成2. 交互式 API 测试3. API 设计和开发协作二、使用

你的华为手机升级了吗? 鸿蒙NEXT多连推5.0.123版本变化颇多

《你的华为手机升级了吗?鸿蒙NEXT多连推5.0.123版本变化颇多》现在的手机系统更新可不仅仅是修修补补那么简单了,华为手机的鸿蒙系统最近可是动作频频,给用户们带来了不少惊喜... 为了让用户的使用体验变得很好,华为手机不仅发布了一系列给力的新机,还在操作系统方面进行了疯狂的发力。尤其是近期,不仅鸿蒙O

基于C#实现将图片转换为PDF文档

《基于C#实现将图片转换为PDF文档》将图片(JPG、PNG)转换为PDF文件可以帮助我们更好地保存和分享图片,所以本文将介绍如何使用C#将JPG/PNG图片转换为PDF文档,需要的可以参考下... 目录介绍C# 将单张图片转换为PDF文档C# 将多张图片转换到一个PDF文档介绍将图片(JPG、PNG)转

【前端学习】AntV G6-08 深入图形与图形分组、自定义节点、节点动画(下)

【课程链接】 AntV G6:深入图形与图形分组、自定义节点、节点动画(下)_哔哩哔哩_bilibili 本章十吾老师讲解了一个复杂的自定义节点中,应该怎样去计算和绘制图形,如何给一个图形制作不间断的动画,以及在鼠标事件之后产生动画。(有点难,需要好好理解) <!DOCTYPE html><html><head><meta charset="UTF-8"><title>06

活用c4d官方开发文档查询代码

当你问AI助手比如豆包,如何用python禁止掉xpresso标签时候,它会提示到 这时候要用到两个东西。https://developers.maxon.net/论坛搜索和开发文档 比如这里我就在官方找到正确的id描述 然后我就把参数标签换过来