en
  English
Phone :  +370 (5) 204-1903
Email :  sales@1gbits.com
  1. Dedicated server
  2. Blog
  3. Subnet Mask Cheat Sheet

Subnet Mask Cheat Sheet

The internet is subdivided into several networks. Each local network has its own gateway, which serves as the network's parent for all devices. This gateway is recognised by an IP address, which serves as its unique identifier. This gateway is in charge of transferring data to other networks. When we transfer data, it is routed through this gateway, which then relays it to other networks.

General Security Tutorials Oct 27, 21 by Nisal N 10 min Read
Subnet Mask Cheat Sheet

A subnetwork, also known as a subnet, is a logical split of an IP network. Subnetting is the technique of splitting a network into two or more networks.

Computers in the same subnet are addressed with the same most significant bit-group in their IP addresses. As a result, an IP address is logically divided into two fields: the network number or routing prefix and the remaining field or host identifier. The remainder field serves as an identification for a particular host or network interface.

As a network engineer, you may need to check up on subnet mask values and figure out what they imply on occasion.

Why use subnetting

Subnetting is a method of conceptually dividing a single physical network into several smaller sub-networks or subnets.

Subnetting allows network administrators to reduce network complexity and minimise network traffic by creating subnets without requiring a new network number.

Subnetting also enables for a large number of devices to be accommodated in IPv4 address permutations which are around 4.2 billions (which will become short as the network devices grow). Let’s look at a table for subnet masks and see the explanation for each term one by one.

Sheet for subnet masking

CIDR

Subnet Mask

Wildcard Mask

Number of IPs

Number of usable IPs

/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

8,192

8190

/18

255.255.192.0

0.0.63.255

16,384

16382

/17

255.255.128.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

262142

/13

255.248.0.0

0.7.255.255

524,288

524286

/12

255.240.0.0

0.15.255.255

1,048,576

1048574

/11

255.224.0.0

0.31.255.255

2,097,152

2097150

/10

255.192.0.0

0.63.255.255

4,194,304

4194302

/9

255.128.0.0

0.127.255.255

8,388,608

8388606

/8

255.0.0.0

0.255.255.255

16,777,216

16777214

/7

254.0.0.0

1.255.255.255

33,554,432

33554430

/6

252.0.0.0

3.255.255.255

67,108,864

67108862

/5

248.0.0.0

7.255.255.255

134,217,728

134217726

/4

240.0.0.0

15.255.255.255

268,435,456

268435454

/3

224.0.0.0

31.255.255.255

536,870,912

536870910

/2

192.0.0.0

63.255.255.255

1,073,741,824

1073741822

/1

128.0.0.0

127.255.255.255

2,147,483,648

2147483646

/0

0.0.0.0

255.255.255.255

4,294,967,296

4294967294

Decimal to binary for subnet mask and wildcards

 

Subnet Mask

 

Wildcards

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

00000001

255

11111111

0

00000000

What is the IP address

IPv4 addresses, such as 192.168.0.1, are just decimal representations of four binary blocks.

Each block is 8 bits long and represents a number between 0 and 255. Because the blocks are 8-bit groupings, each block is referred to as an octet. And, because each IPv4 address is made up of four blocks of eight bits, each IPv4 address is 32 bits long.

In binary notation, the dotted-decimal IP address 192.168.123.132 is the 32-bit number 110000000101000111101110000100.  These binary notations of IP addresses will be helpful in doing subnet masks.

What is a subnet mask?

The TCP/IP protocol uses the subnet mask to identify whether a host is on the local subnet or a distant network.

If you've ever messed around with the network settings on your router or computer, you've probably come across this number: 255.255.255.0

If so, you've seen a very common subnet mask for simple home networks.

How the subnet mask works

Let’s take a subnet mask as 255.255.255.0 and IP address as 192.168.123.132

The network address is identified by the first 24 bits (the number of ones in the subnet mask). The host address is recognised by the final 8 bits (the number of leftover zeros in the subnet mask). It provides the following addresses:

11000000.10101000.01111011.00000000 - Network address (192.168.123.0)

00000000.00000000.00000000.10000100 - Host address (000.000.000.132)

When a bit in a binary subnet mask is set to 1, the corresponding bit in a binary IP address is part of the network, not the host.

Because octet 255 in binary is 11111111, the entire octet in the IP address is part of the network. So the first three octets of the IP address, 192.123.0, are the network components, and 132 is the host portion.

CIDR

The CIDR notation simply reflects the number of bits accessible to the IP address. The /24 in 192.168.0.101/24, for example, corresponds to the IP address 192.168.0.101 and the subnet mask 255.255.255.0.

To get the CIDR notation for a given subnet mask, just convert the subnet mask to binary and count the number of ones.

CIDR notation is often written with the network ID. As a result, the CIDR notation for the IP address 192.168.0.101 with a subnet mask of 255.255.255.0 is 192.168.0.0/24.

Classful addressing

The IPv4 address format is expressed in 4-octets (32-bit) and is split into three classes, namely class A, class B, and class C.

Class A

The first higher-order octet (byte) of a Class A address is used to identify the network prefix, while the next three octets (bytes) are used to specify host addresses. The address range for class A is 0.0.0.0 to 127.255.255.255. The first bit of the first octet is always set to 0 (zero), the following seven bits define the network address, and the remaining 24 bits determine the host address.

Class B

The first two octets (16 bits / 2 bytes) of a Class B IP address indicate the network ID, while the following two octets (16 bits / 2 bytes) represent the host ID.

Class B IP addresses have a range of 128.0.0.0 to 191.255.255.255 with a subnet mask of 255.255.0.0 (or /16 in CIDR).

Class C

The first three octets (24 bits / 3 bytes) of a Class C IP address indicate the network ID, while the final octet (8 bits / 1 bytes) represents the host ID.

Class C IP addresses are assigned between 192.0.0.0 and 223.255.255.255, with a default subnet mask of 255.255.255.0 (or /24 in CIDR).

Class D and E

Multicasts are assigned to Class D IP addresses. They are in the range 224.0.0.0 to 239.255.255.255.

Class E IP addresses are experimental and range from 240.0.0.0 to above.

Class

Higher bits

Network address bits

Host address bits

No. of networks

No. of hosts per network

Range

A

0

8

24

27

224

0.0.0.0 to 125.255.255.255

B

10

16

16

214

216

128.0.0.0 to 191.255.255.255

C

110

24

8

221

28

192.0.0.0 to 223.255.255.255

D

1110

Not defined and reserved for future

Not defined and reserved for future

Not defined and reserved for future

Not defined and reserved for future

224.0.0.0 to 239.255.255.255

E

1111

Not defined and reserved for future

Not defined and reserved for future

Not defined and reserved for future

Not defined and reserved for future

240.0.0.0 to 255.255.255.255

An overview of IPv6

IPv6 is the next-generation Internet Protocol (IP) standard that is expected to ultimately replace IPv4, which is still used by many Internet services today. To communicate with other devices, every computer, mobile phone, and other Internet-connected device needs a numerical IP address. The original IP address system, known as IPv4, is running out of addresses as more people are getting engaged in this domain.

author img

Nisal N

Computers has always fascinated me since I was a kid and here we are. I love travelling for 2 reasons: the first one to see a new part of the world and second (the most important one) to experience the rich culture hidden among the country and people. I'm pretty good at cooking but very poor when it comes to baking.

Leave A Comment