Netmask

The last post talked about how to find your gateway, also known as your first hop.  In the output to netstat there was a weird thing called a Genmask.  We’re going to talk about that and something called a netmask this time.

It isn’t the same thing as the mask Batman wears.  It isn’t even the same thing as the helmet Iron Man wears.  It’d be cool if it was, then we could have a helmet over the computer and wouldn’t that just be too cool for words?  But it isn’t, it’s just a fancy way of saying something else.

So the first thing, your computer is part of a local network.  It might not seem that way because you’re using a cable provider or DSL or wireless at a library or however you’re using the Internet, but there’s a local network your computer is part of.  We’ll pretend it’s 256 computers.  It makes things easier to begin with.

The first part of your IP address is the network that it is a part of.  So if your IP address is 192.168.0.25 then the network part of that IP address is 192.168.0.  (Why is that true?  Remember how I said that every part of an IP address is a number between 0 and 255? So that last dotted quad can be any number between  0 and 255 and there’s 256 numbers right there.)

Back to talking about networks!  We now know what your network is, that’s a start.  We also know that there’s 255 possible other IP addresses in that network.

The netmask (or subnet mask or network mask your choice!) is another way of saying this.  The netmask for your network is 255.255.255.0.  That means that the first three quads are fixed and the last is allowed to roam free!  Free!  Free as a bird!

Wait, I digress.  It also means that those are the computers you don’t need routing for because you’re all together.  There’s all different sizes of networks, next time we’ll talk about some more and how we write them in shorthand notation.

Wait, I almost left off genmask!

Alpha:~ computerlamp$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.0.2.0       0.0.0.0         UG        0 0          0 eth0

If 255.255.255.0 means that that last quad can be anything, then 0.0.0.0 means that, well, anything goes!  You can put any IP address in those spots that you want  In other words, this Gateway (192.0.2.0) is how you get anywhere from your computer, no matter what.

Leave a Reply

Your email address will not be published. Required fields are marked *