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 '15 at 16:47

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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...).