Loading...
 
Skip to main content

DRAFT

An IP address is a unique numeric identifier for each device on a network. Most networks currently use IPv4 addresses, which are each 32 bits long, separated into 4 groups of 8 bits each; e.g. 11000000.10110000.00000001.00000001. But binary numbers are not very user-friendly, so each group is converted into an equivalent base-10 digit, so the above binary number becomes 192.168.1.1.

(Remember: the binary number from the first group 11000000 = 1 x 128 + 1 x 64 + 0 x 32 + 0 x 16 + 0 x 8 + 0 x 4 + 0 x 2 + 0 x 1 = 192)

What does “mask” mean when talking about IP addresses?

The “mask” divides the IP address into a network part and a host part. All hosts on the same network share the same network part of the IP address. Each host on the same network has a unique host part of the IP address.

The most common network mask is 255.255.255.0, which equates to the binary number 11111111.11111111.11111111.00000000. If a network has a netmask of 255.255.255.0, then the first three groups of digits in the IP address will be the same for all hosts on that network and only the 4th group will change. So, for example, two hosts on the network 192.168.1.1 whose subnet mask is 255.255.255.0 could have IP addresses 192.168.1.2 and 192.168.1.3, or any other number in the range 192.168.1.1-255, but the first 3 groups of numbers won’t change and will always be 192.168.1.

Another way to define this network and its mask is to use CIDR notation: 192.168.1.0/24.

How to convert between CIDR Range (/##)  and Netmask (###.###.###.###)

The CIDR Range value refers to the number of masked bits, from 0 (none) to 32 (all).

Example 1: netmask = 255.255.255.0

What is the CIDR range? The first 3 groups of 8 bits are fully masked. The binary equivalent is 11111111.11111111.11111111.00000000, which is 24 1s. So the CIDR range is /24.

Example 2: netmask = 255.255.0.0

What is the CIDR range? The first 2 groups of 8 bits are fully masked. The binary equivalent is 11111111.11111111.00000000.00000000, which is 16 1s. So the CIDR range is /16.

Example 3: CIDR range = /32

What is the netmask? There are 32 1s in the binary value, so it is 11111111.11111111.11111111.11111111. All 4 groups will be fully masked, so the netmask is 255.255.255.255.

Example 4: CIDR range = /23

What is the netmask? There are 23 1s in the binary value, so it is 11111111.11111111.11111110.00000000. Converting those to decimal gives a netmask of 255.255.254.0.

You should always ask yourself what is the address:

- of the network 

- of the 1st host

- of the next network

- broadcast network

- of the last host

 

How to find a network address from the IP address of a host

Do an AND between the address and its mask

Ex : 192.168.100.170/28

Convert the CIDR notation to decimal (click here for a list of subnet masks with number of hosts per network)

/28 = 255.255.255.240 : it is three times 8 bits plus 4 on the fourth byte

Set the bits for the byte of the mask and the client:

11110000 (240)

10101010

The AND operation gives

10100000 = 160

The network address is therefore: 192.168.100.160

 

Calculate the number of addresses for this network

Subtract the mask from 256

Ex : 256-240 = 16

Subtract the network address and the broadcast address. 16-2=14

 

Find the first host of the network

Add 1 to the network address

Ex : 192.168.100.160+1 = 192.168.100.161

 

Identify the next network

Add the number of addresses found previously to the network address found previously

Ex : 192.168.100.160+16

The next network address is therefore: 192.168.100.176

 

Alternative method: based on the "step bit

In this case, in the mask 240 (1111 0000), the last bit at 1 (the step bit) is 16. We add its value (16) to the network (160) thus 176.

 

Find the broadcast address of the network

Remove 1 from the next network address

Ex : 176-1

The broadcast address is then : 192.168.100.175

 

Find the last host of the network

Remove 1 from the broadcast address

Ex : 175-1

The address of the last host of the network is : 192.168.100.174

 

Here are some training videos that might interest you

Introduction to IP

IPv4 Addressing

IPv4 Subnet Masks

IPv4 and IPv6

Windows IP Address Configuration

IPv6 Addressing

IPv6 Subnet Masks

Configuring IPv6


 


Contributors to this page: admin .
Page last modified on Monday March 3, 2025 17:50:39 GMT-0000 by admin.
Show PHP error messages