Bloodaxe's Realm     The Medieval World  

Subnetting involves dividing an IP address range into two or more separate ranges, called subnets. Although subnetting can be done for a variety of reasons, from departmental to geographic to political, it is usually done to simplify administration in some way. Breaking networks into smaller, easily defined subnets allows the administrator to better address data flow and security and creates a logical map that can facilitate troubleshooting in the event of a problem. Subnetting involves the use of an IP address and subnet mask to determine whether a destination network is local or remote. I'm going to explain the basics of IP addressing, reasons to subnet, and the logic behind slicing up an IP network.

IP addressing
IP addresses are perhaps the most fundamental components of modern networking. They are the identifiers that computers use to talk to each other on a TCP/IP-based network (including the Internet, most corporate networks, and many home networks).

An IP address is a 32-bit number represented in a dotted decimal format. This address is further divided into four sections, with each section representing eight bits or an "octet." So this 32-bit, four-octet number is in many ways similar to a telephone number. Like a telephone number, it must be unique.

Although there are roughly four billion or so available IP addresses, we still need to be picky with how many are given out. With the dawn of the Internet and our increasingly IP-enabled world, every address counts. In the United States, the American Registry for Internet Numbers (ARIN) handles the management of public IP addresses. Typically, addresses are handed out by ISPs and fall under their management. An ISP will have multiple pools of addresses (and subnets) to assign.

Also, as defined in RFC 1918, private networks are available. These are for internal use and are not routed through the Internet. Private addresses look like this: – – –

In IP version 4 (IPv4), the standard that currently dominates the networks of the world, IP addresses fall into one of five classes: A, B, C, D, or E. Classes D and E are for multicast and experimental uses, respectively, and are less common. A, B, and C networks are defined in this table:

First Octet  Class      Subnet mask 
1-127 Class A
128-191 Class B
192-223 Class C

This use of classes represents the original method of dividing networks, but it is somewhat dated. There just isn’t enough middle ground between B and C. While a standard class C network contains 254 addresses (too few addresses for a moderate-size company), a class B network has 65,534 (far too many for the average network). This is where subnetting comes into play.

Reasons for subnetting
Before the advent of subnetting, networks were divided solely on the basis of class. This was a good place to start, but it soon became obvious that greater flexibility would be needed. For one thing, we’re quickly running out of usable addresses in IPv4 as the Internet continues to expand. Since IPv6 (the next version of the standard) is still around the corner, subnetting remains a practical way to get more use of the IPv4 system.

Subnetting is also used commonly in a number of other circumstances. For instance, in a mixed media environment, you usually see a separation between hosts using Ethernet and hosts running on Token Ring. Performance can also be a reason for subdividing one network into two or more. On Ethernet networks, all hosts in the same broadcast domain will need to share the wire. This means a lot of communication is going on, and collisions will rise, increasing latency. If you had an entire class C in one subnet, it would be a good idea to cut it into some smaller chunks to make better use of available bandwidth and to enhance performance.

But subnetting is not just a way to extend class-based IP addresses or solve performance issues; it can also be used for a number of administrative purposes. Creating separate ranges of IPs based on a logical design allows an administrator to more easily view and manage the network. Traffic flows can be better studied and handled, security between subnets is increased, and overall organization is improved.

Learning how subnetting works
Okay, now let’s see how subnetting is actually done. The key player in subnetting is the subnet mask. A subnet mask, also 32 bits, divides the IP address into network and host sections. This allows the sending computer to determine whether routing will be required when communicating to another system. If the computer determines that it is a local address, the packet is sent via Ethernet (or another Layer 2 mechanism). If the address is not local, the packet is forwarded to the default gateway for routing.

First, the IP address is converted to binary, and the network address of the system is determined. The source IP and subnet mask are compared to get this. This is done so we can eventually compare it to the destination network. If they match, the destination is local; otherwise, the packet is forwarded along to a router.