The goal
You are working on the course network from the first lab. R1 peers with ISP A at 192.0.2.1 and R2 peers with ISP B at 192.0.2.5. In this lab you control both ISPs, and ISP A is misbehaving on purpose: besides 203.0.113.0/24, its customer network, it also sends 10.99.0.0/16, which is a private range that should not appear on the Internet, and a default route. ISP B sends only 203.0.113.0/24.
By the end you will have three results. R1 refuses the private prefix. Every route learned from a provider carries a community that says so. R2 refuses to send any provider-tagged route to ISP B, which stops the company becoming a transit network.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
| Result | Mechanism | Proof |
|---|---|---|
| The private prefix is refused | Inbound route map on R1 with a deny clause | show ip bgp 10.99.0.0 says not in table |
| Provider routes carry a tag | Set community in the inbound permit clause | show ip bgp community 64500:100 |
| No provider route goes to the other ISP | Outbound route map on R2 matching the tags | advertised-routes lists only 198.51.100.0/24 |
Step 1: see what the provider sends
You cannot fix what you cannot see. Turn on soft reconfiguration for ISP A so R1 keeps an unfiltered copy, then ask for it.
router bgp 64500
address-family ipv4 unicast
neighbor 192.0.2.1 soft-reconfiguration inbound
end
clear ip bgp 192.0.2.1 soft inR1. soft-reconfiguration inbound stores the routes ISP A sends before any inbound policy. The clear asks ISP A to send them again so the copy is filled.
R1#show ip bgp neighbors 192.0.2.1 received-routes Network Next Hop Metric LocPrf Weight Path 0.0.0.0 192.0.2.1 0 0 64501 i 10.99.0.0/16 192.0.2.1 0 0 64501 i 203.0.113.0 192.0.2.1 0 0 64501 i Total number of prefixes 3
Turn on soft reconfiguration, ask ISP A to send its routes again, read received-routes, and pick out the prefix that should not be there.
- Enablesoft-reconfiginbound
- Refreshclear ip bgpsoft in
- Readreceived-routes,three prefixes
- Markthe privateprefix is wrong
Step 2: filter and tag on the way in
The route map has two clauses. The first, with deny, catches private prefixes and removes them. The second has no match line, so it matches everything left, and it sets a community. The tag 64500:100 is the company's own convention in this lab: first number the company AS, second number meaning "learned from ISP A". R2 will use 64500:200 for ISP B.
ip prefix-list BOGONS seq 5 permit 10.0.0.0/8 le 32
ip prefix-list BOGONS seq 10 permit 172.16.0.0/12 le 32
ip prefix-list BOGONS seq 15 permit 192.168.0.0/16 le 32
!
route-map FROM-ISPA deny 10
match ip address prefix-list BOGONS
route-map FROM-ISPA permit 20
set community 64500:100
!
router bgp 64500
address-family ipv4 unicast
neighbor 192.0.2.1 route-map FROM-ISPA in
neighbor 10.255.0.2 send-community
end
clear ip bgp 192.0.2.1 soft inR1. The prefix list says which prefixes count as private: the permit lines here are matches, and the deny in the route map is what removes them. send-community makes R1 pass the tag to R2 over iBGP.
Notice the pair of words that confuse many learners. In a prefix list, permit means "this prefix matches". In the route map, deny means "a route that matches is dropped". The two work together, and neither one alone drops a route.
A prefix list only says which prefixes match. The route map clause that uses the list says what happens to a match, and a deny clause drops it.
Configure R2 the same way for ISP B at 192.0.2.5. Use route-map FROM-ISPB permit 20 with set community 64500:200, and the same BOGONS list in a deny 10 clause.
R1#show ip bgp Network Next Hop Metric LocPrf Weight Path *> 0.0.0.0 192.0.2.1 0 0 64501 i *> 198.51.100.0 0.0.0.0 0 32768 i *> 203.0.113.0 192.0.2.1 0 0 64501 i
received-routes still lists it. That is the difference between what the neighbour sent and what your policy accepted. The first two rows are ISP A routes, and 198.51.100.0/24 is the company's own prefix.R1#show ip bgp 10.99.0.0 % Network not in table
Each route is tested against clause 10 first. A match is dropped, anything else goes to clause 20 and is tagged.
- Route arrivesfrom ISP A
- Clause 10private prefix?drop it
- Clause 20everything else:set 64500:100
- Tabletagged routeis stored
Step 3: refuse provider routes on the way out
Now the outbound side on R2. A community list names the tags, and the route map's first clause refuses any route that carries one of them. The second clause then lets through only the company's own prefix, so even an untagged mistake cannot leak.
ip community-list standard FROM-PROVIDERS permit 64500:100
ip community-list standard FROM-PROVIDERS permit 64500:200
ip prefix-list COMPANY-ONLY seq 5 permit 198.51.100.0/24
!
route-map TO-ISPB deny 10
match community FROM-PROVIDERS
route-map TO-ISPB permit 20
match ip address prefix-list COMPANY-ONLY
!
router bgp 64500
address-family ipv4 unicast
neighbor 192.0.2.5 send-community
neighbor 192.0.2.5 route-map TO-ISPB out
end
clear ip bgp 192.0.2.5 soft outR2. A route tagged 64500:100 or 64500:200 hits the deny clause. Only 198.51.100.0/24 passes the second clause. Use the same pattern on R1 toward ISP A.
R2#show ip bgp 0.0.0.0 BGP routing table entry for 0.0.0.0/0, version 15 Paths: (1 available, best #1, table default) Not advertised to any peer 64501 10.255.0.1 (metric 20) from 10.255.0.1 (1.1.1.1) Origin IGP, metric 0, localpref 100, valid, internal, best Community: 64500:100
Each route is tested against clause 10 first, and a route with a provider tag is refused. Anything else goes to clause 20, which sends only the company prefix. Everything left falls to the implicit deny.
- Route in tableon R2
- Clause 10provider tag?refuse it
- Clause 20company prefix?send it
- Anything elseimplicit deny,not sent
Step 4: verify what ISP B actually hears
R2#show ip bgp neighbors 192.0.2.5 advertised-routes Network Next Hop Metric LocPrf Weight Path *> 198.51.100.0 0.0.0.0 0 32768 i Total number of prefixes 1
R2#show ip bgp community 64500:100 Network Next Hop Metric LocPrf Weight Path *>i 0.0.0.0 10.255.0.1 0 100 0 64501 i * i 203.0.113.0 10.255.0.1 0 100 0 64501 i
Four verification commands, each tied to one step of the lab.
- received-routesWhat the provider sent,before your policy
- show ip bgpWhat your policy accepted
- show ip bgp communityWhich routes carry a tag
- advertised-routesWhat the other ISP hears
The neighbour did not send it, the inbound policy dropped it, it lost best-path selection, or the outbound policy refused to send it on.
- Not sentneighbour did notoffer it
- Inbound droproute map denyor implicit deny
- Not bestanother pathwon selection
- Outbound droproute map refusesto send it
Step 5: remove the tag and test the safety net
A policy is only trustworthy if it still protects you when something else fails. Turn off the tag on purpose: remove send-community from R1's iBGP neighbour and refresh. The default route now reaches R2 without its community, so the deny clause on R2 has nothing to match.
router bgp 64500
address-family ipv4 unicast
no neighbor 10.255.0.2 send-community
end
clear ip bgp 10.255.0.2 soft outR1. This removes the tag on purpose, to test the second rule. Restore it afterwards with neighbor 10.255.0.2 send-community.
R2#show ip bgp 0.0.0.0 BGP routing table entry for 0.0.0.0/0, version 18 Paths: (1 available, best #1, table default) Not advertised to any peer 64501 10.255.0.1 (metric 20) from 10.255.0.1 (1.1.1.1) Origin IGP, metric 0, localpref 100, valid, internal, best
R2#show ip bgp neighbors 192.0.2.5 advertised-routes Network Next Hop Metric LocPrf Weight Path *> 198.51.100.0 0.0.0.0 0 32768 i Total number of prefixes 1
With the tag removed, the tag rule has nothing to match, so it does not refuse the default route. The prefix rule still refuses it, because the default route is not the company prefix.
The same result can be traced for every prefix in the lab. The table below runs the four prefixes through the route maps from this lesson twice: once with the tag kept and once with it lost.
| Prefix | ISP B hears it: tag kept | ISP B hears it: tag lost | What decides it |
|---|---|---|---|
| 0.0.0.0/0 | No: refused by clause 10 | No: refused by clause 20 | Learned from ISP A, tagged 64500:100 by FROM-ISPA clause 20 |
| 10.99.0.0/16 | No: dropped at R1 | No: dropped at R1 | Matches BOGONS in FROM-ISPA clause 10, so R2 does not see it |
| 203.0.113.0/24, iBGP copy | No: refused by clause 10 | No: refused by clause 20 | Tagged at R1 and not listed in COMPANY-ONLY |
| 198.51.100.0/24 | Yes: clause 20 | Yes: clause 20 | Company prefix with no tag, listed in COMPANY-ONLY |
Read the two middle columns side by side. The result is the same, one prefix in four, but the clause that stops the default route changes from clause 10 to clause 20. That is the case for keeping both rules: the second one holds when the first one cannot match.
| Symptom | First check | Common cause |
|---|---|---|
| A filtered prefix still appears in the table | Was the policy refreshed with a soft clear? | The route map applies to new updates only |
| Every route vanished after the route map | show route-map for both clauses | A missing permit clause and the implicit deny |
| No community on a route learned over iBGP | send-community on the sending neighbour | Communities are not sent unless configured |
| A provider route reaches the other ISP | The outbound route map and its direction | Applied inward, or only a tag match with no prefix rule |
Troubleshooting prompts
A prefix that stays after the route map needs a soft clear and a direction check. Routes that all vanish need both clauses checked. A route with no community needs send-community on the sending neighbour.
- Prefix stayssoft clear, thencheck direction
- All routes goneboth clauses,implicit deny
- No communitysend-communityunder IPv4
The private prefix is still in the table after the route map
The route map takes effect for new updates only. Run clear ip bgp 192.0.2.1 soft in on R1 so ISP A sends its routes again and they pass through the policy. Then check that the route map is attached in the right direction with show ip bgp neighbors 192.0.2.1 policy.
All routes disappeared after the route map was applied
A route map ends with an implicit deny. If the second clause is missing, or its sequence number was mistyped so that the clause is not there, every route that does not match clause 10 is dropped. Run show route-map FROM-ISPA and confirm both clauses are listed.
R2 shows the route from R1 with no community
R1 is not sending the tag. Check that neighbor 10.255.0.2 send-community is under the IPv4 address family on R1, then run clear ip bgp 10.255.0.2 soft out. Standard communities are not sent to a neighbour unless the neighbour has send-community.
Technical reference: RFC 1997, BGP Communities Attribute. Output above is an example written for this lesson.
Check what you learned
In the BOGONS prefix list every line says permit, yet the prefixes are dropped. Why?
R2 shows no community on the path learned from R1. What is the most likely cause?
send-community is removed from R1's iBGP neighbour. The default route reaches R2 with no tag. Is it advertised to ISP B?
A route is missing from show ip bgp but present in received-routes. Where did it go?
Which command shows the routes ISP A sent before your inbound policy ran?
send-community is removed from R1's iBGP neighbour, as in step 5. Of the four prefixes in the lab (the default route, 10.99.0.0/16, 203.0.113.0/24 and 198.51.100.0/24), how many does ISP B hear?
Route map FROM-ISPA contains only clause 10, a deny that matches BOGONS, and it is applied inbound for ISP A. What happens to the routes ISP A sends?
The company adds a second network that must be advertised to ISP B. What change does the outbound policy on R2 need?