GATE | GATE-CS-2004 | Question 55
The routing table of a router is shown below:
Destination Sub net mask Interface 126.96.36.199 255.255.255.0 Eth0 188.8.131.52 255.255.255.128 Eth1 184.108.40.206 255.255.255.255 Eth3 default Eth2
On which interfaces will the router forward packets addressed to destinations 220.127.116.11 and 18.104.22.168 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.
22.214.171.124, matches with 126.96.36.199 and 188.8.131.52, 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 184.108.40.206 will be forwarded to Eth2.
Quiz of this Question