3.7.g Implement and troubleshoot AS path manipulations

3.7.d [i] Attribute manipulation

why? why not use a route map… i’m more comfortable with route maps… the fact is on the r&s lab exam they might want you to filter an AS path with a filter list and not a route-map… what’s the difference? an as-path filter list filters on as-path… a route map is more flexible…

R5(config-route-map)#set ?
as-path           Prepend string for a BGP AS-path attribute
automatic-tag     Automatically compute TAG value
clns              OSI summary address
comm-list         set BGP community list (for deletion)
community         BGP community attribute
dampening         Set BGP route flap dampening parameters
default           Set default information
extcomm-list      Set BGP/VPN extended community list (for deletion)
extcommunity      BGP extended community attribute
global            Set to global routing table
interface         Output interface
ip                IP specific information
ipv6              IPv6 specific information
level             Where to import route
local-preference  BGP local preference path attribute
metric            Metric value for destination routing protocol
metric-type       Type of metric for destination routing protocol
mpls-label        Set MPLS label for prefix
origin            BGP origin code
tag               Tag value for destination routing protocol
traffic-index     BGP traffic classification number for accounting
vrf               Define VRF name
weight            BGP weight for routing table

a lot more choices on the route map… but we’re looking at as-path filter list…

regexp is not as big a pain in the ass as it first seems… use it a few times and it starts, shall i say, making sense… like insanity makes sense… here are a few combinations to get going…

_400_ All routes through AS 400

^400$ Directly connected to AS 400

^400_. Networks behind AS 400

^ [0-9]+$ AS paths with only one AS

^$ Locally originated

.* Everything matches

 

placement with acl’s can be tricky… for some reason two things help me keep them straight: ingress/egress and the router’s perspective…

here is an example:

 

R3(config-router)#do sh ip bgp

Network          Next Hop            Metric LocPrf Weight Path
*>  7.7.7.0/24       4.4.4.4                                0 45 678 i
r>i 10.1.1.0/24      2.2.2.2                  0    100      0 i
r>i 10.1.2.0/24      2.2.2.2                  0    100      0 i
*>i 10.1.30.0/24     6.6.6.6                  8    100      0 678 ?
*>i 10.1.31.0/24     6.6.6.6                  9    100      0 678 ?
*   10.1.34.0/24     4.4.4.4                  0             0 45 i
*>                   0.0.0.0                  0         32768 i
*>  10.1.45.0/24     4.4.4.4                  0             0 45 i
*>  10.1.57.0/24     4.4.4.4                                0 45 i
r>i 10.1.68.0/24     6.6.6.6                  0    100      0 678 i
r>i 10.1.69.0/24     6.6.6.6                  0    100      0 678 ?
*   10.1.78.0/24     4.4.4.4                                0 45 678 i
*>i                  6.6.6.6                  0    100      0 678 i
*   10.1.134.0/24    4.4.4.4                  0             0 45 i
Network          Next Hop            Metric LocPrf Weight Path
*>                   0.0.0.0                  0         32768 i
r>i 172.16.16.0/24   1.1.1.1                  0    100      0 i
R3(config-router)#exit
R3(config)#ip as-path access-list 101 deny _45_
R3(config)#router bgp 123
R3(config-router)#neigh 4.4.4.4 filter-list 101 in
R3(config-router)#do clear ip bgp *
R3(config-router)#
*May  8 07:49:12.111: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down User reset
*May  8 07:49:12.111: %BGP_SESSION-5-ADJCHANGE: neighbor 1.1.1.1 IPv4 Unicast topology base removed from session  User reset
*May  8 07:49:12.123: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Down User reset
*May  8 07:49:12.123: %BGP_SESSION-5-ADJCHANGE: neighbor 2.2.2.2 IPv4 Unicast topology base removed from session  User reset
*May  8 07:49:12.135: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 Down User reset
*May  8 07:49:12.135: %BGP_SESSION-5-ADJCHANGE: neighbor 4.4.4.4 IPv4 Unicast topology base removed from session  User reset
*May  8 07:49:12.955: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 Up
R3(config-router)#
*May  8 07:49:12.975: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Up
*May  8 07:49:13.027: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up
R3(config-router)#do sh ip bgp

Network          Next Hop            Metric LocPrf Weight Path
* i 10.1.1.0/24      2.2.2.2                  0    100      0 i
* i 10.1.2.0/24      2.2.2.2                  0    100      0 i
* i 10.1.30.0/24     6.6.6.6                  8    100      0 678 ?
* i 10.1.31.0/24     6.6.6.6                  9    100      0 678 ?
*   10.1.34.0/24     0.0.0.0                  0         32768 i
* i 10.1.68.0/24     6.6.6.6                  0    100      0 678 i
* i 10.1.69.0/24     6.6.6.6                  0    100      0 678 ?
* i 10.1.78.0/24     6.6.6.6                  0    100      0 678 i
*   10.1.134.0/24    0.0.0.0                  0         32768 i
* i 172.16.16.0/24   1.1.1.1                  0    100      0 i

45 is gone…