Open In App

Subnet Mask Cheat Sheet

Last Updated : 08 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

A Subnet Mask is a numerical value that describes a computer or device’s how to divide an IP address into two parts: the network portion and the host portion. The network element identifies the network to which the computer belongs and the host part identifies the unique computer on that network. An IP address is made up of four digits separated by dots, for example, 255.255.255.0 and each number can be between 0 and 255, with higher values using more bits for the network and lesser values for the host. A subnet mask allows devices on the same network or across networks to interact with each other. Every system has a unquine IP address.

In this Subnetting Cheat Sheet, you’ll learn all the basic to advanced subnetting concepts, including CIDR notation, and IPv4 subnet masks ranging from XX.XX.XX.XX/0 to XX.XX.XX.XX/32, IPv4 wildcard mask values, classification of IPv4 addresses from Class A to Class E, and more.

Subnet-CheatSheet

Additionally, In this Subnetting Mask Cheat Sheet, you will also explore private IP addresses, special IP addresses, and bogon IP addresses, further enhancing your knowledge of network addressing.

What is Subnetting?

Subnetting is the technique of dividing one big network into multiple small networks. Subnet makes the network more efficient and easy to maintain. Subnets provide a shorter path to network traffic without passing through unnecessary routers to reach their destinations.Subnetting makes network routing much more efficient.

How Does Subnetting Work?

Let’s assume what happens when there is no subnetting in a Large network that has a million devices connected to them and they have their unique IP Address. Now, what happens when we send some information in that network from one device to another? In that case, our data/information passes through most of the unnecessary routers or devices until they find a destination device.

How Subnetting Works?

How Does Subnetting Works?

Now, think we divided the same network into smaller subnetworks. This helps make the routing of data more efficient. Instead of searching through millions of devices to find the right one, routers (check if the destination IP address falls within their range of subnet devices. If it does, they route the packet to the appropriate device. If it doesn’t, they forward the packet to another router) can use something called a subnet mask to determine which subnetwork a device belongs to.

What is Classful Addressing and Classless Addressing?

In Classful Addressing, we divided IPV4 Network into 5 classes(Class A, Class B, Class C, Class D, Class E) of fixed length. In Classful addressing IP addresses are allocated according to the classes- A to E. In this Scheme, Network ID and Host ID changes depend on the class.

On the Other Hand, CIDR or Class Inter-Domain Routing was introduced in 1993 to replace classful addressing. It allows the user to use VLSM or Variable Length Subnet Masks. So, there is no such restriction of class in classless addressing. The wastage of IP addresses has been improved after CIDR Addressing.

What is CIDR?

CIDR or Class Inter-Domain Routing allows the user to use VLSM or Variable Length Subnet Masks in order to make IP address allocation and IP routing that allows more efficient use of IP addresses.

Rules for forming CIDR Blocks:

  • All IP addresses must be contiguous or sequential.(NID=network ID , HID=host ID)
  • The block size must be the power of 2 (2n). If the size of the block is the power of 2, then it will be easy to divide the Network. Finding out the Block Id is very easy if the block size is of the power of 2. Example: If the Block size is 25 then, Host Id will contain 5 bits and Network will contain 32 – 5 = 27 bits.

What is CIDR?

  • The first IP address of the Block must be evenly divisible by the size of the block. in simple words, the least significant part should always start with zeroes in Host Id. Since all the least significant bits of Host Id are zero, then we can use it as the Block Id part.

Example: Let’s check whether the IP address block from 192.168.1.64 to 192.168.1.127 is a valid IP address block or not?

  • All the IP addresses in the block are contiguous.
  • Total number of IP addresses in the block is = 64 = 26
  • The first IP address in the block is 192.168.1.64. We can observe that the Host ID contains the last 6 bits, and in this case, the least significant 6 bits are not all zeros. Therefore, the first IP address is not evenly divisible by the size of the block.

As a result, this block does not satisfy the criteria for a valid IP address block, and therefore, it is not a valid IP block.

Working on IP Address Block

An IP address is a 32-bit unique address having an address space of 232. The IPv4 address is divided into two parts:

  1. Network ID
  2. Host ID.

For Example:- IP addresses belonging to class A are assigned to the networks that contain many hosts. 

  • The network ID is 8 bits long.
  • The host ID is 24 bits long.

The higher-order bit of the first octet in class A is always set to 0. The remaining 7 bits in the first octet are used to determine network ID. The 24 bits of host ID are used to determine the host in any network. The default subnet mask for Class A is 255.x.x.x. Therefore, class A has a total of:

2^7-2= 126 network ID(Here 2 address is subtracted because 0.0.0.0 and 127.x.y.z are special address. )

2^24 – 2 = 16,777,214 host ID

IP addresses belonging to class A range from 1.x.x.x – 126.x.x.x

How to Calculate CIDR Notation?

Here, step-by-step you can calculate the CIDR notation of any IP Address:

Step 1: First, find the IP address and the subnet mask. Ex:- 194.10.12.1(IP Address), 255.255.255.0 (Subnet Mask)

Step 2: Convert the subnet mask to binary. (255.255.255.0 -> 11111111.11111111.11111111.00000000)

Step 3: Count the number of consecutive 1s in the binary subnet mask.(11111111.11111111.11111111)

Step 4: Determine the CIDR prefix length.(24’ones)

Step 5: Write the CIDR notation. (194.10.12.1/24)

IPv4 Subnets (w/ Wildcard Mask Values)

Here in the below charts, we will see pre-defined subnet masks, followed by some explanations of what they mean.

CIDR SUBNET MASK WILDCARD MASK # OF IP ADDRESSES # OF USABLE IP ADDRESSES
/32 255.255.255.255 0.0.0.0 1 1
/31 255.255.255.254 0.0.0.1 2 2*
/30 255.255.255.252 0.0.0.3 4 2
/29 255.255.255.248 0.0.0.7 8 6
/28 255.255.255.240 0.0.0.15 16 14
/27 255.255.255.224 0.0.0.31 32 30
/26 255.255.255.192 0.0.0.63 64 62
/25 255.255.255.128 0.0.0.127 128 126
/24 255.255.255.0 0.0.0.255 256 254
/23 255.255.254.0 0.0.1.255 512 510
/22 255.255.252.0 0.0.3.255 1024 1022
/21 255.255.248.0 0.0.7.255 2048 2046
/20 255.255.240.0 0.0.15.255 4096 4094
/19 255.255.224.0 0.0.31.255 8192 8190
/18 255.255.192.0 0.0.63.255 16,384 16382
/17 255.255.192.0 0.0.127.255 32,768 32766
/16 255.255.0.0 0.0.255.255 65,536 65534
/15 255.254.0.0 0.1.255.255 131,072 131070
/14 255.252.0.0 0.3.255.255 262,144 262,142
/13 255.248.0.0 0.7.255.255 524,288 524,286
/12 255.240.0.0 0.15.255.255 1,048,576 1,048,574
/11 255.224.0.0 0.31.255.255 2,097,152 2,097,150
/10 255.192.0.0 0.63.255.255 4,194,304 4,194,302
/9 255.128.0.0 0.127.255.255 8,388,608 8,388,606
/8 255.0.0.0 0.255.255.255 16,777,216 16,777,214
/7 254.0.0.0 1.255.255.255 33,554,432 33,554,430
/6 252.0.0.0 3.255.255.255 67,108,864 67,108,862
/5 248.0.0.0 7.255.255.255 134,217,728 134,217,726
/4 240.0.0.0 15.255.255.255 268,435,456 268,435,454
/3 224.0.0.0 31.255.255.255 536,870,912 536,870,910
/2 192.0.0.0 63.255.255.255 1,073,741,824 1,073,741,822
/1 128.0.0.0 127.255.255.255 2,147,483,648 2,147,483,646
/0 0.0.0.0 255.255.255.255 4,294,967,296 4,294,967,294

Classification of IPV4 Address

IPv4 addresses are classified into five classes: A, B, C, D, and E. The first octet(8 bits) of an IPv4 address determines the class of the address.

Classification of IP Addresses

Range

Number of Blocks

Representation in the subnet mask

Class A 0.0.0.0-127.255.255.255 128 255.0.0.0/8
Class B 128.0.0.0-191.255.255.255 16,384 255.255.0.0/16
Class C 192.0.0.0-223.255.255.255 2,097,152 255.255.255.0/24
Class D 224.0.0.0-239.255.255.255 n/a n/a
Class E 240.0.0.0-255.255.255.255 n/a n/a

And here’s a table of the decimal to binary conversions for subnet mask and wildcard octets:

SUBNET MASK

WILDCARD
0 00000000 255 11111111
128 10000000 127 01111111
192 11000000 63 00111111
224 11100000 31 00011111
240 11110000 15 00001111
248 11111000 7 00000111
252 11111100 3 00000011
254 11111110 1 0000001
255 11111111 0 00000000

Reserved IP Address

Reserved IP addresses are a set of IP addresses that are not assigned to any specific device or network. 

Here are some examples of reserved IP address ranges:

Reserved IP Addresses

0.0.0.0/8 This network
10.0.0.0/8 Private IPv4 Address Block
100.64.0.0/10 Carrier-grade NAT
127.0.0.0/8 Loopback
127.0.53.53 Name collision occurrence
169.254.0.0/16 Link local
172.16.0.0/12 Private IPv4 Address Block
192.0.0.0/24 IETF protocol assignments
192.0.2.0/24 TEST-NET-1
192.168.0.0/16 Private IPv4 Address Block
198.18.0.0/15 Network benchmark testing
198.51.100.0/24 TEST-NET-2
255.255.255.255 Limited Broadcast address

Private IPv4 Addresses

Private IPv4 addresses are a range of IP addresses that are not routable on the public internet. They are reserved for use within private networks, such as homes, businesses, and organizations. 

The range of private IPv4 addresses is:

Private IPv4 Addresses

Class A 10.0.0.0 – 10.255.255.255
Class B 172.16.0.0 – 172.31.255.255
Class c 192.168.0.0 – 192.168.255.255

Special IPv4 Addresses

Special IPv4 addresses are a set of IP addresses, that serve specific purposes. These addresses are used for special functions and are not assigned to individual devices. 

Here are some examples of special IPv4 addresses:

Special IPv4 Addresses

Local Host 127.0.0.0 – 127.255.255.255
APIPA 169.254.0.0 – 169.254.255.255

Bogon IPv4 Addresses

A bogon IP address is an IP address that are not assigned or allocated to any specific entity or organization. Bogon addresses are typically used to filter or block suspicious or illegitimate network traffic. 

Here are some examples of bogon IPv4 address ranges:

Bogon IPv4 Address Range

Description

0.0.0.0/8 Reserved address space
10.0.0.0/8 Private network (RFC 1918)
100.64.0.0/10 Shared address space (CGN)
127.0.0.0/8 Loopback address
169.254.0.0/16 Link-local address (Autoconfiguration)
172.16.0.0/12 Private network (RFC 1918)
192.0.0.0/24 Reserved address space used for documentation
192.0.2.0/24 Reserved address space used for documentation
192.168.0.0/16 Private network (RFC 1918)
198.51.100.0/24 Reserved address space used for documentation
203.0.113.0/24 Reserved address space used for documentation
240.0.0.0/4 Reserved for future use or experimental purposes

Why learning Subnetting is Important?

Learning to subnet is important for a number of reasons, including:

  • Conserving IP addresses: Subnetting allows for the efficient use of limited IPv4 addresses by dividing a larger network into smaller networks, conserving IP addresses and facilitating better management.
  • Improving network performance: Subnetting reduces the size of broadcast domains, reducing network congestion and improving performance by limiting the scope of broadcast messages.
  • Enhancing network security: Subnetting isolates different parts of a network, improving security by preventing unauthorized access to sensitive data.
  • Simplifying network management: Subnetting makes it easier to identify and troubleshoot problems by isolating issues to specific subnets, simplifying network management and troubleshooting processes.
  • Solitary organization: Gadgets on the equivalent subnet can speak with one another straightforwardly without going through a switch or other systems administration gadget.

By learning subnetting, you gain a comprehensive understanding of network design, management, and troubleshooting, making you a valuable asset in the field of networking.

Summary

Alright, wrapping it up, subnetting is pretty much a crucial skill for network admins and IT professionals. It’s all about managing and dishing out IP addresses in networks like a pro. This subnet cheat sheet? It’s your new best friend. It’s got everything you need to know about subnetting, from getting your head around IP addresses and subnet masks to the lingo like CIDR notation and VLSM. Just follow the guide, use the formulas and tables, and subnetting will be a walk in the park. Keep at it, and you’ll be a subnetting master in no time, creating slick network designs, using addresses like a boss, and boosting network performance.Limitations of subnetting. Communication between one subnet to another subnet requires a router. A poorly configured or fatally failed router can significantly impact your organization’s network.

Subnet Cheat Sheet – FAQs

1. How to Determine Usable Hosts?

To determine Usable host, You need to Subtract Subnet ID Address and BroadCast Address from Total Addresses. For Example:-

Usable hosts = Total Addresses – Subnet ID – Broadcast Address

Usable hosts = 256 – 1 – 1

Usable hosts = 254

2. What are the Reserved Ranges of IP Addresses?

Reserved Ranges

RFC1918 10.0.0.0 10.255.255.255
Localhost 127.0.0.0 127.255.255.255
RFC1918 172.16.0.0 172.31.255.255
RFC1918 192.168.0.0 192.168.255.255

3. What if you had a 255.255 255.0 subnet?

A subnet mask of 255.255. 255.0 would give you lots of networks (2 16) and 254 hosts. A subnet of 255.255. 0.0 would give you lots of hosts (approx 216) and 256 networks



Like Article
Suggest improvement
Next
Share your thoughts in the comments

Similar Reads