What does a forward slash followed by a number mean in IP? [duplicate]

Solution 1:

It indicates the subnet mask of the IP.

IP has 32 bits, and number after the slash tells you where does the network part end, host part starts.

IP 10.39.25.151 written in binary format looks like this:

00001010001001110001100110010111

and /24 says that first 24 bits are used for network designation, while last 8 bits are used for various hosts inside that network.

/24 means that hosts on network can have IPs that are different by last 8 bits only, so IPs from range 10.39.25.1 - 10.39.25.255, with last .255 IP being used as broadcast address for the network.

See these two links for more details about subnet mask, and how they work.

https://support.microsoft.com/en-us/kb/164015

https://www.iplocation.net/subnet-mask

/24 indicates a subnet mask of 255.255.255.0, or in binary octets.

11111111.11111111.11111111.00000000

A Subnet mask is a 32-bit number that masks an IP address, and divides the IP address into network address and host address. Subnet Mask is made by setting network bits to all "1"s and setting host bits to all "0"s. Within a given network, two host addresses are reserved for special purpose, and cannot be assigned to hosts. The "0" address is assigned a network address and "255" is assigned to a broadcast address, and they cannot be assigned to hosts.

Solution 2:

The number after the slash refers to the size of the network.

Specifically, the number after the slash specifies how many bits in the netmask have a value set to 1 before the first bit that is set to zero. This style of specifying a network's size is most formally called "CIDR notation", and is sometimes also called "slash notation".

So, 192.0.2.0/24 refers to the network (or "subnetwork", a.k.a. "subnet") with a netmask of 11111111111111111111111100000000. (The netmask matches the address's length. Since IPv4 addresses have 32-bit addresses, IPv4 uses 32-bit netmasks. Since IPv6 addresses have 128-bit addresses, IPv6 uses 128-bit netmasks.)

What this means is that 24 bits are used to specify a network ID, leaving 8 bits to identify a host. There are 2 possible values in binary, and 2 raised to the 8th power is 256, so there are 256 addresses that can be in that network. So, the 192.0.2.0/24 network goes from 192.0.2.0 through 192.0.2.255.

Similarly, the 192.0.2.0/29 network goes from 192.0.2.0 through 192.0.2.7. (Since 29 of the bits are reserved for identifying the subnet, that leaves 3 bits for the addresses. 2 raised to the 3rd power is 8.)

Side note: All of those addresses are part of the subnet. In IPv4, they are not all "usable", based on the IPv4 standard of the first and last addresses being "unusable", for compatibility with various equipment that may support "broadcast packets". The last address is typically called the "broadcast address". The first address is typically called the "Network ID", but the technical reason that the Network ID was ever declared to be unusable was from historical concerns of compatibility with some equipment that broadcasted on the first address.

For more fun of looking at different subnet sizes, you may want to look at a VLSM chart.

The reason why /24 is so common is because IPv4 addresses tend to be written out in octets. /24 allows the Network bits and the Host bits to be split after 24 bits, which ends up being after the third octet. So, people can tell rather easily (and without being very error prone) whether a device is part of a specific network, or a different network.