Ok. Today's tutorial, by request, will be on subnetting. I won't cover the history of TCP/IP. If someone is interested in that, I have provided some links that cover that aspect of TCP/IP and the Internet.

Suffice it to say that due to the needs of the founders (funders?) of the then-ARPANet, now big I Internet, wanted a network that would remain up and running even if sections went down. They needed a network that had built in redundacies in it and had methods of re-routing information. This requirement meant that each machine, or host, had to have an address that could be accessed and remembered while yet being efficient.


TCP/IP is a layered protocol and we find addressing at the Internet Protocol layer. The address used for hosts is a 32-bit address (to understand how binary works check out the tutorial on Hexadecimal-Binary-Decimal - http://www.antionline.com/showthread...hreadid=124423). This means that the address looks like this:

0000000000000000000000000000000

Boy! That's a lot of bits. In fact, that means that the Internet can have up to 4,294,967,295 (or roughly 4 billion addresses). But, I don't think I'd remember an address like 11000000101010000000000000000100 (this happens to be an internal IP address for one of my machines =)..). This is a little difficult to remember, especially with over 4 billion potential addresses. To make it a little more easier, the "dotted-decimal" format is used for addressing. So my bit address ends up as 11000000.10101000.00000000.00000100 or in decimal form, 192.168.0.4.

But it's important to know how to do to the binary form as this will help with the subnetting portion. When we subnet, we divide up the address in the network and host form based on the number of hosts (computers) we need/have on a network. To help us with this task of separating out the network portion (needed by routers to route packets around) from the host portion of the IP address. So if I use my example from above I have the following:

IP address: 192.168.0.4
Subnet mask: 255.255.255.0

This would mean that my host address is represented by the 4 and the network by the 192.168.0. Now how did I get to that? Well, here's how:

192.168.0.4 = 11000000.10101000.00000000.00000100
255.255.255.0 = 11111111.11111111.11111111.00000000

The subnet mask tells the router what portion of the IP address is masked for the network. In this case, the first 3 octets. The last octet represents the host address. Now, that is pretty straight forward. But here's a challenge: how many machines can I have on this network?

Well, first we need to identify a couple of things. 192.168.0.0 and 192.168.0.255 are not valid IP addresses. They represent broadcast addresses or network addresses. As such, the all 0 bits or all 1 bits in an IP address are considered invalid. So that leaves me with 1-254 or 254 addresses, which means I can have 254 uniquely identified hosts on this subnet. Great! Now to win a lottery and find room in my itty bitty apartment. =)

Ok. Now, on the off chance I win the lottery, buy a huge house and fill it with 300 Large Sun Fire 15K Servers (and if you really want to see an expensive computer visit here:
http://store.sun.com/catalog/doc/Bro...html?cid=70636 and yes, you CAN buy it online), then the ip scheme above won't work. Hrmmm. Aha! If I subnet it to account for my 300 kick-ass Sun boxes plus my 2 Macintoshes, 2 linux boxes and 2 windows machines, then maybe I could do it.

In addition, I will add a little room for growth. Let's see. I might need to get a few more laptops from IBM (T- or R- Series of course) and maybe a Ti-book from Apple. Ok. So, we'll say about 320 machines.

Now, I could be lazy and do one of two things: create another network, say 192.168.0.xx and 192.168.1.xx or change the subnet mask to 255.255.0.0. Now, the addition of a second network it gets a little mind-numbing. I never remember my present address let alone trying to remember multiple networks.

And changing the subnet mask will have even more serious reprecussions: it might tempt me to buy even more machines (the cats might feel unloved as a result). You see if the address becomes (if we use our handy dandy example again):

IP Address: 192.168.0.4
Subnet Mask: 255.255.0.0

192.168.0.4 = 11000000.10101000.00000000.00000100
255.255.255.0 = 11111111.11111111.00000000.00000000

This means that I could have 65,533 hosts on this network. That's a lot of machines. All I need is 320. Hrmm. If I change 320 into binary I get 1 0100 0000 or I use nine bits. This would actually give me 511 hosts but is the next available number up from 254. So for me to have 320 I need to use the last 9 bits for the host address. That leaves me with 23 bits for the subnet mask. So, I would end up with a subnet mask of:

IP Address: 192.168.0.4
Subnet Mask: 255.255.254.0


But I haven't won the lottery. Sucks. I still have my 6 machines and I really don't need the rest of those addresses. I can better utilize my IP addresses by changing my existing subnet mask, 255.255.255.0, to perhaps 255.255.255.248. This leaves me with a exactly 6 hosts on my network. If I want to expand on that in the future I might change it to 255.255.255.240, allowing me 15 hosts on my network.

All you need to remember is how many hosts (machines) you need on a network and go from there. If you want some exercises to help you go through this, please do not hesitate to ask.

For further information on TCP/IP the following are recommended references by moi (for what they are worth!) =)


History of Internet References

http://www.isoc.org/internet/history/brief.html

Other TCP/IP Resources - Books

TCP/IP Illustrated, Volume 1: The Protocols, Richard Stevens, Addison Wesley, 1994

Internetworking with TCP/IP, Volume 1: Principles, Protocols, and Architecture, Douglas E. Comer, Prentice Hall, 1995

Other TCP/IP Resources - Websites

http://compnetworking.about.com/cs/tcpipaddressing/

http://support.microsoft.com/support.../Q164/0/15.asp

http://www.cisco.com/univercd/cc/td/...ito_doc/ip.htm

Terminolgy References - Websites

http://www.dictionary.com

http://www.acronymfinder.com