OK So I mocked up the above network and have the following config.
Al networks apart from 10.1.1.1 are part of OSPF, and the route maps are complete, every device can ping every other IP address, and R4 is redistribution default route so all devices can also ping the 10.1.1.1 loopback.
Gateway of last resort is 172.20.1.2 to network 0.0.0.0
172.20.0.0/24 is subnetted, 4 subnets
C 172.20.0.0 is directly connected, FastEthernet0/0
C 172.20.1.0 is directly connected, FastEthernet0/1
O 172.20.2.0 [110/20] via 172.20.0.2, 00:23:42, FastEthernet0/0
O 172.20.3.0 [110/20] via 172.20.1.2, 00:23:42, FastEthernet0/1
C 192.168.1.0/24 is directly connected, FastEthernet1/0.2
C 192.168.2.0/24 is directly connected, FastEthernet1/0.3
O*E2 0.0.0.0/0 [110/1] via 172.20.1.2, 00:23:42, FastEthernet0/1
[110/1] via 172.20.0.2, 00:23:43, FastEthernet0/0
I then have the following config on R1
R1#sh ip access-listsStandard IP access list one
10 permit 192.168.1.0, wildcard bits 0.0.0.255 (113 matches)
Standard IP access list two
10 permit 192.168.2.0, wildcard bits 0.0.0.255 (14 matches)
Extended IP access list Internal-IP
20 permit ip any 192.168.0.0 0.0.255.255 log
30 permit ip any 172.20.0.0 0.0.255.255 log (33 matches)
Internal-IP captures all packets destined to any internal IP (assume 10.1.1.1 is external)
Access list "one" and "two" capture packets from the two PC's
Then I have the route map
R1#sh route-map
route-map Balance, permit, sequence 10
Match clauses:
ip address (access-lists): Internal-IP
Set clauses:
Policy routing matches: 0 packets, 0 bytes
route-map Balance, permit, sequence 20
Match clauses:
ip address (access-lists): one
Set clauses:
ip next-hop 172.20.0.2
Policy routing matches: 77 packets, 8470 bytes
route-map Balance, permit, sequence 30
Match clauses:
ip address (access-lists): two
Set clauses:
ip next-hop 172.20.1.2
Policy routing matches: 11 packets, 1210 bytes
This is applied to interfaces coming in from the PC's
So the idea is that if you try to reach an "internal" IP it will use what ever OSPF says, but if you try to reach the 10.1.1.1 address then depending if you are coming from the 192.168.1.0/24 or the 192.168.2.0/24 will depend what way round the loop it will go.
My issue is that while this does set the next-hop correct for reaching 10.1.1.1,
VPCS[1]> trace 10.1.1.1
trace to 10.1.1.1, 8 hops max, press Ctrl+C to stop
1 192.168.1.1 25.000 ms 9.000 ms 9.000 ms
2 172.20.0.2 28.000 ms 29.000 ms 29.000 ms
3 *172.20.2.1 59.000 ms (ICMP type:3, code:3, D
but it also forces the next hop for any ip address.
VPCS[1]> trace 172.20.3.1
trace to 172.20.3.1, 8 hops max, press Ctrl+C to stop
1 192.168.1.1 16.000 ms 9.000 ms 9.000 ms
2 172.20.0.2 29.000 ms 29.000 ms 29.000 ms
3 *172.20.2.1 48.000 ms (ICMP type:3, code:3, Des
I see it hitting the right Access list
R1#
*Mar 1 01:08:04.619: %SEC-6-IPACCESSLOGP: list Internal-IP permitted udp 192.168.1.10(0) -> 172.20.3.1(0), 29 packets
So my question is how are Route-maps processed, is it not top down line an access list? I am sure I could easily get this to work by changing the access list "one" and "two" to have deny statements so they don't capture the internal traffic at all. But I thought if a packet matches the first statement in a route map then it is processed and does not check agisnt any following statements.