enable configure terminal ! hostname R1 no ip domain-lookup line console 0 exec-timeout 0 0 logging synchronous exit ! interface Loopback 1 ip address 100.0.0.1 255.255.0.0 no shutdown exit interface GigabitEthernet 0/0 ip address 1.2.0.1 255.255.255.0 no shutdown exit interface GigabitEthernet 0/1 ip address 1.3.0.1 255.255.255.0 no shutdown exit ! end write
enable configure terminal ! hostname R2 no ip domain-lookup line console 0 exec-timeout 0 0 logging synchronous exit ! interface GigabitEthernet 0/0 ip address 2.4.0.2 255.255.255.0 no shutdown exit interface GigabitEthernet 0/1 ip address 1.2.0.2 255.255.255.0 no shutdown exit ! end write
enable configure terminal ! hostname R3 no ip domain-lookup line console 0 exec-timeout 0 0 logging synchronous exit ! interface GigabitEthernet 0/0 ip address 1.3.0.3 255.255.255.0 no shutdown exit interface GigabitEthernet 0/1 ip address 3.4.0.3 255.255.255.0 no shutdown exit ! end write
enable configure terminal ! hostname R4 no ip domain-lookup line console 0 exec-timeout 0 0 logging synchronous exit ! interface Loopback 1 ip address 40.0.0.4 255.255.0.0 no shutdown exit interface GigabitEthernet 0/0 ip address 3.4.0.4 255.255.255.0 no shutdown exit interface GigabitEthernet 0/1 ip address 2.4.0.4 255.255.255.0 no shutdown exit ! end write
Project name: ccna-bgp23-weight
enable configure terminal ! router bgp 10 neighbor 1.2.0.2 remote-as 20 neighbor 1.3.0.3 remote-as 30 network 100.0.0.0 mask 255.255.0.0 exit ! end write
enable configure terminal ! router bgp 20 neighbor 1.2.0.1 remote-as 10 neighbor 2.4.0.4 remote-as 40 exit ! end write
enable configure terminal ! router bgp 30 neighbor 1.3.0.1 remote-as 10 neighbor 3.4.0.4 remote-as 40 exit ! end write
enable configure terminal ! router bgp 40 neighbor 2.4.0.2 remote-as 20 neighbor 3.4.0.3 remote-as 30 network 40.0.0.0 mask 255.255.0.0 exit ! end write
enable configure terminal ! router bgp 10 neighbor 1.2.0.2 weight 100 neighbor 1.3.0.3 weight 200 exit ! end
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#sh ip ro bgp Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 40.0.0.0/16 is subnetted, 1 subnets B 40.0.0.0 [20/0] via 1.2.0.2, 23:50:35 R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#router bgp 10 R1(config-router)#neigh R1(config-router)#neighbor 1.2.0.2 wei R1(config-router)#neighbor 1.2.0.2 weight 100 R1(config-router)#nei R1(config-router)#neighbor 1.3.0.3 wei R1(config-router)#neighbor 1.3.0.3 weight 200 R1(config-router)#^Z R1# *Jan 26 05:07:50.167: %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#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#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#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#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#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#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#sh run | sec bgp 10 router bgp 10 bgp log-neighbor-changes network 100.0.0.0 mask 255.255.0.0 neighbor 1.2.0.2 remote-as 20 neighbor 1.2.0.2 weight 100 neighbor 1.3.0.3 remote-as 30 neighbor 1.3.0.3 weight 200 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#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# 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#clear ip bgp re R1#clear ip bgp ? * Clear all peers <1-4294967295> Clear peers with the AS number <1.0-XX.YY> Clear peers with the AS number A.B.C.D BGP neighbor address to clear X:X:X:X::X BGP neighbor address to clear all All address families dampening Clear route flap dampening information external Clear all external peers flap-statistics Clear route flap statistics internal Clear BGP internal statistics counters ipv4 Address family ipv6 Address family l2vpn Address family nsap Address family peer-group Clear all members of peer-group rtfilter Address family sso SSO related table-map Update BGP table-map configuration topology Routing topology instance update-group Clear all members of update-group vpnv4 Address family vpnv6 Address family R1#clear ip bgp so R1#clear ip bgp sof R1#clear ip bgp sof R1#clear ip bgp sof R1#clear ip bgp ? * Clear all peers <1-4294967295> Clear peers with the AS number <1.0-XX.YY> Clear peers with the AS number A.B.C.D BGP neighbor address to clear X:X:X:X::X BGP neighbor address to clear all All address families dampening Clear route flap dampening information external Clear all external peers flap-statistics Clear route flap statistics internal Clear BGP internal statistics counters ipv4 Address family ipv6 Address family l2vpn Address family nsap Address family peer-group Clear all members of peer-group rtfilter Address family sso SSO related table-map Update BGP table-map configuration topology Routing topology instance update-group Clear all members of update-group vpnv4 Address family vpnv6 Address family R1#clear ip bgp * so R1#clear ip bgp * soft ? in Soft reconfig inbound updates out Soft reconfig outbound updates slow Forcefully clear slow-peer status and move it to original update group <cr> 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.2.0.2 100 20 40 i *> 1.3.0.3 200 30 40 i *> 100.0.0.0/16 0.0.0.0 0 32768 i R1# R1#sh ip ro bgp Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is not set 40.0.0.0/16 is subnetted, 1 subnets B 40.0.0.0 [20/0] via 1.3.0.3, 00:00:43 R1#ping 40.0.0.4 sour 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/6 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 3 msec 3 msec 2 3.4.0.4 6 msec 5 msec 5 msec
enable configure terminal ! access-list 1 permit 40.0.0.0 0.0.255.255 ! route-map R-WEIGHT-R2 permit 10 match ip address 1 set weight 100 exit route-map R-WEIGHT-R2 permit 20 exit ! route-map R-WEIGHT-R3 permit 10 match ip address 1 set weight 200 exit route-map R-WEIGHT-R3 permit 20 exit ! router bgp 10 neighbor 1.2.0.2 route-map R-WEIGHT-R2 in neighbor 1.3.0.3 route-map R-WEIGHT-R3 in exit ! end
R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#acc R1(config)#access-list 1 per R1(config)#acc R1(config)#access-list 1 per R1(config)#access-list 1 permit 40.0.0.0 0.0.255.255 R1(config)#route-ma R1(config)#route-map R-WEIGHT-R2 permit 10 R1(config-route-map)#mat R1(config-route-map)#match ip add R1(config-route-map)#match ip address 1 R1(config-route-map)#set wei R1(config-route-map)#set weight ? <0-65535> Weight value R1(config-route-map)#set weight 100 R1(config-route-map)#route-map R-WEIGHT 20 R1(config-route-map)#route-map R-WEIGHT per R1(config-route-map)#route-map R-WEIGHT permit 20 R1(config-route-map)#do sh run | s route-map 20 R1(config-route-map)#do sh run | s route-map route-map R-WEIGHT-R2 permit 10 match ip address 1 set weight 100 route-map R-WEIGHT permit 20 R1(config-route-map)#no route-map R-WEIGHT permit 20 R1(config)#route-map R-WEIGHT-R2 per R1(config)#route-map R-WEIGHT-R2 permit ? <0-65535> Sequence to insert to/delete from existing route-map entry <cr> R1(config)#route-map R-WEIGHT-R2 ? <0-65535> Sequence to insert to/delete from existing route-map entry deny Route map denies set operations permit Route map permits set operations <cr> R1(config)#route-map R-WEIGHT-R2 per R1(config)#route-map R-WEIGHT-R2 permit ? <0-65535> Sequence to insert to/delete from existing route-map entry <cr> R1(config)#route-map R-WEIGHT-R2 permit 20 R1(config-route-map)#route-map R-WEIGHT-R3 per R1(config-route-map)#route-map R-WEIGHT-R3 permit 10 R1(config-route-map)#mat R1(config-route-map)#match ip add R1(config-route-map)#match ip address 1 R1(config-route-map)#set wei R1(config-route-map)#set weight 200 R1(config-route-map)#rout R1(config-route-map)#route- R1(config-route-map)#route-ma R1(config-route-map)#route-map R-WEIGHT-R3 permit 20 R1(config-route-map)#router bgp 10 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.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-router)#do clear ip bgp soft * in ^ % Invalid input detected at '^' marker. R1(config-router)#do clear ip bgp ? % Unrecognized command R1(config-router)#do clear b R1(config-router)#do clear bgp ? % Unrecognized command R1(config-router)#do clear ? % Unrecognized command R1(config-router)#do cl>? % Unrecognized command R1(config-router)#^Z R1# *Jan 27 10:57:38.533: %SYS-5-CONFIG_I: Configured from console by console R1#clear ip R1#clear ip b R1#clear ip bgp so R1#clear ip bgp * sof R1#clear ip bgp * soft i R1#clear ip bgp * soft in 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#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#router bgp 10 R1(config-router)#neigh 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-WEI R1(config-router)#neighbor 1.2.0.2 route-map R-WEIGH R1(config-router)#neighbor 1.2.0.2 route-map R-WEIGHT-R2 in 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.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-router)#do sh clear ip bgp * soft in ^ % Invalid input detected at '^' marker. R1(config-router)#do clear ip bgp * soft in R1(config-router)#do clear ip bgp * soft ? % Unrecognized command R1(config-router)#do 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.3.0.3 0 30 40 i *> 1.2.0.2 100 20 40 i *> 100.0.0.0/16 0.0.0.0 0 32768 i R1(config-router)#neigh R1(config-router)#neighbor 1.3.0.3 route-ma R1(config-router)#neighbor 1.3.0.3 route-map R-WEIGHT-R3 in R1(config-router)#do 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.3.0.3 0 30 40 i *> 1.2.0.2 100 20 40 i *> 100.0.0.0/16 0.0.0.0 0 32768 i R1(config-router)#do clear ip bgp * soft in R1(config-router)#do 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 200 30 40 i * 1.2.0.2 100 20 40 i *> 100.0.0.0/16 0.0.0.0 0 32768 i R1(config-router)#do 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 200 30 40 i * 1.2.0.2 100 20 40 i *> 100.0.0.0/16 0.0.0.0 0 32768 i R1(config-router)# R1(config-router)#do 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/9 ms R1(config-router)#do trace 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 4 msec 3 msec 4 msec 2 3.4.0.4 4 msec 5 msec 5 msec
enable configure terminal ! ip prefix-list PRE-R4 permit 40.0.0.0/16 ! route-map R-WEIGHT-R2 permit 10 match ip address prefix-list PRE-R4 set weight 345 exit route-map R-WEIGHT-R2 permit 20 exit ! route-map R-WEIGHT-R3 permit 10 match ip address prefix-list PRE-R4 set weight 123 exit route-map R-WEIGHT-R3 permit 20 exit ! router bgp 10 neighbor 1.2.0.2 route-map R-WEIGHT-R2 in neighbor 1.3.0.3 route-map R-WEIGHT-R3 in exit ! end
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
enable configure terminal ! ip as-path access-list 1 permit ^20_ ip as-path access-list 2 permit ^30_ ! route-map R-WEIGHT-R2 permit 10 match as-path 1 set weight 111 exit route-map R-WEIGHT-R2 permit 20 exit ! route-map R-WEIGHT-R3 permit 10 match as-path 2 set weight 222 exit route-map R-WEIGHT-R3 permit 20 exit ! router bgp 10 neighbor 1.2.0.2 route-map R-WEIGHT-R2 in neighbor 1.3.0.3 route-map R-WEIGHT-R3 in exit ! end
! 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
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#
I'm not sure following configuration is correct…
where is filter-list, route-map take effect…?
enable configure terminal ! ip as-path access-list 1 permit ^20_ ip as-path access-list 2 permit ^30_ ! router bgp 10 neighbor 1.2.0.2 filter-list 1 in neighbor 1.2.0.2 weight 321 neighbor 1.3.0.3 rfilter-list 2 in neighbor 1.2.0.3 weight 876 exit ! end
! 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
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#