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

相关文章

【前端学习】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描述 然后我就把参数标签换过来

总有一条路,我们很迷茫

十年前,我家还处于一个贫穷落后的小山村,周围的人会根据我父母的收入来对待我,而十年后的今天,我家的那座小山村医成为重点开发的地区,一夜之间我家成了所谓的土豪,周围的人依然根据我家的收入对待我。现实,什么是现实?这就是现实。从那一刻,我开始明白要想得到别人的尊重,首先你得有别人尊重的实力。 所以,这么多年来不管自己过得多累,走得多艰辛,我都会一直坚持。在人生前进的道路,我们总会经历风雨,难免感到迷

计算机毕业设计 大学志愿填报系统 Java+SpringBoot+Vue 前后端分离 文档报告 代码讲解 安装调试

🍊作者:计算机编程-吉哥 🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。 🍊心愿:点赞 👍 收藏 ⭐评论 📝 🍅 文末获取源码联系 👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~Java毕业设计项目~热门选题推荐《1000套》 目录 1.技术选型 2.开发工具 3.功能

JVM内存调优原则及几种JVM内存调优方法

JVM内存调优原则及几种JVM内存调优方法 1、堆大小设置。 2、回收器选择。   1、在对JVM内存调优的时候不能只看操作系统级别Java进程所占用的内存,这个数值不能准确的反应堆内存的真实占用情况,因为GC过后这个值是不会变化的,因此内存调优的时候要更多地使用JDK提供的内存查看工具,比如JConsole和Java VisualVM。   2、对JVM内存的系统级的调优主要的目的是减少

828华为云征文|华为云Flexus X实例docker部署rancher并构建k8s集群

828华为云征文|华为云Flexus X实例docker部署rancher并构建k8s集群 华为云最近正在举办828 B2B企业节,Flexus X实例的促销力度非常大,特别适合那些对算力性能有高要求的小伙伴。如果你有自建MySQL、Redis、Nginx等服务的需求,一定不要错过这个机会。赶紧去看看吧! 什么是华为云Flexus X实例 华为云Flexus X实例云服务是新一代开箱即用、体

Adblock Plus官方规则Easylist China说明与反馈贴(2015.12.15)

-------------------------------特别说明--------------------------------------- 视频广告问题:因Adblock Plus的局限,存在以下现象,优酷、搜狐、17173黑屏并倒数;乐视、爱奇艺播放广告。因为这些视频网站的Flash播放器被植入了检测代码,而Adblock Plus无法修改播放器。 如需同时使用ads

Python脚本:TXT文档行数统计

count = 0 #计数变量file_dirs = input('请输入您要统计的文件根路径:')filename = open(file_dirs,'r') #以只读方式打开文件file_contents = filename.read() #读取文档内容到file_contentsfor file_content in file_contents:

bcolz文档

原文:http://bcolz.blosc.org/en/latest/reference.html First level variables bcolz.__version__'''bcolz包的版本。''' bcolz.dask_here'''是否检测到dask的最低版本。''' bcolz.min_dask_version'''需要dask的最低版本(dask是可选

Science|癌症中三级淋巴结构的免疫调节作用与治疗潜力|顶刊精析·24-09-08

小罗碎碎念 Science文献精析 今天精析的这一篇综述,于2022-01-07发表于Science,主要讨论了癌症中的三级淋巴结构(Tertiary Lymphoid Structures, TLS)及其在肿瘤免疫反应中的作用。 作者类型作者姓名单位名称(中文)通讯作者介绍第一作者Ton N. Schumacher荷兰癌症研究所通讯作者之一通讯作者Daniela S. Thomm