2
votes

Route command output:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.10    0.0.0.0         UG    0      0        0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
$

From the above output the following are the doubts I have:

  1. What is 0.0.0.0 means in destination and gateway column
  2. If the packet is sent from 192.168.2.36 ip, what is the gateway for that. It use 192.168.2.10 or 0.0.0.0
  3. Lets consider I have one more network with ip 192.168.1.0. If the packet is sent from any of the host from this network, what is the gateway for that ip.
  4. What is default gateway.
1

1 Answers

2
votes
  1. On the first line, 0.0.0.0 in Genmask means there is no mask, i.e. in combination with a destination of 0.0.0.0, it means all destinations (the default gateway definition). On the second line, 0.0.0.0 in the gateway column means no gateway (directly connected the local subnet).

  2. When routing, it does not matter where you are sending from, but where you are sending to.

  3. Packets sent to network 192.168.1.0 will be routed using gateway 192.168.2.10, since the first line is the only one that matches destination 192.169.1.0.

  4. 192.168.2.10 (see answer 1).