|That's a good tutorial mikelinus|
I'm a big fan of learning the binary of subnetting when learning it. For me it helped make sense out of it all.
When I have need of a quick check and I have a computer and the internet handy I use the following online subnet calculator.
Knowing your CIDR notation is a huge help in subnetting. When first learning how to subnet I made up a cheat sheet I've been using ever since when I don't have a computer handy. I tend to not draw the sheet out anymore as I pretty much have it memorized now after so many years of using it.
It consists of a single octet. I make eight vertical lines (spaced) and on top of each line going from right to left I show the 2^ exponent. Right to left it's 2^0, 2^1, 2^2 etc on to 2^7 Then, above that I write the result of the exponent. Again, right to left, 1 (2^0 = 1), 2 (2^1 = 2), 4 (2^2 = 4), 8 (2^3 = 8) etc, 16, 32, 64, 128
Then on the bottom, I sum the results of the exponents on top going this time from left to right, 128, 192 (128 + 64 = 192), 224 (192 + 32 = 224), 240 (224 + 16 = 240) etc, 248, 252, 254, 255
If you write it out on a sheet of paper like that, you can calculate your subnet mask from it easily.
So with regard to the question above: "How many subnets and hosts per subnet can you get from the network 172.30.0.0/26?" You know at a glance that:
/26 means you're subnetting in the 4th octet and the 172.30.0.0 tells you it's a Class B address. Your first 24 bits are the first 3 octets. Knowing that, I now know I have 2 bits remaining. If you use the cheat sheet, count 2 bits into the 4th octet (left to right always) and get a mask of (second place from left) 192 (128 + 64 = 192)
You have 10 network bits and 2^10 = 1024 networks (Class B subnet, masked in the 4th octet = 8 bits for third octet plus 2 bits in 4th octet giving you the 10 "network" bits)
You have 6 host bits and 2^6 = 64 hosts per subnet (apply the n-2 rule and you get 62 actual usable addresses per subnet)
Double check my math on the online subnet calculator if you'd like but I'm pretty sure I've got it correct. NOTE: I did this without drawing up my cheat sheet. Like I said, I have it memorized I've done it so many times.
I hope this makes sense.
If you can't get the cheat sheet right, let me know I'll draw it up, take a pic and post the pic.
It matters not how straight the gate,
How charged with punishments the scroll,
I am the master of my fate;
I am the captain of my soul.
message edited by Curt R