Just remember one number and you can quickly calculate the available range of the IP segment.

Just remember one number and you can quickly calculate the available range of the IP segment.

As long as you remember a simple number, you can easily determine the host bit, network bit, broadcast address and available IP address range of the network segment even when faced with a very complex IP network segment subnet mask division. This number is 256.

Basic knowledge review

IP addresses are divided into two types: IPv4 and IPv6, of which IPv4 is currently the most common type.

An IPv4 address consists of a 32-bit binary number, usually expressed as four groups of decimal numbers. The division of an IP address depends on the subnet mask, which is used to determine the boundary between the network number and the host number.

  • Network number: It is the identifier of a specific network and is obtained by performing a bitwise AND operation on the subnet mask and the IP address.
  • Broadcast address: used to send broadcast messages in the network, obtained through reverse operation.
  • Available IP range: The range of IP addresses that can be assigned to hosts on a network, usually excluding the network number and broadcast address.

Case Demonstration

Let's do a few tests together, such as this IP address:

 IP地址:192.168.191.37掩码:255.255.255.248

First, we need to find the part of the mask that is neither 255 nor 0. For example, here we use 248 as an example. Next, we subtract this number from 256 (256-248), and the result is 8. This means that we can start from 0 and increase by 8 to determine the range of IP addresses.

We can use this method to calculate the valid IP address values ​​before and after it. In this way, we can easily know the range of the IP address! In the above example, 37 is exactly between 32-40. Therefore, we can easily get:

  • Network bit: It is covered by 255 + the beginning of the interval. In this case, it is 192.168.191.32
  • Host range: The host range is the number excluding the network and broadcast bits, in this case 192.168.191.33-38
  • Broadcast bit: It is the next network bit minus 1. In this case, it is 40-1, so the broadcast bit is 192.168.191.39

Let’s do another question!

 IP地址:192.168.55.88掩码:255.255.192.0

By subtracting 192 from 256 we get 64. Since 55 is exactly in the range of 0 to 64, we can understand it like this:

  • The network address is: 192.168.0.0
  • The host IP address range is from 192.168.0.1 to 192.168.63.254
  • The broadcast address is: 192.168.63.255
  • The subnet mask is set to: 255.255.192.0

<<:  Network Analysis in Rust: Capturing and Analyzing Network Traffic with Pcap and Pnet

>>: 

Recommend

The results are out! Check out the three operators' 2018 first half report cards

In August, the three telecom operators successive...

Wi-Fi 6 Column | How to build university networks in the 5G era (Part 1)

What changes will Wi-Fi 6 and 5G bring to the con...

A super simple TCP communication package in C#: step by step guide

Hey, fellow developers! Today we are going to tal...

How to Understand and Evaluate Potential Colocation Data Center Providers?

Today, as demand for colocation and wholesale dat...