Forum Moderators: open
I know how it modifies an IP address - it's kind of like subtraction. But why would anybody want to impliment such a cumbersome step in something that ought to be pretty straight forward and simple?
It almost seems like taking something as simple stating 3 and turning it into 500-497=3.
For example, why for my router is the subnet mask 255.255.255.0 required when all that is really required is it's IP address? For what possible purpose could such a mathematical filter be needed when it doesn't add any great deal of functionality?
Or am I just missing something?
The netmask does add important functionality. It designates which IP addresses are inside your network, and which ones are outside. And thus, your machine can tell whether the traffic needs to go to your router or not. If your netmask is incorrect, chances are that your network will still run, but you may be unable to access certain machines.
As for why it's represented as 255.255.255.0, I bet there's a mathematical reason why, in binary, it's easier/faster for routers to evaluate it in that form. (Speed is very important to a router, because it may need to do many of those calculations per second). Also, it's nice for humans because at a glance, you can tell that it's a netmask. Once you're used to it, the only cumbersome part is saying it out loud.
Still trying to wrap my mind around why it should be deemed necessary to impliment such a step, since it does involve making extra calculations and this could be a detriment towards speed. I just don't see the advantage.
Anyone else?
The more advanced your network topology is, the more important the mask is. And if it's necessary for only some networks, that means everyone has to use it.
For example, imagine if everybody's house address was masked like this. It would be very cumbersome to try and figure out what's what.
People's house addresses are there in the open, unmodified. Same with phone numbers. They work.
Dynamic addressing aside, why not just let an address be an address?
Let's say the only people you ever call on the phone are your next-door neighbors. You might think you should only have to dial 5550 or 5551 to reach them. But the rest of the number is very important to the phone company, even if for you it's always the same.
That's easy. But here's a better example:
Let's say your ISP has assigned you 16 IP addresses. Your workstation is set to an address of 192.168.1.9, with a mask of 255.255.255.240. Just from that, you can calculate the rest of the addresses that belong to you: 192.168.1.8 through 192.168.1.23.
So, any IPs outside that range are remote, and will be passed to the router. Without the mask, 192.168.1.50 for example would be thought to be local... your workstation would try sending it only on the local LAN, and would get no response.
Also, if you have just a modem, and no router, your mask might confuse you even more. But in that case, your computer knows that *all* IP addresses other than your own are outside your home. It can't quite follow the rules in that case, because 255.255.255.255 is not a valid mask.
Here's how you calculate your own mask. Say you're using a DSL router, and your network is 192.168.1.x. Take the lowest IP that's available to you, and convert it to binary.
192.168.1.0 = 11000000 10101000 00000001 00000000
Now, the purpose of the mask is actually to indicate which part of the IP is designating the network, and which part is designating the host. So, use 1's to indicate which part of the address is the network part (in this case, it's the first 3 octets of the IP), and 0's to indicate which is the host part.
192.168.1.0 = 11000000 10101000 00000001 00000000
...... mask = 11111111 11111111 11111111 00000000
The latter is the netmask in binary, and converted to decimal it equals 255.255.255.0.
Here's another example:
Your ISP is allocating you 16 IP's, from 10.11.12.0 to 10.11.12.15. Take the lowest IP, which is your Network Number:
10.11.12.0 = 00001010 00001011 00001100 00000000
Now, your network has 16 IP's, and that would require 4 binary bits to represent. So, the last 4 bits of your IP are the host designation.
10.11.12.0 = 00001010 00001011 00001100 00000000
..... mask = 11111111 11111111 11111111 11110000
And that mask converts to 255.255.255.240.
the netmask is used to "gate" data
Basically. It's really just a modifier that tells whether two addresses are local or remote in relation to each other.
by virtue of which bits get set high and which get set low?
Yes.
a logical "OR" operation
All I did was to turn on a certain number of bits, and call that the mask. But machines will use boolean operations to evaluate the IP against the mask, yes.
I always thought you just set a 4 byte IP address, and so long as the server let you log in, data meant for your computer at your assigned IP address simply went to there, without any complications - like sending a letter or making a phone call.
Is all of this stuff actually written down somewhere for folks like me to understand? There's nothing inherently intuitive about it, so someone somewhere had to put it in writing and make up the rules so it would work, right?
Now one more question? Does the subnet mask actually change the data that flows into your computer, or is it only used to help steer addressing concerns?
I've been trying to read up about this. There are different classes in this? Class A, B and C?
Yes, A, B, and C are the main address classes. The difference between them is in how many addresses can be assigned to a network, but subnetting is used to remove the limitations that the classes impose.
Here are some books [amazon.com] that might help.