GATE | GATE-CS-2004 | Question 55
The routing table of a router is shown below:
Destination Sub net mask Interface 18.104.22.168 255.255.255.0 Eth0 22.214.171.124 255.255.255.128 Eth1 126.96.36.199 255.255.255.255 Eth3 default Eth2
On which interfaces will the router forward packets addressed to destinations 188.8.131.52 and 184.108.40.206 respectively?
(A) Eth1 and Eth2
(B) Eth0 and Eth2
(C) Eth0 and Eth3
(D) Eth1 and Eth3
Explanation: To find the interface, we need to do AND of incoming IP address and Subnet mask. Compare the result of AND with the destination. Note that if there is a match between multiple Destinations, then we need to select the destination with longest length subnet mask.
220.127.116.11, matches with 18.104.22.168 and 22.214.171.124, the packet is forwarded to Eth1 as length of subnet mask in Eth11 is more.
If a result is not matching with any of the given destinations then the packet is forwarded to the default interface (here Eth2). Therefore the packet’s addressed to 126.96.36.199 will be forwarded to Eth2.
Quiz of this Question