The last editionof this column discussed subnet masks and the nature of IP addressing. In this and the following column, we will begin discussing what subnetting means and how to do it. First, though, we need to discuss some other basic stuff.
A network may be sub-divided into smaller units called “subnets.” As we will discuss, a subnet may be sub-divided into smaller subnets. There are specific rules for how to create subnets.
NETWORKS, GATEWAYS & BROADCASTS
Each network and each subnet must have a network address and a broadcast address. These are always the smallest address in a network and the largest address in a network, respectively. Consider an array of IP addresses of 192.168.1.0 through 192.168.1.255, using the subnet mask 255.255.255.0. With the smallest address in the array being 192.168.1.0, this is the network address. The largest address in the array is 192.168.1.255, this is the broadcast address. The network address and the broadcast address may not be assigned to Hosts. Therefore, for any subnet, the number of available host addresses is equal to the number of addresses in the subnet, minus two. Gateways must be assigned among the remaining available addresses. It is common, but not required, for gateways to occupy the address adjacent to the network address. In this example, that would be 192.168.1.1.
WHAT IS A DEFAULT GATEWAY?
Imagine you are living in a large apartment building with several floors and many apartments on each floor. Apartments on the first floor might have numbers beginning with one, apartments on the second floor may have numbers beginning with two, and so on. Regardless, the apartment building has a street address that all the apartments share. For mail to get to your apartment, it first has to come to the street address; in an IP sense, the street address is the “gateway” to your apartment. A message from another apartment in the building can get to you without going outdoors. For a message from outside your building to get to you, it has to come through the building’s door. This is a bit like how a “default gateway” works—it’s the passageway in and out of your subnet.
So let’s say the IP address of your computer is 10.24.24.120, with a subnet mask of 255.255.255.0. This means the first three octets of the IP address are the network. Your PC can only talk directly with other PCs in its network, so the default gateway needs to be in that network. Maybe the network admin has set it to be 10.24.24.1. This means that when you talk to computers outside your network, you are sending your communications first to 10.24.24.1, which then forwards them.
IPv4 SUBNETTING BASICS
Before talking IPv4 subnetting, let me mention that there are two IP addressing schemes. IPv4 uses the dotted decimal notations we have been talking about, while IPv6 uses an entirely different system with enough address space (so I have heard) to count all the stars in the known universe with room left over. In these articles, we are talking only of IPv4. It is also worth mentioning that IPv6 will become more and more a part of everything as time goes by, because the public address space in IPv4 has been used up entirely. However, the private IPv4 address space is virtually infinite because these addresses cannot be used on the public internet. Therefore, they can be re-used over and over in any number of locations.
Subnetting gives you the power to create (sub) network spaces. I like to use the analogy of a sheet of paper. Think of the surface of a sheet of paper as the addresses in a network. If you fold it in half, then unfold it, there will be a crease dividing the paper into two smaller parts. Now you have two sub-networks, with the original number of available addresses split between them. Take another sheet of paper and fold it twice. When you unfold it, you will have two creases that divide the paper’s surface into four parts. If you had made a third fold, you would have eight parts, and so on. Each fold doubles the number of parts, with the individual parts becoming smaller with each fold. If the paper is the network, each part is a subnet. Each fold reduces the number of addresses available for each subnet, but doubles the number of subnets.
Suppose you have a request for seven subnets. If you fold the paper once, you have two subnets. If you fold twice, you have four. If you fold a third time, you have eight. Thus, three folds give you seven subnets with one left over.
Next article, we’ll get a bit more into the meat of IPv4 basics.
Tom Norman, CPBE is project engineer for Diversified.