- Bronze, 100 points or more
I have few questions about routing-table's look up.
please consider the following routing table.
R 10.0.0.0/8 via 126.96.36.199 s0
Let say a packet is received with destination 10.10.10.10, then according to cisco book, the longest possible match in routing table is used. since there is only one entry, the packet is forwarded to 188.8.131.52.
Please consider the following routing table.
10.0.0.0/8 is subnetted , two subnets, mask 255.255.254.
R 10.0.2.0 via 184.108.40.206 s0
R 10.0.4.0 via 220.127.116.11 s1
Let say a packet with destination 10.0.6.1 is received,but according to book, router will drop this packet. My question is why?because the longest possible match is 10.0.4.0 so packet should have been forwarded to next hop router.
Here is my understanding:
How the table is looked up?
take for example the above routing table
R 10.0.2.0/23 via 18.104.22.168 s1
R 10.0.4.0/23 via 22.214.171.124 s2
The packet with destination 10.0.6.1 is matched against the first entry. The mask in the first entry (/23) is used to drive the subnet number from the destination ip address(10.0.6.1). The subnet number is found to be 10.0.6.0 which does not the match the first entry
The 2nd entry is checked. The mask from 2nd entry (/23) is used to drive the subnet number from the destination ip aadress which found to be 10.0.6.0. Again not a match, thus the packet is dropped.
Thanks a lot !
the router will match it to 126.96.36.199 and forwards it to next hop.?
Though you have answer already it was matched to 188.8.131.52/16 as its range is 184.108.40.206 to 220.127.116.11 and your IP 18.104.22.168 is within the range.
I hope this example will help for the question in first post,
router# show ip route
172.30.0.0/16 is variably subnetted, 2 subnets, 2 masks
172.30.32.0/20 via 10.1.1.2 ( range 172.30.32.0-172.30.47.255)
172.30.32.0/24 via 10.1.1.1 (range 172.30.32.0- 172.30.32.255 )
S* 0.0.0.0/0 [1/0] via 10.1.1.3
A packet destined to 172.30.32.1 is forwarded to 10.1.1.1, since this is the longest prefix match.
A packet destined to 172.30.33.1 is forwarded to 10.1.1.2, since this is the longest prefix match.
A packet destined to 192.168.10.1 is forwarded to 10.1.1.3; since this network doesn't exist in the routing table, this packet is forwarded to the default route.
A packet destined to 172.30.254.1 is dropped as this address was not in range of because its destination,172.30.254.1, is within a known major network, 172.30.0.0/16, but the router doesn't know about this particular subnet within that major network
One more piece of info
"If the supernet or default route is learned via IS-IS or OSPF, the no ip classless configuration command is ignored. In this case, packet switching behavior works as though ip classless were configured."
Sorry to butt in but the packet will be caught by the /16. If you do a show ip route on the device with the route installed, you will see this :-
ip classless is off
Gateway of last resort is not set
22.214.171.124/16 is variably subnetted, 2 subnets, 2 masks
S 126.96.36.199/16 [1/0] via 192.168.1.2
S 188.8.131.52/24 [1/0] via 192.168.2.2
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet1/0
Router#sh ip route 184.108.40.206
Routing entry for 220.127.116.11/16
Known via "static", distance 1, metric 0
Routing Descriptor Blocks:
Route metric is 0, traffic share count is 1
A ping generated from a source does recieve the packets as can be seen from a debug ip icmp
Router#ping ip 18.104.22.168 repeat 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 22.214.171.124, timeout is 2 seconds:
*Mar 12 09:28:18.171: CEF: Try to CEF switch 126.96.36.199 from FastEthernet0/0
*Mar 12 09:28:18.175: IP: tableid=0, s=192.168.1.1 (FastEthernet0/0), d=188.8.131.52 (Loopback2), routed via RIB
*Mar 12 09:28:18.175: IP: s=192.168.1.1 (FastEthernet0/0), d=184.108.40.206, len 100, rcvd 4
*Mar 12 09:28:18.179: ICMP: echo reply sent, src 220.127.116.11, dst 192.168.1.1
*Mar 12 09:28:18.179: IP: tableid=0, s=18.104.22.168 (local), d=192.168.1.1 (FastEthernet0/0), routed via FIB
*Mar 12 09:28:18.179: IP: s=22.214.171.124 (local), d=192.168.1.1 (FastEthernet0/0), len 100, sending
Where the ip classless configuration command falls within the routing and forwarding processes is often confusing. In reality, IP classless only affects the operation of the forwarding processes in IOS; it doesn't affect the way the routing table is built. If IP classless isn't configured (using the no ip classless command), the router won't forward packets to supernets.
Now that is an excellent question :-) and deserves a rating for the thought gone into it.
The answer to which is quite simply i don't know without testing. I would assume it would use the 126.96.36.199/16 route but without testing i can't be sure.
I'll get back to you :-).
Yes the router uses it's route table entries togther with their subnet masks to work out the longest match.
Just to add to Guiseppe and Adam's post. You are using 2500 routers i believe and from one of your previous configs you had "no ip classless" in your configs. This can have a major effect on whether the default route is used when a more specific route is not found eg.
your routing table contains 3 routes for the 172.16.x.x network and a default route.
If a packet arrives at the router destined for 172.16.14.10 then one of 2 things happen
1) If ip classless is turned on then the router will use the default route to forward the packet
2) if ip classless is turned off then the router will drop the packet. The reason for this is that the router assumes it knows all the 172.16.x.x/24 networks and so if it doesn't have an entry in it's routing table then it should drop it.
On later IOS's ip classless is on by default but you should be aware of it.
10.0.6.1 is out of the two /23 prefixes so no match is found for it.
if a less specific route like 10.0.0.0/8 or a default route 0.0.0.0/0 exists the packet would follow that path but if no entry exists in routing table for 10.0.6.1 the packet is dropped.
if there are multiple possible matches the most specific route is used
think of it like matching an ACL statement here each line is a route
Hope to help
The router will drop the packet because it does not have a route for the 10.0.6.0 network.
Your mask is a /23 so your "closest" match ends at 10.0.5.255, so there is no entry for this network and if a default route exsited, it would be used.
The longest match is used when multiple entries match a route. So in the examples you have given, if your had a packet destined for 10.0.3.200 and you to two routes in your routing table which where 10.0.0.0 /16 and 10.0.2.0 /23, then the even though both routes cover the address, the longest match is the /23 and would be chosen.