Networking Guide
Chapter 3, Administering TCP/IP

Creating subnets

Creating subnets

In TCP/IP, the DARPA Internet support includes the concept of the subnet, sometimes called a subnetwork. This is a mechanism that enables several local networks to appear as a single Internet network to off-site hosts. You should consider using subnets in the following instances: 

Setting up a subnet consists of:

To set up subnet addresses, you must use a segment of the host portion of the IP address to use as the subnet address. For example, consider the following IP addresses and netmasks:


For class A and B networks, you can create subnets by converting the second and third octets, respectively, from host addresses to subnet addresses. Notice how the netmask changes accordingly:

The class A network 16 can now have up to 254 subnets (16.1 - 16.254). The class B network 132.147 can also have up to 254 subnets (132.147.1 - 132.147.254). While the netmask masks the network portion of the address, the broadcast address exposes the network address and hides the host portion. For example, the broadcast address for the subnet 132.147.246, with a netmask of 255.255.255.0, is 132.147.246.255.


NOTE: The subnet portion of the network address cannot consist of all binary zeros (0) or ones (255). See RFC 950 for more information.

For more information on setting netmask and broadcast addresses, see Appendix A, ``Configuration parameters'' in Configuring Network Connections.

Partitioning a class C address is slightly more complex, as you must take a portion of the fourth octet as the subnetwork. For example, you might partition the first three (high order) bits of the fourth octet to represent the subnetwork, with the last five bits representing the host:

This scheme allows for up to 6 subnets of 30 hosts each, for a total of 180 hosts. The netmask for the hosts on these subnets is 255.255.255.224; 224 is a decimal representation of the binary octet 11100000, which masks the subnet portion of the IP address.

Possible subnets for the class C network 221.138.62.0, with associated broadcast addresses, are:

 ----------------------------------------------------
 Subnet           Hosts       Broadcast address
 ----------------------------------------------------
 221.138.62.32    .33-.62     221.138.62.63
 221.138.62.64    .65-.94     221.138.62.95
 221.138.62.96    .97-.126    221.138.62.127
 221.138.62.128   .129-.158   221.138.62.159
 221.138.62.160   .161-.190   221.138.62.191
 221.138.62.192   .193-.222   221.138.62.223
After you determine the new addresses for your hosts, you must configure them with the Network Configuration Manager or by editing /etc/tcp. In addition, you must configure gateways between your subnets: these are hosts with multiple networking cards that serve more than one network.