By Joshua Erdman
This article goes in depth on TCP/IP addressing with the use of subnet masks. Before you continue, be sure you have a good grip on counting with binary, we have provided a quick binary primer if you need a refresher.
A MAC address (Media Access Control) is a unique address given to each network host (this includes computers, PLCs - prorammable logic controllers, routers, switches, and wireless devices. This does not include hubs). In other words anything that makes a decision about the flow of network traffic or talks on the network itself. For more information, read our article on MAC addresses.
Clue: Think of a MAC address like a person's diver's license number, it is just a number that is unique from anyone else's. Now think of an IP address like a person's mailing address. The mailing address group people into zones by using the zip code, city, state, and street identifiers.
The IP address provides the grouping capability that MAC addresses do not. An IP address not only groups addresses but it can be freely assigned and moved from one host to another. It has a mechanism for grouping so that a host would know what computers are neighbors so that communication to a host that is local could be direct and comminication to a distant host could be efficiently routed.
TCP/IP addressing is actually in binary; even though everyone is used to seeing TCP/IP addresses using four numbers ranging from 0 to 255 the reality is, the address is binary but for us humans it is displayed in decimal format. If you convert an IP address from decimal numbers to binary, you will get four 8-bit binary numbers for a total of 32 bits.
Early on, to get IP address space on the Internet you were assigned a class A, B, or C block of addresses. A class A block was an address similar to: 124.xxx.xxx.xxx Where the Xs are address numbers between 0 and 255.
Since each segment of an IP address is 8 bits long, a class A address block would give you 2 to the power of 24 (32 bits in total address length, - 8 bits used up for the network block address that was assigned; 124.XXX.XXX.XXX it is the 124 in this case). That is almost 16.8 million IP addresses! Class B address blocks were: 212.156.XXX.XXX (2 to the 16th power) 65.5 thousand address and a Class C network would give you 256 addresses. Below is a table of how each class network was divided.
|Class||Address Range||Total Hosts||Number of blocks|
|D & E||184.108.40.206-
I also listed the Classes D & E which are out of the scope of this article. Class D networks are for multicast and class E have been reserved.
There is something significant about the addresses for a Class A, B, and C Block. If you were to convert the decimal value of each class to binary you can see that there is a pattern in the most significant bits. See table below:
|Class||First 4 bits|
Although this pattern made it immediately obvious to routers what type of address block they were dealing with, it was also very innefficient with the address space.
Similar to the first 3 bits of an IP address that make a class, the subnet mask is now used instead to determine the size of an address block. Most people are familiar with an address followed by a subnet mask of 255.255.255.0 Calculated out, this subnet mask allows for 254 hosts. So if the address of a computer is 220.127.116.11 and the subnet mask is 255.255.255.0 there are 253 other addresses on this network block ranging from 18.104.22.168 - 22.214.171.124 (the .0 and .255 addresses are reserved and cannot be asigned to a network host).
From this a newbie can easily surmise that an address of 126.96.36.199 with a subnet mask of 255.255.0.0 allows for 256 times 256 minus 2 addresses (65,534 addresses). These addresses range from 188.8.131.52 to 184.108.40.206 Again we subtract two from the total number because of those two reserved addresses that are at the beginning and end of the block.
Clue: Determining the number of hosts in your subnet is
always done by caculating the number of bits used for the host address (there
are 8 bits for a mask of 255.255.255.0 for example). Set 2 to the Nth power
where N is the total number of host addrress bits, then subtract 2.
In other words (2^8) - 2 = 254.
Clue: All address blocks (subnets) will be 2 less of each power of 2: 6, 14, 30, 62, 126, 254..... That is because in each address block we must reserve space for a broadcast and a network ID. The network ID is the first address (such as 192.168.0.0) and the broadcast is the last address (192.168.0.255)
Unfortunately if you leave yourself with only the ability to declare subnet masks using the number 255 or 0 you have very few options. The smallest subnet you can make is 254 hosts. The next article is where the real lesson begins!