IP Subnet (IP Addressing and Subnetting)

matador
Subnetting.pdf

4/18/22, 1:20 AM Subnetting

https://leocontent.umgc.edu/content/scor/uncurated/cca/2218-cca625/learning-topic-list/subnetting.html?ou=736406 1/4

Learning Topic

Subnetting Subnetting is the practice of subdividing a network into several smaller networks.

For the initial design for the TCP/IP protocols (long before the internet was widely used),

there were three network sizes, class A, B, and C, and every network had to be in one of

these classes.

Network Address Range

Number of Networks

Available Number of Hosts in Each Network

Class A (X.0.0.0) 1.0.0.0 – 126.0.0.0

126 16,777,214

Class B (X.Y.0.0) 128.0.0 – 191.255.0.0

16,384 65,534

Class C (X.Y.Z.0) 192.0.0.0 – 255.255.255.0

2,097,152 254

However, with the growth of online activity, there are not enough IP addresses for

networks, and the addresses need to be used more efficiently. Even the smallest Class C

may be too big for some networks and thus wastes precious IP addresses.

This led to the practice of subnetting. The idea is to create a network just big enough to

host the systems on that network.

An IPv4 IP address is 32 bits long. It is usually written as 4 octets (w.x.y.z), where each

octet can be a number between 0 and 255. The 32-bit address consists of network and

host bits. For example, a Class A address will have 8 bits for network bits and 24 bits for

4/18/22, 1:20 AM Subnetting

https://leocontent.umgc.edu/content/scor/uncurated/cca/2218-cca625/learning-topic-list/subnetting.html?ou=736406 2/4

host bits.

This is also where a subnet mask comes into play. A subnet mask will inform the systems

which bits are network bits and which are host bits. For example, a subnet mask for a

Class A address would be 255.0.0.0 (or 11111111.00000000.00000000.00000000 when

written in binary notation). Notice the 1s in the subnet mask are used to identify that the

first 8 bits in the IP address are network bits, and the 0s signify the host bits. This is also

why a Class A address is sometimes written as X.0.0.0/8, where the “/8” is used in placed

of the subnet mask.

For example, suppose a university is given a Class B IP address (25.126.0.0) with the

network part of 16 bits, and the remaining 16 bits of the 32-bit IP address left for host

addresses within the network. It is described by the CIDR notation of 25.126.0.0/16 and

allows for 2 local hosts. The number of usable hosts is actually 2 – 2, because the first

and the last number are used for network and broadcast addresses.

However, even within its large local network, the university may want to have separate

local subnetworks associated with its various departments. This can be achieved by

subnetting.

Given a single local network with n bits for network address and h=32-n bits for host

addresses within the network, subnetting calls for borrowing bits from the host part to

designate a subnet part within the network. If we borrow b bits, the subnet part will allow

for 2 subnets.

The network mask for the network with subnets is extended by b bits.

Because there are h-b bits left in the host part of the address, the number of hosts within

each subnet is 2 .

If our example university wants to have no more than 64 departments, it can borrow 6

bits from the host part of its address space for the subnet part for each department,

allowing for up to 64 subnets. (2 = 64). The network and subnet part of IP addresses will

be of the length 16+6 = 22, leaving 16-6 = 10 bits for the host addresses within each

department’s subnet, which allows for 2 – 2 = 1022 usable hosts per department.

The subnet mask will be 11111111.11111111.11111100.00000000, which is

255.255.252 (/22 in the CIDR notation). The third octet is 252 because it is 255 (all eight

1’s which is 2 -1) minus missing two first powers of 2 (2 and 2 , which adds to 3).

The usable host addresses within each subnet are:

16 16

b

h-b

6

10

8 0

1

4/18/22, 1:20 AM Subnetting

https://leocontent.umgc.edu/content/scor/uncurated/cca/2218-cca625/learning-topic-list/subnetting.html?ou=736406 3/4

Source: UMGC

Note that 25 in binary is 00011001, and 126 in binary is 01111110. They are both

written in full 8-bits format (thus the zeros in front of the number).

The green sections are the original network bits. They are 16 bits long because we started

with a Class B network.

The yellow sections are the 6 bits that we “borrowed” from the host bits. These will

eventually become part of the network bits.

The red sections are what is left of the host bits. We started with 16 and with 6 bits

borrowed, we are left with 10 bits.

As long as routers in the local network know the subnet mask, they will forward the

incoming packets to the proper subnet.

The choice for the number of bits borrowed for the subnet part is a compromise between

the desired maximum number of subnets and maximum number of allowable hosts within

each of these subnets (since the subnet and hosts part sizes need to add to the whole

network’s host part size). If you want s subnets, for the number of bits borrowed, you pick

a number b, which yields the smallest 2 greater than s. If you want to have up to a

specific number of hosts within subnets, the remaining number of bits in the host part

must allow for it.

Subnets

See the following resources for more information:

http://intronetworks.cs.luc.edu/current/html/ipv4.html#ipv4-subnets

(http://intronetworks.cs.luc.edu/current/html/ipv4.html#ipv4-subnets)

b

4/18/22, 1:20 AM Subnetting

https://leocontent.umgc.edu/content/scor/uncurated/cca/2218-cca625/learning-topic-list/subnetting.html?ou=736406 4/4

© 2022 University of Maryland Global Campus

All links to external sites were verified at the time of publication. UMGC is not responsible for the validity or integrity

of information located at external sites.