LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Ifconfig and network masks (https://www.linuxquestions.org/questions/linux-networking-3/ifconfig-and-network-masks-861867/)

baltazar3 02-10-2011 11:38 AM

Ifconfig and network masks
 
I have been reading up on networking basics, and I have have one question which I couldnt find the answer to although I googled quite a bit.

What is the network mask for a interface actually used for. Here I mean the network mask that is set when you configure the interface with ifconfig. I know that it separates the network address from the host address, and I understand how network masks are used in the routing table. What I dont understand is why every interface needs its own netmask. Wont packages get routed correctly regardless of this value as long as the routing table is configured properly?

I did a little bit of testing and didnt notice any difference (just tested pinging) when setting this parameter to strange values.

paulsm4 02-10-2011 12:15 PM

Hi -

Google for "TCP/IP subnet mask".

Essentially, every 32-bit IP address consists of two parts: the "network" a host resides in, and the "host#" within that network. The "subnet mask" basically determines which bits are part of the subnet address, and which bits part of the host address. Among other benefits, this allows more granular administrative control.

wpeckham 02-10-2011 02:00 PM

More about sibnet mask
 
It also defines the subnet, or range of addresses, for which a direct network should exist. For that subnet routing should not be needed, all other traffic goes through the default route unless there is a specific routing that overrides.

baltazar3 02-10-2011 06:06 PM

Quote:

Originally Posted by wpeckham (Post 4254405)
It also defines the subnet, or range of addresses, for which a direct network should exist. For that subnet routing should not be needed, all other traffic goes through the default route unless there is a specific routing that overrides.

If routing is not needed on that subnet, then it should be possible to send and receive packets on the subnet with an empty routing table. But this dosent work for me.


All times are GMT -5. The time now is 09:11 AM.