In Amazon EC2, where I set "security groups", It says: Source:
0.0.0.0/0 And then it gives an example of: 192.168.2.0/24
What is "/24"?
I know what port and IP is.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
It represents the CIDR netmask - after the slash you see the number of bits the netmask has set to 1. So the /24 on your example is equivalent to 255.255.255.0.
This defines the subnet the IP is in - IPs in the same subnet will be identical after applying the netmask. Take AND to mean bitwise &. Then:
192.168.2.5 AND 255.255.255.0 = 192.168.2.0 192.168.2.100 AND 255.255.255.0 = 192.168.2.0
but, for example:
192.168.3.100 AND 255.255.255.0 = 192.168.3.0 != 192.168.2.0
The most common CIDR netmasks are probably /32 (255.255.255.255 - a single host); /24 (255.255.255.0); /16 (255.255.0.0); and /8 (255.0.0.0).
I think it's easier to make sense of the numbers if you remember that 255.255.255.255 can be written as FF.FF.FF.FF - and F is of course the same as binary 1111. So you substract as many 1's as the difference between 32 and the CIDR netmask to know how much of the IP address "belongs" to its subnet. If this is confusing you can probably skip it and keep to the previously mentioned common ones for the time being, it's just the way I prefer to think about this.
Very simply, it is the number of most significant bits that would remain same in the network. Alternately it is (32 less the specified number) of least significant bits that would change in the network. https://www.rfc-editor.org/rfc/rfc1878
It's CIDR notation.