Given the following routing table:



Kernel IP routing table
Destination     Gateway         Genmask         Flags   Metric   Ref   Use   Iface
0.0.0.0         192.168.178.1   0.0.0.0         UG      0        0     0     wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U       0        0     0     eth0
192.168.2.0     192.168.1.1     255.255.255.0   U       0        0     0     eth0
192.168.178.0   0.0.0.0         255.255.255.0   U       9        0     0     wlan0

How would an outgoing packet to the destination 192.168.2.150 be handled?

A. It would be passed to the default router 192.168.178.1 on wlan0.
B. It would be directly transmitted on the device eth0.
C. It would be passed to the default router 255.255.255.0 on eth0.
D. It would be directly transmitted on the device wlan0.
E. It would be passed to the router 192.168.1.1 on eth0.

題解

路由表會從最小範圍的網域開始尋找,將IP換成二進制表示後,找出擁有最長相同前綴的那個就是了。由於目標位址是192.168.2.150,所以要看到第3列的路由設定。因此答案是選項E。