4
lanix@lanix ~ $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.138      0.0.0.0         UG    0      0        0 wlan0
10.0.0.0        0.0.0.0         255.255.255.0   U     9      0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

I am having some difficulty in understanding the 0.0.0.0 entries in the Gateway and Genmask columns.

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         10.0.0.138      0.0.0.0         UG    0      0        0 wlan

I understand that the destination (0.0.0.0) is the least specific match meaning packets which do not match the other routes will use this route. However I do not understand the corresponding Genmask entry (0.0.0.0).. Packets which do not match the other routes will be sent to the gateway 10.0.0.138 but what is the subnet mask? 0? 10.0.0.138/0 looks a bit odd. Shouldn't it be something like /32? As in the gateway is a single address..

Thanks.

user
  • 1,589

1 Answers1

6

A simple misunderstanding: The netmask refers to the destination address, not to the gateway address, of course. The gateway must be a single address as you cannot send packets to a subnet. I.e. it's 0.0.0.0/0.0.0.0 which (as you already understood) just describes the default route.

You should get used to use ip route instead of route.

Hauke Laging
  • 90,279
  • Alright, great. Just to clarify something - for the private addresses below, they have a gateway of 0.0.0.0. I know that private addresses should be non-routable, but does the gateway of 0.0.0.0 mean that they will go through the 10.0.0.138 gateway? – user Feb 08 '15 at 21:05
  • 4
    @Amrita Gateway 0.0.0.0 means that the subnet is link-local i.e. there is no gateway involved, the packets are delivered directly to the target. – Hauke Laging Feb 08 '15 at 22:12