PG1X

My Knowledge Base

User Tools

Site Tools


tech:network:cisco:bgp:bgp:weight:weight

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tech:network:cisco:bgp:bgp:weight:weight [2019/01/27 11:07]
wnoguchi
tech:network:cisco:bgp:bgp:weight:weight [2019/02/10 06:51] (current)
wnoguchi
Line 194: Line 194:
   - filter-list   - filter-list
  
-==== configure weight by neighbor ====+==== configure weight by neighbor ====
  
   * R1   * R1
Line 483: Line 483:
 </​code>​ </​code>​
  
-==== configure weight by route-map ACL ====+==== configure weight by route-map ACL ====
  
   * R1   * R1
Line 713: Line 713:
 </​code>​ </​code>​
  
-==== configure weight by route-map ip prefix-list ====+==== configure weight by route-map ip prefix-list ====
  
   * R1   * R1
Line 721: Line 721:
 configure terminal configure terminal
 ! !
-ip prefix-list PRE-R4 permit 40.0.0.0 ​0.0.255.255+ip prefix-list PRE-R4 permit 40.0.0.0/16
 ! !
 route-map R-WEIGHT-R2 permit 10 route-map R-WEIGHT-R2 permit 10
-match ip prefix-list PRE-R4 +match ip address ​prefix-list PRE-R4 
-set weight ​100+set weight ​345
 exit exit
 route-map R-WEIGHT-R2 permit 20 route-map R-WEIGHT-R2 permit 20
Line 731: Line 731:
 ! !
 route-map R-WEIGHT-R3 permit 10 route-map R-WEIGHT-R3 permit 10
-match ip prefix-list PRE-R4 +match ip address ​prefix-list PRE-R4 
-set weight ​200+set weight ​123
 exit exit
 route-map R-WEIGHT-R3 permit 20 route-map R-WEIGHT-R3 permit 20
Line 745: Line 745:
 </​code>​ </​code>​
  
-==== configure weight by route-map as-path ====+<​code>​ 
 +sh ip bgp 
 +clear ip bgp * soft in 
 +sh ip bgp 
 +ping 40.0.0.4 source 100.0.0.1 
 +traceroute 40.0.0.4 source 100.0.0.1 
 +</​code>​ 
 + 
 +==== configure weight by route-map as-path ====
  
   * R1   * R1
Line 758: Line 766:
 route-map R-WEIGHT-R2 permit 10 route-map R-WEIGHT-R2 permit 10
 match as-path 1 match as-path 1
-set weight ​100+set weight ​111
 exit exit
 route-map R-WEIGHT-R2 permit 20 route-map R-WEIGHT-R2 permit 20
Line 765: Line 773:
 route-map R-WEIGHT-R3 permit 10 route-map R-WEIGHT-R3 permit 10
 match as-path 2 match as-path 2
-set weight ​200+set weight ​222
 exit exit
 route-map R-WEIGHT-R3 permit 20 route-map R-WEIGHT-R3 permit 20
Line 778: Line 786:
 </​code>​ </​code>​
  
-==== configure weight by filter-list ? ====+<​code>​ 
 +! before 
 +sh ip bgp 
 +ping 40.0.0.4 source 100.0.0.1 
 +traceroute 40.0.0.4 source 100.0.0.1 
 +clear ip bgp * soft in 
 +! after 
 +sh ip bgp 
 +ping 40.0.0.4 source 100.0.0.1 
 +traceroute 40.0.0.4 source 100.0.0.1 
 +</​code>​ 
 + 
 +<​code>​ 
 +R1#conf t 
 +Enter configuration commands, one per line.  End with CNTL/Z. 
 +R1(config)#​ip as-path acc 
 +R1(config)#​ip as-path access-list 1 permi 
 +R1(config)#​ip as-path access-list 1 permit ^20_ 
 +R1(config)#​ip as-pa                             
 +R1(config)#​ip as-path acc 
 +R1(config)#​ip as-path access-list 2 permi 
 +R1(config)#​ip as-path access-list 2 permit ^30_ 
 +R1(config)#​route-ma 
 +R1(config)#​route-map R-WEIGHT-R2 permit 10  
 +R1(config-route-map)#​mat 
 +R1(config-route-map)#​match as-pa 
 +R1(config-route-map)#​match as-path 1 
 +R1(config-route-map)#​do sh ip bgp 
 +BGP table version is 3, local router ID is 100.0.0.1 
 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  
 +              r RIB-failure,​ S Stale, m multipath, b backup-path,​ f RT-Filter,  
 +              x best-external,​ a additional-path,​ c RIB-compressed,​  
 +Origin codes: i - IGP, e - EGP, ? - incomplete 
 +RPKI validation codes: V valid, I invalid, N Not found 
 + 
 +     ​Network ​         Next Hop            Metric LocPrf Weight Path 
 + ​* ​  ​40.0.0.0/​16 ​     1.3.0.3 ​                               0 30 40 i 
 + ​*> ​                  ​1.2.0.2 ​                               0 20 40 i 
 + ​*> ​ 100.0.0.0/​16 ​    ​0.0.0.0 ​                 0         32768 i 
 +R1(config-route-map)#​set weight 111 
 +R1(config-route-map)#​exit 
 +R1(config)#​route-map R-WEIGHT-R2 permit 20 
 +R1(config-route-map)#​route-map R-WEIGHT-R3 permit 10 
 +R1(config-route-map)#​match as 
 +R1(config-route-map)#​match as-path 2 
 +R1(config-route-map)#​set wei 
 +R1(config-route-map)#​set weight 222 
 +R1(config-route-map)#​route-map R-WEIGHT-R3 permit 20 
 +R1(config-route-map)#​router bgp 10 
 +R1(config-router)#​neighbor 1.2.0.2 route- 
 +R1(config-router)#​neighbor 1.2.0.2 route-ma 
 +R1(config-router)#​neighbor 1.2.0.2 route-map R-WEIGHT-R2 in 
 +R1(config-router)#​neigh 
 +R1(config-router)#​neighbor 1.3.0.3 route-map R-WEIGHT-R3 in 
 +R1(config-router)#​^Z 
 +R1# 
 +*Feb 10 06:​28:​41.376:​ %SYS-5-CONFIG_I:​ Configured from console by console 
 +R1#sh ip bgp 
 +BGP table version is 3, local router ID is 100.0.0.1 
 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  
 +              r RIB-failure,​ S Stale, m multipath, b backup-path,​ f RT-Filter,  
 +              x best-external,​ a additional-path,​ c RIB-compressed,​  
 +Origin codes: i - IGP, e - EGP, ? - incomplete 
 +RPKI validation codes: V valid, I invalid, N Not found 
 + 
 +     ​Network ​         Next Hop            Metric LocPrf Weight Path 
 + ​* ​  ​40.0.0.0/​16 ​     1.3.0.3 ​                               0 30 40 i 
 + ​*> ​                  ​1.2.0.2 ​                               0 20 40 i 
 + ​*> ​ 100.0.0.0/​16 ​    ​0.0.0.0 ​                 0         32768 i 
 +R1#ping 40.0.0.4 source 100.0.0.1 
 +Type escape sequence to abort. 
 +Sending 5, 100-byte ICMP Echos to 40.0.0.4, timeout is 2 seconds: 
 +Packet sent with a source address of 100.0.0.1  
 +!!!!! 
 +Success rate is 100 percent (5/5), round-trip min/​avg/​max ​5/5/8 ms 
 +R1#​traceroute 40.0.0.4 source 100.0.0.1 
 +Type escape sequence to abort. 
 +Tracing the route to 40.0.0.4 
 +VRF info: (vrf in name/id, vrf out name/id) 
 +  1 1.2.0.2 5 msec 4 msec 4 msec 
 +  2 2.4.0.4 5 msec 6 msec 5 msec 
 +R1#clear ip bgp * soft in 
 +R1#sh ip bgp 
 +BGP table version is 5, local router ID is 100.0.0.1 
 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  
 +              r RIB-failure,​ S Stale, m multipath, b backup-path,​ f RT-Filter,  
 +              x best-external,​ a additional-path,​ c RIB-compressed,​  
 +Origin codes: i - IGP, e - EGP, ? - incomplete 
 +RPKI validation codes: V valid, I invalid, N Not found 
 + 
 +     ​Network ​         Next Hop            Metric LocPrf Weight Path 
 + ​*> ​ 40.0.0.0/​16 ​     1.3.0.3 ​                             222 30 40 i 
 + ​* ​                   1.2.0.2 ​                             111 20 40 i 
 + ​*> ​ 100.0.0.0/​16 ​    ​0.0.0.0 ​                 0         32768 i 
 +R1#ping 40.0.0.4 source 100.0.0.1 
 +Type escape sequence to abort. 
 +Sending 5, 100-byte ICMP Echos to 40.0.0.4, timeout is 2 seconds: 
 +Packet sent with a source address of 100.0.0.1  
 +!!!!! 
 +Success rate is 100 percent (5/5), round-trip min/​avg/​max ​4/4/5 ms 
 +R1#​traceroute 40.0.0.4 sour 
 +R1#​traceroute 40.0.0.4 source 100.0.0.1 
 +Type escape sequence to abort. 
 +Tracing the route to 40.0.0.4 
 +VRF info: (vrf in name/id, vrf out name/id) 
 +  1 1.3.0.3 5 msec 5 msec 5 msec 
 +  2 3.4.0.4 5 msec 7 msec 5 msec 
 +R1# 
 +</​code>​ 
 + 
 +==== ✗configure weight by filter-list ? ====
  
 I'm not sure following configuration is correct... I'm not sure following configuration is correct...
 +
 +where is filter-list,​ route-map take effect...?
  
   * R1   * R1
Line 793: Line 913:
 router bgp 10 router bgp 10
 neighbor 1.2.0.2 filter-list 1 in neighbor 1.2.0.2 filter-list 1 in
-neighbor 1.2.0.2 weight ​100+neighbor 1.2.0.2 weight ​321
 neighbor 1.3.0.3 rfilter-list 2 in neighbor 1.3.0.3 rfilter-list 2 in
-neighbor 1.2.0.weight ​200+neighbor 1.2.0.weight ​876
 exit exit
 ! !
Line 801: Line 921:
 </​code>​ </​code>​
  
 +<​code>​
 +! before
 +sh ip bgp
 +ping 40.0.0.4 source 100.0.0.1
 +traceroute 40.0.0.4 source 100.0.0.1
 +clear ip bgp * soft in
 +! after
 +sh ip bgp
 +ping 40.0.0.4 source 100.0.0.1
 +traceroute 40.0.0.4 source 100.0.0.1
 +</​code>​
  
 +<​code>​
 +R1#conf t
 +Enter configuration commands, one per line.  End with CNTL/Z.
 +R1(config)#​ip as-pa
 +R1(config)#​ip as-path acc
 +R1(config)#​ip as-path access-list 1 permi
 +R1(config)#​ip as-path access-list 1 permit ^20_
 +R1(config)#​ip as
 +R1(config)#​ip as-path acc
 +R1(config)#​ip as-path access-list 2 permi
 +R1(config)#​ip as-path access-list 2 permit ^30_
 +R1(config)#​router bgp 10
 +R1(config-router)#​neigh
 +R1(config-router)#​neighbor 1.2.0.2 fil
 +R1(config-router)#​neighbor 1.2.0.2 filter-list 1 ?
 +  in   ​Filter incoming routes
 +  out  Filter outgoing routes
 +
 +R1(config-router)#​neighbor 1.2.0.2 filter-list ?   
 +  <​1-500> ​ AS path access list
 +
 +R1(config-router)#​neighbor 1.2.0.2 filter-list 1 ?
 +  in   ​Filter incoming routes
 +  out  Filter outgoing routes
 +
 +R1(config-router)#​neighbor 1.2.0.2 filter-list 1 in ?
 +  <cr>
 +
 +R1(config-router)#​neighbor 1.2.0.2 filter-list ?    ​
 +  <​1-500> ​ AS path access list
 +
 +R1(config-router)#​neighbor 1.2.0.2 filter-list 1 R-WEIGHT-R2 in
 +                                                 ^
 +% Invalid input detected at '​^'​ marker.
 +
 +R1(config-router)#​neighbor 1.2.0.2 filter-list 1 in            ​
 +R1(config-router)#​neigh
 +R1(config-router)#​do sh ip bgp       
 +BGP table version is 3, local router ID is 100.0.0.1
 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, ​
 +              r RIB-failure,​ S Stale, m multipath, b backup-path,​ f RT-Filter, ​
 +              x best-external,​ a additional-path,​ c RIB-compressed, ​
 +Origin codes: i - IGP, e - EGP, ? - incomplete
 +RPKI validation codes: V valid, I invalid, N Not found
 +
 +     ​Network ​         Next Hop            Metric LocPrf Weight Path
 + ​*> ​ 40.0.0.0/​16 ​     1.2.0.2 ​                               0 20 40 i
 + ​* ​                   1.3.0.3 ​                               0 30 40 i
 + ​*> ​ 100.0.0.0/​16 ​    ​0.0.0.0 ​                 0         32768 i
 +R1(config-router)#​neigh
 +R1(config-router)#​neighbor 1.2.0.2 wei
 +R1(config-router)#​neighbor 1.2.0.2 weight 321
 +R1(config-router)#​nei
 +R1(config-router)#​neighbor 1.2.0.2 wei
 +R1(config-router)#​neighbor 1.3.0.3 nei    ​
 +R1(config-router)#​neighbor 1.3.0.3 filter
 +R1(config-router)#​neighbor 1.3.0.3 filter-list 2 in
 +R1(config-router)#​neg
 +R1(config-router)#​nei
 +R1(config-router)#​neighbor 1.3.0.3 wei
 +R1(config-router)#​neighbor 1.3.0.3 weight 876
 +R1(config-router)#​^Z
 +R1#
 +*Feb 10 06:​47:​42.303:​ %SYS-5-CONFIG_I:​ Configured from console by console
 +R1#sh ip bgp
 +BGP table version is 3, local router ID is 100.0.0.1
 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, ​
 +              r RIB-failure,​ S Stale, m multipath, b backup-path,​ f RT-Filter, ​
 +              x best-external,​ a additional-path,​ c RIB-compressed, ​
 +Origin codes: i - IGP, e - EGP, ? - incomplete
 +RPKI validation codes: V valid, I invalid, N Not found
 +
 +     ​Network ​         Next Hop            Metric LocPrf Weight Path
 + ​*> ​ 40.0.0.0/​16 ​     1.2.0.2 ​                               0 20 40 i
 + ​* ​                   1.3.0.3 ​                               0 30 40 i
 + ​*> ​ 100.0.0.0/​16 ​    ​0.0.0.0 ​                 0         32768 i
 +R1#ping 40.0.0.4 source 100.0.0.1
 +Type escape sequence to abort.
 +Sending 5, 100-byte ICMP Echos to 40.0.0.4, timeout is 2 seconds:
 +Packet sent with a source address of 100.0.0.1 ​
 +!!!!!
 +Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/7 ms
 +R1#source 40.0.0.4 source 100.0.0.1
 +     ^
 +% Invalid input detected at '​^'​ marker.
 +
 +R1#​traceroute 40.0.0.4 source 100.0.0.1
 +Type escape sequence to abort.
 +Tracing the route to 40.0.0.4
 +VRF info: (vrf in name/id, vrf out name/id)
 +  1 1.2.0.2 5 msec 4 msec 3 msec
 +  2 2.4.0.4 6 msec 5 msec 6 msec
 +R1#clear ip bgp * soft in
 +R1#sh ip bgp
 +BGP table version is 4, local router ID is 100.0.0.1
 +Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, ​
 +              r RIB-failure,​ S Stale, m multipath, b backup-path,​ f RT-Filter, ​
 +              x best-external,​ a additional-path,​ c RIB-compressed, ​
 +Origin codes: i - IGP, e - EGP, ? - incomplete
 +RPKI validation codes: V valid, I invalid, N Not found
 +
 +     ​Network ​         Next Hop            Metric LocPrf Weight Path
 + ​* ​  ​40.0.0.0/​16 ​     1.2.0.2 ​                             321 20 40 i
 + ​*> ​                  ​1.3.0.3 ​                             876 30 40 i
 + ​*> ​ 100.0.0.0/​16 ​    ​0.0.0.0 ​                 0         32768 i
 +R1#ping 40.0.0.4 source 100.0.0.1
 +Type escape sequence to abort.
 +Sending 5, 100-byte ICMP Echos to 40.0.0.4, timeout is 2 seconds:
 +Packet sent with a source address of 100.0.0.1 ​
 +!!!!!
 +Success rate is 100 percent (5/5), round-trip min/avg/max = 5/6/7 ms
 +R1#​traceroute 40.0.0.4 source 100.0.0.1
 +Type escape sequence to abort.
 +Tracing the route to 40.0.0.4
 +VRF info: (vrf in name/id, vrf out name/id)
 +  1 1.3.0.3 6 msec 5 msec 3 msec
 +  2 3.4.0.4 4 msec 6 msec 7 msec
 +R1#
 +</​code>​
  
 ===== References ===== ===== References =====
tech/network/cisco/bgp/bgp/weight/weight.txt · Last modified: 2019/02/10 06:51 by wnoguchi