What a transit AS is
A transit AS carries traffic that neither starts nor ends inside it. ISPs are transit networks on purpose: they are paid to. A company with two providers can become one by accident. R1 learns routes from ISP A and, by default, advertises them to ISP B. ISP B then sees a path to ISP A networks through the company, and may use it.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
The consequences are practical: unexpected traffic floods links sized for the company, other networks see paths that bypass what they paid for, and a misconfiguration can leak the routes of your providers to the world.
Four ways to stop it
All four work by controlling what you advertise to each provider so that only your own prefixes leave. They differ in how they identify those prefixes.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Method 1: AS-path filter
A route originated inside your AS, including one learned from another router of yours over iBGP, has an empty AS path. The expression ^$ matches exactly those routes.
ip as-path access-list 20 permit ^$
!
router bgp 64500
address-family ipv4 unicast
neighbor 192.0.2.1 filter-list 20 out
neighbor 192.0.2.5 filter-list 20 out
end
clear ip bgp * soft outR1 and R2 each apply it to their own provider. Routes learned from either ISP have a non-empty path and are not advertised. New prefixes you originate are allowed automatically.
Method 2: the no-export community
The well-known community no-export tells a router not to advertise a route to any eBGP neighbour. If you tag everything you learn from your providers with it, nothing they send can be passed on.
route-map FROM-ISPS permit 10
set community no-export additive
!
router bgp 64500
address-family ipv4 unicast
neighbor 192.0.2.1 route-map FROM-ISPS in
neighbor 192.0.2.5 route-map FROM-ISPS in
end
clear ip bgp * soft inR1 and R2. Routes arrive tagged no-export, so the router keeps them for its own use and tells no eBGP neighbour. additive keeps any community the provider already set.
Method 3: prefix list
ip prefix-list COMPANY-ONLY seq 5 permit 198.51.100.0/24
!
router bgp 64500
address-family ipv4 unicast
neighbor 192.0.2.1 prefix-list COMPANY-ONLY out
neighbor 192.0.2.5 prefix-list COMPANY-ONLY out
end
clear ip bgp * soft outR1 and R2. Names exactly the prefix you own. This is the most explicit, and also the one that needs an edit every time you add a prefix.
Method 4: distribute list
A distribute list uses an access list on the session. It works, but a prefix list can express prefix lengths directly and is easier to read, so use a distribute list only when something forces you to. The next lesson covers it. A neighbour cannot have both a distribute list and a prefix list in the same direction.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Verify what you advertise
On small screens, swipe sideways or focus the diagram and use the arrow keys.
R1#show ip bgp neighbors 192.0.2.1 advertised-routes Network Next Hop Metric LocPrf Weight Path *> 198.51.100.0/24 0.0.0.0 0 32768 i Total number of prefixes 1
Test the filters with show ip bgp neighbors ... advertised-routes after each change, and confirm the provider routes still arrive with routes. Output above is illustrative. A filter applied inbound by mistake can drop every route you needed.
Check your understanding
A company with two ISPs has no outbound filters. What happens to routes learned from ISP A?
Which AS-path expression permits only routes your AS originated?
You tag routes from ISP A with no-export inbound. What does R1 do with them?