Operating System - Linux
1827990 Members
2241 Online
109973 Solutions
New Discussion

routing basic explanation

 
Mario_106
New Member

routing basic explanation

Hi all,
bellow is a part o routing table

Destination Gateway Genmask Iface
10.0.0.0 0.0.0.0 255.255.255.0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 eth1
0.0.0.0 10.0.0.5 0.0.0.0 eth0

my question is concerning to qateway 0.0.0.0,
what does 0.0.0.0 mean ? There is no gateway ?

Or is there relation between 0.0.0.0 gateway and 0.0.0.0 destination ? (in sence all packets to 10.0.0.0 network go via 0.0.0.0 gw so the destination is also 0.0.0.0)

many thanks

M.
3 REPLIES 3
Vitaly Karasik_1
Honored Contributor

Re: routing basic explanation

"Destination 0.0.0.0" line speaks about default gateway - it means, all destinations which doesn't covered by other rules.

and "gateway 0.0.0.0" means - this box has "direct connection" to this network - in other words, there is ethX in such network.
Mario_106
New Member

Re: routing basic explanation

thanksand default GW is a router with interface to my network that handle all packets going through ?does it follow that all packets which are not going through default gw are packets to my network and are handled via ARP many thanks M.
Stuart Browne
Honored Contributor

Re: routing basic explanation

Ok, a bit of a network/netmask lesson.

The 'destination' is supposed to be the stub of a network address of which to match against the destination address of IP packets that pass through the routing table.

Using the bit-mask of the 'genmask' value, it takes a given path if there is a match.

0.0.0.0/0.0.0.0 works as a default route for the simple reason that *ALL* destination addresses match it.

As packets filter through from the top of the routing table, as they match they get sent down different paths. If all other routes didn't match, the default is taken.

So using your routing table lets set up an example:

Destination address: 192.168.1.32

Packet hits the first route. 10.0.0.0/255.255.255.0. This is not a match.

Packet hits the second route. 192.168.1.0/255.255.255.0. This is a match (the first 3 bytes fully match). The routing table says to send it via the interface 'eth1' (as there is no gateway, it just sends it to the wire). At this point, ARP tables etc. are used.

Packet never hits third route.

Destination address: 10.3.1.9

Packet hits first route. As the genmask is '255.255.255.0', the first 3 bytes have to match. Packet does not match this rule.

Packet hits second route. Doesn't match.

Packet hits thrid route. As this is the default route, it forwards the packet to the machine '10.0.0.5' via eth0.

This making sense? :)
One long-haired git at your service...