For more background, read Parts I and II.
COLLISIONS AND BROADCASTS
If computers in an open network talk freely with one another and two computers start talking at the same time, you have a “data collision.” Collisions may be arbitrated via Carrier Sense Multiple Access/Collision Detection (CSMA/CD), which tells the computers on the network to stop talking and try again at random, usually avoiding a successive collision. With Ethernet switches, these collision domains are broken up because switches provide dedicated paths between hosts. Thus, other computers don’t see that traffic. An Ethernet switch breaks up collision domains.
Nevertheless, each computer needs to announce itself to the network from time to time. It does this by broadcasting to all computers in the network. Ethernet switches do not block broadcasts. However, routers will not pass broadcasts from local hosts. Routers break up broadcast domains.
The subnet mask identifies which bits in an IP address belong to the network and which belong to the host. A subnet mask consists of a contiguous series of ones (1) followed by a contiguous series of zeros (0). It contains exactly 32 bits, broken up into four successive groups of eight bits (octets), in dotted decimal notation. It defines the network portion (designated by the contiguous string of ones), and the host portion (designated by the contiguous string of zeros) of the IP address. The default subnet masks for Class A, B and C IP addresses are:
Click on the Image to Enlarge
Examining an IP address of 192.168.2.10 with the default Class C subnet mask applied, the network address is 192.168.2, and the host address is 10. Let’s discuss how this works:
Consider the IP address 192.168.2.10 and a Class C Subnet masks. Looking at one above the other, we get:
IP Address 11000000.10101000.00000010.00001010
Subnet Mask 11111111.11111111.11111111.00000000
The result is 11000000.10101000.00000010.00000000
This is the network address portion of the IP address. A subnet mask separates the network and host portions of an IP address.
Before 1993, subnet masks were not used. The address class determined the size of the network and the subnet mask was implied but not used. The classes of addresses allowed for some networks to have a great many hosts, while others were smaller. This is called “classful addressing.” Though it still exists, you may never have to deal with classful addressing. Classful addressing means the subnet is fixed by the address class and cannot be altered.
In 1993, Classless Inter-Domain Routing (CIDR) was introduced. IP address classes are ignored by assigning subnet masks. You might use Class A address space (10.x.x.x) and use the Class C subnet mask (255.255.255.0) to manage those addresses. This could create multiple networks in the Class A space, each with a limit of 255 addresses. Or suppose your IT department assigned you address space of 10.34.134.0/23. The /23 is an example of CIDR notation. The /23 says the subnet mask has 23 contiguous ones (1). That means the 23 contiguous ones (network) are followed by nine contiguous zeros (host). So what does this mean? First, let’s see what the subnet mask looks like in binary:
11111111.11111111.11111110.00000000 shows a string of 23 ones. The first two octets each are 255. The third octet’s last bit is zero (0), so is value is 255 – 1 = 254. The subnet mask is 255.255.254.0.
The third octet of the IP address is 134. We can figure out what this is in binary using a table:
First, we ask if 134 is bigger than 128. It is, so we set a 1 beneath the 128.
Next, we subtract 128 from 134. The result is 6. The next number to the right not larger than 6 is 4. We set a 1 beneath the 4.
Now, subtract that 4 from the 6 we had before, and we get 2. The next number to the right that is not larger than 2 is (surprise) 2. We set a 1 beneath the 2, and we have identified the binary ones (1) for the octet value 134. Set the remaining bits to zero (0) and we’re mapped to binary. 10000110 = 134.
In this example, the subnet mask uses the first seven digits of the octet. The last digit is part of the host address space. With 9 bits available for the host address space, you have 512 host addresses including the network and broadcast addresses (more on this later). Your total address space includes the addresses from 10.34.134.0 through 10.34.135.255.
Tom Norman, CPBE, is Project Engineer for Diversified.