Route filtering

A distribute list sits on a routing process, points at an access list, and permits or denies each route the process would send or receive. Under EIGRP, outbound, it stops a route leaving. Under OSPF the same command is accepted and acts on external routes only, because every router in an area builds its routes from the same database. Check the neighbour, not the prompt.

In Daveth Pro (Network)6 min video · lab: Between domains

By , founder of Daveth · Updated

Opening frame of the video walkthrough of Route filtering

Watch this lesson

6 min · Video walkthrough

In Daveth Pro (Network)

The full 6 min walkthrough is in Daveth Pro (Network). See what the plan opens

Upcoming practical lab

Lab C4: Between domains

What the lab covers

What this page answers

Does an outbound distribute list work in OSPF?

Only on external routes, and you cannot name an interface. Every router in an area builds its routes from the same database, so a router cannot withhold an intra-area prefix from one neighbour. The command is accepted without a warning. Read it in “The same list under OSPF”

How do you filter a route with a distribute list?

Write an access list that denies the route and permits the rest, then apply it under the routing process with distribute-list number out or in, and check the result on the neighbour. Read it in “The list that works”

The list that works

R-1 runs EIGRP to A-1 and OSPF to B-1. It advertises its LAN, 10.1.10.0/24, into both, and you do not want A-1 to learn that LAN.

A distribute list is the tool. It sits on a routing process, points at an access list, and permits or denies each route the process would send or receive. Applied outbound, it stops the route leaving.

Access list 10 denies 10.1.10.0/24 and permits everything else. Apply it outbound under EIGRP:

R-1# configure terminal
R-1(config)# router eigrp 10
R-1(config-router)# distribute-list 10 out
R-1(config-router)# end

This tells you: which list R-1's EIGRP process applies outbound, and what that list denies. It does not tell you: that A-1 has lost the route; that is read on A-1.

Has A-1 lost the route? Before the list:

10.1.10.0/24          from R-1, EIGRP

And after it:

10.1.10.0/24          not learned

The prefix is gone from the side the list faces.

Be precise about what just happened, because this is the misconception that follows route filtering everywhere it goes. A newspaper editor decides which announcements get printed. A door guard decides who walks in. What you configured is the editor. Nobody has been stopped at any door.

So the LAN is still there, still up, still reachable by anything that already knows how to get to it. You removed an announcement, not a road. If your actual requirement was that traffic must not arrive, a distribute list has not delivered it, and the tool you wanted was an access list on an interface.

Where the editor stops: a paper can be spiked before it prints, and a router cannot recall what it advertised an hour ago. Filtering changes what goes out from now on. What the neighbour already learned it holds until the protocol withdraws it.

The same list under OSPF

Now R-1 applies the same list outbound under OSPF, still denying 10.1.10.0/24. The command is accepted.

Under OSPF an outbound distribute list acts on external routes only, and you cannot name an interface.

Read that sentence next to the one above it: the command was accepted. No error, no warning, no hint. You are allowed to type it, the parser is perfectly happy, and under OSPF it then mostly declines to do anything. The only way to find out is to go and look at the neighbour, which is the next thing this page does.

R-1# configure terminal
R-1(config)# router ospf 1
R-1(config-router)# distribute-list 10 out
R-1(config-router)# end

This tells you: that R-1's OSPF process has an outbound list, and what the list denies. It does not tell you: that the list acts on anything. In OSPF it acts on external routes only, and the configuration does not say which routes are external.

B-1, with the list in place:

prefix                database  routing table
10.1.10.0/24          yes       yes
192.0.2.0/24          yes       yes
2001:db8:1:10::/64    yes       yes
2001:db8:c0::/64      yes       yes

Look at the first row. 10.1.10.0/24 is an intra-area route, so the list has nothing to act on, and nothing on R-1 warns you about that.

So which routes here are external? R-1 has a static route to 192.0.2.0/24 that uses a next hop, and it is redistributed into OSPF. That makes it external.

Same list. Same router. Different protocol, and the argument it takes is different too. Under EIGRP it acted on everything and let you name an interface. Under OSPF it acts on externals and will not take an interface at all. The list was never wrong; it was attached to a conversation with different rules.

A static route pointed at an interface behaves differently. It counts as connected and is advertised without redistribution. A static route pointed at a next-hop address stays static, and reaches a routing protocol only through redistribution.

Take list 10 off, since it acted on nothing, and apply list 20, which denies the static route:

R-1# configure terminal
R-1(config)# router ospf 1
R-1(config-router)# no distribute-list 10 out
R-1(config-router)# distribute-list 20 out static
R-1(config-router)# end

Do B-1 and B-2 still have 192.0.2.0/24?

prefix                database  routing table
10.1.10.0/24          yes       yes
192.0.2.0/24          no        no
2001:db8:1:10::/64    yes       yes
2001:db8:c0::/64      yes       yes

And B-2:

prefix                database  routing table
10.1.10.0/24          yes       yes
192.0.2.0/24          no        no
2001:db8:1:10::/64    yes       yes
2001:db8:c0::/64      yes       yes

R-1 no longer originates 192.0.2.0/24, so it is in neither router's database. B-2 matches B-1 row for row.

Why does OSPF limit the outbound list to external routes? Because of how the protocol works. Every router in an area builds its routes from the same database. A router that withheld an intra-area prefix from one neighbour would leave that neighbour with a different database from everyone else in the area. An external route is one this router brings in itself, so it is free to decline to bring it in.