John Minou
John Minou

Reputation: 25

Signification of "/" in ip address

I am learning nmap and I amm watching this video https://www.youtube.com/watch?v=hNThhluanlg at minute 2:30 the speaker does a simple ping scan but wants to perform it on the "whole network" for this purpose she uses her ip address but adds a "/" at the end and some numbers...

What do ip addresses with "/" stand for ?

Upvotes: 1

Views: 633

Answers (2)

bonsaiviking
bonsaiviking

Reputation: 6005

This is called Classless Inter-Domain Routing (CIDR) notation. The number after the slash says how many bits of the address belong to the routing prefix for the network or subnet. However many bits are left over may be allocated to hosts on that subnet.

As an example, say you are given the address "192.0.2.0/24". An IPv4 address consists of 4 octets, or 32 bits. The notation says that the first 24 bits (3 octets) denote the network, and the remaining 32 - 24 = 8 bits (1 octet) can be used for host addresses. This network can hold 2^8 = 256 hosts, though practically the all-ones address will be used for broadcast and the all-zeros address for the network itself. Therefore, "192.0.2.0/24" is equivalent to "192.0.2.0-255" in Nmap's range syntax, or all addresses between 192.0.2.0 and 192.0.2.255 inclusive.

Upvotes: 1

hymie
hymie

Reputation: 2068

First off, you need to understand that an IP address has 32 bits.

Next, you need to understand that a "network" involves machines that are specifically numbered to keep them together. If you have (say) 11 computers that are going to be together in a network, then their IP addresses will all have their "left" side in common:

xxxxxxxx xxxxxxxx xxxxxxxx xxxx0001
xxxxxxxx xxxxxxxx xxxxxxxx xxxx0010
xxxxxxxx xxxxxxxx xxxxxxxx xxxx0011
...
xxxxxxxx xxxxxxxx xxxxxxxx xxxx1101
xxxxxxxx xxxxxxxx xxxxxxxx xxxx1110

The number after the slash indicates the number of bits that the machines all have in common. In this case, whatever value the (reserved) first IP address

xxxxxxxx xxxxxxxx xxxxxxxx xxxx0000

has, the network is identified as XXX.XXX.XXX.XXX/28

Upvotes: 3

Related Questions