Click to See Complete Forum and Search --> : subnet mask kicking my butt!
Okay, I bought a book on networking and it has been really helpfull so far.
But as a newbie, I am not grasping subnet masks. I understand how the IP addresses are set up. The binary to decimal conversion, the different classes (A,B, & C) of IP addresses, the hostid and netid, but not how the subnet works.
I did search google for this and though I found many tutorials, none of them made it click for me. I really don't want to go any further in my book until I grasp subnet masks.
If anyone has a secret that may help it click for me I would appreciate it.
cowanrl
03-30-2003, 03:05 PM
I'll try to explain it without going to deep.
As you mentioned, the IP address has 2 parts, the netid and the hostid. The subnet mask is what determines what portion of the address is the netid and what portion is the hostid.
It helps if you think as the IP address and netmask as binary numbers, not decimal numbers. An IP address in binary would look like:
xxxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx
Of coursethe x's would be1 or 0 depending on the address.
The subnet mask would also be shown as 4 binary octets. 255 is 8 ones and 0 is 8 zeros. Whatever portion of the subnet mask is ones indicates the netid, the portion of the subnet mask that is zeros indicates the hostid.
For example, 10.1.1.1 with a subnet mask of 255..0.0.0 would like this with the mask shown above the ip address:
11111111.00000000.00000000.00000000
00001010.00000001.00000001.00000001
The portion of the subnet mask that is all ones is the 10 part of the IP address. That's the netid. The portion of the subnet mask that is all zeros is 1.1.1. That's the hostid.
If you changed the netmask to 255.255.0.0 it would look like this:
11111111.11111111.00000000.00000000
00001010.00000001.00000001.00000001
netid 10.1, host id 1.1
192.168.1.1 with a netmask of 255.255.255.0 would be:
11111111.11111111.11111111.00000000
11000000.10101000.00000001.00000001
The portion of the subnet mask that is all ones is the 192.168.1 part of the address. That's the netid. The portion of the netmask that is all zeros is .1. That's the host ID.
It basically has to do with ANDing the two binary numbers together. If you're not familiar with ANDing binary numbers, read up a little more on the binary number system.
Hopefully that will help you some.
What about a subnet mask of 255.255.255.224? Well, if you have a grasp on the first part and you'd like me to attempt to explain it, let me know.
homey
03-30-2003, 03:06 PM
First off I must really recommend a neat (free) tool from http://www.boson.com called a subnet calculator.
I also use a tool which I learned before Grade School. That is to say I count with my fingers. :) :)
Drop your thumbs and you have 8 digits, which is what we need.
Counting from the right to the left, we have...
Block Size or number of addresses allowed by a particular subnet mask.
128......64......32......16.........8.........4... .....2........1
128.....192.....224.....240.....248.....252....... 254.....255
Subnet Mask Value Add the Block size to the one on it’s right to show a subnet mask value. For instance, 128 + 64 = 192, 192 + 32 = 224, 252 + 2 = 254
Using that information, we can do some subnet calculating to find out what IP addresses are allowed by the subnet mask. If I have an IP address of 192.168.1.2 and a subnet mask of 255.255.255.240 I can see that the number above 240 is 16. (Block size )
One thing to note is that the first and last IP address in a Block can’t be used. That is because the first one is what’s called the SUBNET ADDRESS and the last one is the BROADCAST ADDRESS.
Example IP address 192.168.1.2
Subnet Mask 255.255.255.240
This gives us a Block size of 16
Valid IP addresses in each subnet (computers which are on the same network)
Subnet Address 192.168.1.0
Valid Addresses 192.168.1.1 through 192.168.1.14
Broadcast Address 192.168.1.15
Then the next group of addresses would look like this....
Subnet Address 192.168.1.16
Valid Addresses 192.168.1.17 through 192.168.1.30
Broadcast Address 192.168.1.31
cowanrl- 255.255.255.224
would be 11111111.11111111.11111111.11100000 (binary wise, correct?)
which would mean that the first three digits of my last octet in my address would also be allocate to a netid with the last 5 digits for a hostid.
From what I am gathering, the subnet "borrows" space from your hostid by signifying it with 1's. It uses these "borrowed" digits to extend your netid range and with a give-and-trade of less hostid's. At least in the case of a Class C IP address?
It seems I grasp the binary/decimal conversion (a bit better anyway). I think I am starting to see the light with the how the subnet affects the IP in relation to hostid. I think it only gets confusing when it use part of an octet like 255.255.255.224.
homey - that is an excellent way for me to figure the actual addresses. I shouldn't easily forget that...I hope.
so in each case of a having a given IP if my subnet is 255.255.255.240 I will have 16 (14 actual) addresses?
homey
03-30-2003, 06:21 PM
mi6,
Glad to help! :)
Yep, with the subnet mask of 255.255.255.240 the block size remains the same. You can keep on going to find other sets which can be used with that mask until you use them all up.
subnet address 192.168.1.32
valid addresses 192.168.1.33 through 192.168.1.46
broadcast 192.168.1.47
subnet address 192.168.1.48
valid addresses 192.168.1.49 through 192.168.1.62
broadcast 192.168.1.63
subnet address 192.168.1.64
valid addresses 192.168.1.65 through 192.168.1.78
broadcast 192.168.1.79
subnet address 192.168.1.80
valid addresses 192.168.1.81 through 192.168.1.94
broadcast 192.168.1.95
like that and beyond!
bandwidth_pig
03-30-2003, 06:30 PM
Originally posted by mi6
cowanrl- 255.255.255.224
would be 11111111.11111111.11111111.11100000 (binary wise, correct?)
which would mean that the first three digits of my last octet in my address would also be allocate to a netid with the last 5 digits for a hostid.
From what I am gathering, the subnet "borrows" space from your hostid by signifying it with 1's. It uses these "borrowed" digits to extend your netid range and with a give-and-trade of less hostid's. At least in the case of a Class C IP address?
It seems I grasp the binary/decimal conversion (a bit better anyway). I think I am starting to see the light with the how the subnet affects the IP in relation to hostid. I think it only gets confusing when it use part of an octet like 255.255.255.224.
Shouldn't be confusing. I think you have it figured out. It's just like you said. You have borrowed three bits from the host portion of a class C to create additional networks. Same concept applies to class B and class As as well. The whole purpose of the netmask as I understand it is so that routers can tell that you have stolen bits from the host ID portion of the address. Otherwise they would have no way to tell when people have borrowed these bits. For example, you know that if you see a mask of 255.255.255.0 your looking at a Class C where no bits have been used from the Host ID portion of the address block. If you see 255.255.255.224, you know additional bits have been robbed to create additional networks. The next way for you to look at this is:
How many bits do I need to rob from a network address portion of a class C to create X amount of networks leaving X amount of hosts for each. You have this figured out a lot more than you are giving yourself credit for in my opinion. BTW...a couple of great additions to your library if you haven't read them yet:
Routing TCP/IP Vol 1 from Cisco Press
Routing TCP/IP Vol 2 from Cisco Press
Both of these go into great depth. I'm reading Vol 1 myself right now. If I could find a good book on MPLS I'd be set. But then again, I'm sort of new to IP routing myself. I have done lots at layers 1, 2, and 4. This is something I am just learning too.
homey- ALRIGHT! Gotcha, I am on seeing the light now! :D
bandwidth_pig- Thanks, I am glad to hear that my understanding is correct. I will give those books a shot once I finish mine. Sadly what I am reading is a total beginners book to networking. I just couldn't bare moving on in the book until I was sure I understood how subnet masks were used.
cowanrl- thanks for teaching a man to "fish"
Much appreciated guys, hopefully I can help pass this knowledge on to someone as well.
LrngTheHardWay
04-01-2003, 12:29 AM
Originally posted by mi6
Sadly what I am reading is a total beginners book to networking.
Everyone gets themselves started pretty much in the same place.....I'm handing down my old books to the kids to thoroughly pollute their minds--according to my ex-wife.
I just couldn't bare moving on in the book until I was sure I understood how subnet masks were used.
You wouldn't believe how many folks stop learning TCP/IP just about where you are currently....some of them actually have the audacity to look for work as NetAdmins later on in life.
My hat's off to you. :D Keep it up, as it's a fascinating field of study.
LrngTheHardWay - Fascinating for sure! I didn't realize how much I didn't know about networking until I got a beginners book. I am about half way through and seem to have a pretty good grasp on the material.
The whole networking study started from a Samba/Windows network I set up about a week ago. I got it to work, file share, print share, but I had very little idea what I had done to get it to work. :P
One nice thing about Networking Books is that I can sit and read them without just on my computer continously. Which is nice in my case because I a moving!