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地址的大小”,越小越好

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/433040.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

IP报文格式

IP报文格式 报文格式 图1 IP头格式 表1 IP头字段解释 字段长度含义Version4比特 4&#xff1a;表示为IPV4&#xff1b;6&#xff1a;表示为IPV6。IHL4比特首部长度&#xff0c;如果不带Option字段&#xff0c;则为20&#xff0c;最长为60&#xff0c;该值限制了记录路由选项。…

EXCEL VBA抓取网页JSON数据并解析

EXCEL VBA抓取网页JSON数据并解析 链接地址&#xff1a; https://api.api68.com/CQShiCai/getBaseCQShiCaiList.do?lotCode10036&date2024-01-26 Sub test() On Error Resume Next Sheet.Select Sheet1.Cells.ClearContents [a1:g1] Split("preDrawIssue|preDrawTi…

Ps:图层组

建立图层组 Layer Group有助于组织和管理图层。 可将图层组理解为一个可装有多个图层的容器&#xff0c;与文件夹的概念类似&#xff0c;也能构成树状结构&#xff0c;即&#xff0c;图层组里还可以嵌套图层组。 ◆ ◆ ◆ 图层组的基本操作 新建图层组 New Group Ps菜单&…

pytorch 实现中文文本分类

&#x1f368; 本文为[&#x1f517;365天深度学习训练营学习记录博客&#x1f366; 参考文章&#xff1a;365天深度学习训练营&#x1f356; 原作者&#xff1a;[K同学啊 | 接辅导、项目定制]\n&#x1f680; 文章来源&#xff1a;[K同学的学习圈子](https://www.yuque.com/mi…

RUST笔记:candle使用基础

candle介绍 candle是huggingface开源的Rust的极简 ML 框架。 candle-矩阵乘法示例 cargo new myapp cd myapp cargo add --git https://github.com/huggingface/candle.git candle-core cargo build # 测试&#xff0c;或执行 cargo ckeckmain.rs use candle_core::{Device…

小程序系列--14.小程序分包

一、基础概念 1. 什么是分包 分包指的是把一个完整的小程序项目&#xff0c;按照需求划分为不同的子包&#xff0c;在构建时打包成不同的分包&#xff0c;用户在使用时按需进行加载。 2. 分包的好处 3. 分包前项目的构成 4. 分包后项目的构成 5. 分包的加载规则 6. 分包的…

单片机学习笔记---矩阵键盘密码锁

目录 一&#xff0c;设置密码按键 1.设置密码区域 2.设置输入的数字左移 3.设置记录按键的次数 二&#xff0c;设置确认键 1.密码正确时显示OK 2.密码错误时显示ERR 3.密码错误恢复初始状态重输 三&#xff0c;设置取消键 学了这么久&#xff0c;迫不及待想要做一个密…

LabVIEW振动信号分析

LabVIEW振动信号分析 介绍如何使用LabVIEW软件实现希尔伯特-黄变换&#xff08;Hilbert-Huang Transform, HHT&#xff09;&#xff0c;并将其应用于振动信号分析。HHT是一种用于分析非线性、非平稳信号的强大工具&#xff0c;特别适用于旋转机械等复杂系统的振动分析。开发了…

navicat导入数据复盘

目标场景&#xff1a; 整个省的数据总数量240万&#xff0c;查询效率极差&#xff0c;所以急需要处理 问题一:将表备份cv出来一份 复制时间极长&#xff0c;伴随着报错终于复制完了&#xff0c;并且数据量出现问题了&#xff0c;大致上翻了一倍&#xff0c;好几次都是这样&am…

uniapp状态管理Vuex介绍及vuex核心概念

状态管理Vuex Vuex 是什么&#xff1f; Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式。它采用集中式存储管理应用的所有组件的状态&#xff0c;并以相应的规则保证状态以一种可预测的方式发生变化。 uni-app 内置了 Vuex 什么是“状态管理模式”&#xff1f; <!…

Git初识

&#x1f4d9; 作者简介 &#xff1a;RO-BERRY &#x1f4d7; 学习方向&#xff1a;致力于C、C、数据结构、TCP/IP、数据库等等一系列知识 &#x1f4d2; 日后方向 : 偏向于CPP开发以及大数据方向&#xff0c;欢迎各位关注&#xff0c;谢谢各位的支持 在学习Git之前我们先引入一…

EMQX 单机及集群搭建

目录 1. 通过 Yum 源安装&#xff08;CentOS7 单机安装&#xff09; 1.1. 通过以下命令配置 EMQX Yum 源&#xff1a; 1.2. 运行以下命令安装 EMQX&#xff1a; 1.3. 运行以下命令启动 EMQX&#xff1a; 1.4. 访问 http://192.168.88.130:18083&#xff0c;默认用户名: adm…