Take the 2-minute tour ×

Possible Duplicate:
How does Subnetting Work?

If you setup a default route in a IP routing table you provide a network mask. What difference does it make if the mask is compared to say

i.e what how does a net mask of affect the default routing of IP packets?


migration rejected from stackoverflow.com Feb 17 at 16:47


marked as duplicate by Iain Aug 3 '12 at 6:54


1 Answer 1

up vote 1 down vote accepted

If you have more than one gateway a decision must be made for each outgoing packet which gateway it should be sent to. This obviously depends on the packet's target address, which must be matched against the available gateways. So maybe you can say: the netmask defines what address range a gateway is responsible for.

Real world effect: you might require different gateways to reach different networks, for example in companies running separate networks for branches or locations.

A netmask of means all outgoing packets are routed through this gateway ("to all nets").

A netmask of means only packets that belong to the same class c network are routed through that gateway. Other packets must be routed using other gateways or don't have to be routed at all (which would be odd...).