R3#conf terminal
R3(config)#route-map DEFAULT-POLICY
R3(config-route-map)#set ip next-hop 10.1.23.2
R3(config-route-map)#exit
R3(config)#ip local policy route-map DEFAULT-POLICY
R3#show ip route
10.0.0.0/24 is subnetted, 4 subnets
C 10.1.13.0 is directly connected, Serial0/0
C 10.1.3.0 is directly connected, Loopback0
S 10.1.1.0 is directly connected, Serial0/0
C 10.1.23.0 is directly connected, FastEthernet0/0
R3#ping 10.1.2.2
Sending 5, 100-byte ICMP Echos to 10.1.2.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R3#ping 10.1.2.2 source 10.1.23.3
Sending 5, 100-byte ICMP Echos to 10.1.2.2, timeout is 2 seconds:
Packet sent with a source address of 10.1.23.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/20/40 ms
#Make Debug
R3#debug ip packet
IP packet debugging is on
R3#ping 10.1.2.2 source 10.1.23.3
Sending 5, 100-byte ICMP Echos to 10.1.2.2, timeout is 2 seconds:
Packet sent with a source address of 10.1.23.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/23/40 ms
*Mar 1 00:14:00.519: IP: tableid=0, s=10.1.2.2 (FastEthernet0/0), d=10.1.23.3 (FastEthernet0/0), routed via RIB
*Mar 1 00:14:00.523: IP: s=10.1.2.2 (FastEthernet0/0), d=10.1.23.3 (FastEthernet0/0), len 100, rcvd 3
*Mar 1 00:14:00.535: IP: tableid=0, s=10.1.2.2 (FastEthernet0/0), d=10.1.23.3 (FastEthernet0/0), routed via RIB
*Mar 1 00:14:00.539: IP: s=10.1.2.2 (FastEthernet0/0), d=10.1.23.3 (FastEthernet0/0), len 100, rcvd 3
*Mar 1 00:14:00.555: IP: tableid=0, s=10.1.2.2 (FastEthernet0/0), d=10.1.23.3 (FastEthernet0/0), routed via RIB
*Mar 1 00:14:00.559: IP: s=10.1.2.2 (FastEthernet0/0), d=10.1.23.3 (FastEthernet0/0), len 100, rcvd 3
*Mar 1 00:14:00.575: IP: tableid=0, s=10.1.2.2 (FastEthernet0/0), d=10.1.23.3 (FastEthernet0/0), routed via RIB
*Mar 1 00:14:00.579: IP: s=10.1.2.2 (FastEthernet0/0), d=10.1.23.3 (FastEthernet0/0), len 100, rcvd 3
*Mar 1 00:14:00.595: IP: tableid=0, s=10.1.2.2 (FastEthernet0/0), d=10.1.23.3 (FastEthernet0/0), routed via RIB
*Mar 1 00:14:00.599: IP: s=10.1.2.2 (FastEthernet0/0), d=10.1.23.3 (FastEthernet0/0), len 100, rcvd 3
* (routed via RIB) RIB-Router Informational Base <---- CEF is off
#Make another Ping to R1
R3#ping 10.1.1.1 source 10.1.13.3
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 10.1.13.3
.....
Success rate is 0 percent (0/5)
* (IP Packet debug is on but not debuging)
* But if we Debug IP Policy we can see output
R3#debug ip policy
Policy routing debugging is on
R3#ping 10.1.1.1 source 10.1.13.3 repeat 1
Sending 1, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 10.1.13.3
Success rate is 0 percent (0/1)
*Mar 1 00:19:36.563: IP: s=10.1.13.3 (local), d=10.1.1.1, len 100, policy match
*Mar 1 00:19:36.563: IP: route map DEFAULT-POLICY, item 10, permit
*Mar 1 00:19:36.567: IP: s=10.1.13.3 (local), d=10.1.1.1 (FastEthernet0/0), len 100, policy routed
*Mar 1 00:19:36.567: IP: local to FastEthernet0/0 10.1.23.2.
* Its sends out incorrect interface.
* With set ip next-hop Address (Route-map is better than Routing table)
* But if we configure ip default next-hop address the router first check routing table and than use the route-map.
# Configure ip default next-hop address
R3(config)#route-map DEFAULT-POLICY permit 10
R3(config-route-map)#no set ip next-hop 10.1.23.2
R3(config-route-map)#set ip default next-hop 10.1.23.2
* Now Ping to R1 and R2 will be successful.
R3#ping 10.1.1.1
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/6/12 ms
R3#ping 10.1.2.2 source 10.1.23.3
Sending 5, 100-byte ICMP Echos to 10.1.2.2, timeout is 2 seconds:
Packet sent with a source address of 10.1.23.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/20/36 ms