I have a fairly complicated scenario that I've managed to duplicate with GNS3. Please see the attached image. In this scenario I have four "Branch Offices" each with their own router connected to each other with a /30 network between them. Each branch office has a simple layer 2 dumb switch with two hosts.
NetworkA and NetworkB are in OSPF area 0. While NetworkC and NetworkD are in area 1 with NetworkD connecting both areas.
OSPF adjacencies are formed between:
- NetworkA and NetworkB
- NetworkB and NetworkD
- NetworkD and NetworkC
- An OSPF adjacency is NOT formed between NetworkA and NetworkC.
For the sake of this question we're going to pretend that we're not allowed to form an OSPF adjacency between NetworkA and NetworkC. We're also going to pretend that we actually don't know what IPs are found behind NetworkA; even though the picture shows that the 192.168.1.16/29 subnet is there. For this reason we've set the gateway of last resort on NetworkC to point toward NetworkA.
So right now, NetworkA is advertising it's networks to NetworkB, which in turn is advertising it's networks to NetworkD and then finally they're being advertised to NetworkC. If a host on NetworkC (PC-3) attempts to ping a host on NetworkA (PC-2) then the packet goes all the way around to NetworkD, then to NetworkB, and then finally through NetworkA. Rather than taking the path directly between NetworkC and NetworkA. This is because there are OSPF routes in NetworkC's routing table telling it to forward them through NetworkD.
I'd like to find a way for traffic destined to NetworkA from NetworkC to go through the gateway of last resort. I believe what I need to do is setup a way for NetworkC to suppress any OSPF routes that it receives for NetworkA and rely entirely on it's gateway of last resort to access anything behind NetworkA.
I can make this work by simply adding static routes on both NetworkA and NetworkC but for this question we're pretending that we don't know what IPs are behind NetworkA (despite them being displayed in the diagram). For that reason I can't use a static route on NetworkCRouter to the 192.168.1.16/29 network and vice versa on NetworkARouter to 192.168.1.24/29 network.
I've been looking at OSPF Inbound Filtering by using a route-map with a distribution list to match on specific routes and deny them from being added to the routing table. But I can't figure out how to implement it correctly. Is this something you would do? Or I believe an alternative is to divide them up by using separate OSPF process ids. But I'm not sure how to get that to work either.