When the session is up and the route is still wrong
Two earlier lessons cover sessions that will not come up and routes that stay on the router that originates them. This lesson covers the third kind of fault, the one that causes most real incidents: the session is Established, the neighbour is sending routes, and policy on one side removes a route or changes its attributes. Policy is code you wrote, and like any code it does exactly what it says, not what you meant.
A route has to pass six checkpoints on its way from one router's table into another router's routing table. Two of them are policy checkpoints, one on each side of the session. If you test in order and stop at the first failure, the fault is at that checkpoint.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Read both sides of the session
The sender and the receiver each have a say, and each has a command that shows its view. advertised-routes on the sender shows what its outbound policy let out. received-routes on the receiver shows what arrived before its inbound policy, but only if soft-reconfiguration inbound is configured. Compare them with the receiver's own table: a route in received-routes but not in show ip bgp was removed by the receiver's inbound policy.
Compare what was sent, what arrived and what was kept.
- Sender saysadvertised-routes
- Receiver gotreceived-routes
- Receiver keptshow ip bgp
- Router usesshow ip route
A route missing between two boxes was removed by the policy between them.
Next, ask the router which policies it believes are attached. This is the quickest way to catch a route map applied in the wrong direction or not applied at all.
R1#show ip bgp neighbors 192.0.2.1 policy Neighbor: 192.0.2.1, Address-Family: IPv4 Unicast Locally configured policies: route-map FROM-ISPA, in route-map TO-ISPA, out
Then look at the policy itself. A route map prints its clauses in order, and a prefix list can print how many routes each line has matched.
R1#show ip prefix-list detail BOGONS ip prefix-list BOGONS: count: 3, range entries: 3, sequences: 5 - 15, refcount: 3 seq 5 permit 10.0.0.0/8 le 32 (hit count: 1, refcount: 1) seq 10 permit 172.16.0.0/12 le 32 (hit count: 0, refcount: 1) seq 15 permit 192.168.0.0/16 le 32 (hit count: 0, refcount: 1)
show route-map FROM-ISPA
show ip bgp neighbors 192.0.2.1 received-routes
show ip bgp neighbors 192.0.2.1 advertised-routes
show ip bgp 203.0.113.0The four commands to run first for a policy fault. The last one shows the attributes after policy: local preference, communities and the best-path marker.
Seven policy faults and how to recognise them
Most policy problems are one of these seven. Each has a symptom that points at it and a command that confirms it. Read the table from the symptom outward: find what you see, run the check, then apply the fix.
| Fault | What you see | Check | Fix |
|---|---|---|---|
| Implicit deny | Every route disappears after a route map is applied | show route-map: is there a final permit clause? | Add a permit clause with no match line |
| Not refreshed | A change was made and nothing moved | show ip bgp neighbors X policy | clear ip bgp X soft in or out |
| Wrong direction | An attribute is set but has no effect | show ip bgp neighbors X policy: in or out? | Re-apply the route map in the intended direction |
| Prefix range | A prefix is not matched, or too many are matched | show ip prefix-list detail: hit counts | Correct ge and le, or the sequence order |
| Community lost | The tag is missing on the next router | show ip bgp prefix: Community line | send-community toward that neighbour |
| Attribute conflict | Wrong exit after setting local preference | show ip bgp prefix: weight, then local preference | Remove the attribute that ranks higher |
| Clause order | A broad clause catches routes first | show route-map: sequence numbers | Put specific clauses before broad ones |
Worked example: the route map is attached the wrong way
The company wants R1 to prefer ISP A and has written a route map that sets local preference to 200. After applying it, R1 still chooses ISP B's path, which it learns through R2. R2 holds an older rule that gives ISP B routes local preference 150, so 200 should win. Start with the table, because it shows the attribute you were trying to set.
R1#show ip bgp 203.0.113.0 BGP routing table entry for 203.0.113.0/24, version 11 Paths: (2 available, best #2, table default) 64501 192.0.2.1 from 192.0.2.1 (11.11.11.11) Origin IGP, metric 0, localpref 100, valid, external 64502 10.255.0.2 (metric 20) from 10.255.0.2 (2.2.2.2) Origin IGP, metric 0, localpref 150, valid, internal, best
R1#show ip bgp neighbors 192.0.2.1 policy Neighbor: 192.0.2.1, Address-Family: IPv4 Unicast Locally configured policies: route-map ISPA-PREF, out
router bgp 64500
address-family ipv4 unicast
no neighbor 192.0.2.1 route-map ISPA-PREF out
neighbor 192.0.2.1 route-map ISPA-PREF in
end
clear ip bgp 192.0.2.1 soft inR1. Remove the outbound attachment, attach the same map inbound, then ask ISP A to resend so the map runs on the routes.
Inbound changes what R1 stores. Outbound changes what R1 tells the neighbour.
| Goal | Attribute | Map direction | Why |
|---|---|---|---|
| Make R1 prefer one exit | Local preference | In, from the neighbour | It is stored on arrival and shared with iBGP peers, not sent to eBGP neighbours |
| Make only R1 prefer an exit | Weight (Cisco) | In | It stays on the router and is not advertised |
| Make the neighbour see a longer path | AS-path prepend | Out, to the neighbour | The neighbour reads the path R1 sends |
| Suggest an entry point to a neighbour AS | MED | Out, to the neighbour | The neighbour compares it between paths from the same AS |
| Tag routes for later policy | Community | In or out | Sent to a neighbour only when send-community is configured |
Worked example: the range does not match
A bogon filter should remove 10.99.0.0/16 from a provider, but the prefix is still in the table. The route map is attached correctly. The fault is in the prefix list.
R1#show ip prefix-list detail BOGONS ip prefix-list BOGONS: count: 1, range entries: 0, sequences: 5 - 5, refcount: 3 seq 5 permit 10.0.0.0/8 (hit count: 0, refcount: 1)
| Line | 10.0.0.0/8 | 10.99.0.0/16 | 10.99.1.0/24 | 10.99.1.128/25 |
|---|---|---|---|---|
| permit 10.0.0.0/8 | Yes | No | No | No |
| permit 10.0.0.0/8 le 32 | Yes | Yes | Yes | Yes |
| permit 10.0.0.0/8 ge 16 | No | Yes | Yes | Yes |
| permit 10.0.0.0/8 ge 16 le 24 | No | Yes | Yes | No |
Worked example: a community that replaced another
R1 tags routes from ISP A with 64500:100 and a second map later adds 64500:300 to mark them as backup. R2 matches 64500:100 in an outbound rule, and the rule has stopped working.
R2#show ip bgp 203.0.113.0 BGP routing table entry for 203.0.113.0/24, version 19 Paths: (1 available, best #1, table default) 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:300
set community 64500:300 additive, which adds the new tag to the existing one.| Route map line | Route carried 64500:100 before | Result |
|---|---|---|
| set community 64500:300 | 64500:100 | 64500:300 only |
| set community 64500:300 additive | 64500:100 | 64500:100 and 64500:300 |
| set community none | 64500:100 | No community |
| (no set community line) | 64500:100 | 64500:100 unchanged |
A repeatable order
You now have the whole method. Check the session first, since a route cannot cross a session that is not up. Then find the checkpoint using advertised and received routes. Then confirm the attachment with the policy command. Then read the policy and its hit counts. Then apply the fix, and soft-clear in the right direction so it takes effect. Each step eliminates one half of the problem, which is why the order matters.
Confirm the session, find the checkpoint, check the attachment and the policy, then fix and soft-clear in the right direction.
- Sessionis itEstablished?
- Checkpointsent, got,kept, used
- Policyattached, in orout, hit counts
- Fixedit, thensoft clear
| What changed | Command on R1 | What happens |
|---|---|---|
| Inbound policy on a neighbour | clear ip bgp 192.0.2.1 soft in | Routes from the neighbour are evaluated again by the new policy |
| Outbound policy on a neighbour | clear ip bgp 192.0.2.1 soft out | R1 sends its routes again, run through the new policy |
| A mistake you need evidence of | Leave the session up and read the lists first | A hard clear removes the faulty state you want to inspect |
Why not just clear the whole session?
A hard clear, clear ip bgp *, tears the session down and withdraws every route until the session is rebuilt. It also hides the evidence you need, because the faulty state is gone. A soft clear in the right direction applies the new policy to the existing session and keeps the traffic flowing.
Received-routes shows nothing but the neighbour has routes
The command works only when neighbor X soft-reconfiguration inbound is configured, and the neighbour must resend its routes after it is turned on. Enable it, run clear ip bgp X soft in, then read the list again.
Technical reference: Cisco, BGP best path selection algorithm. Output above is an example written for this lesson.
Check what you learned
After you attach a route map with a single deny clause, every route disappears. Why?
A route map that sets local preference 200 is attached outbound to ISP A. What does R1 see?
permit 10.0.0.0/8 is the only line of a prefix list, and 10.99.0.0/16 is not matched. What fixes it?
R2 shows only 64500:300 on a route that R1 tagged 64500:100 earlier. Which keyword was missing from the second route map?
You edited the outbound route map toward ISP A. Which command applies it to routes R1 already advertised?
A prefix-list line is permit 10.0.0.0/8 ge 16 le 24. Which prefix inside 10.0.0.0/8 is still not matched?