In Amazon EC2, where I set "security groups", It says: Source: And then it gives an example of:

What is "/24"?

I know what port and IP is.


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

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: AND = AND =

but, for example: AND = !=

The most common CIDR netmasks are probably /32 ( - a single host); /24 (; /16 (; and /8 (

I think it's easier to make sense of the numbers if you remember that 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

  • 1
    So what number should I put if I'm using EC2? I just want to put the IPs in the security group. that's it. I don't want to do anything fancy. I just want to allow the 3 IPs...
    – Alex
    May 16 '11 at 1:19
  • What are the three IPs? If you want to add individual IPs you should just add i.p.addr.ess/32 for each of the three. May 16 '11 at 2:20
  • Where the security group is the property that allows outside communications, based on your public IP, unless you have a consecutive range of IPs in use, it's best to delimit to that exact address. You can do so by setting the netmasks to /32, and creating a rule for each IP and port.
    – DivinusVox
    May 16 '11 at 6:18
  • On EC2 Security Groups there is option to add My IP and it will set IP and mask for you
    – Justinas
    Apr 26 '18 at 8:31
  • Great answer, thank you @EduardoIvanec Aug 2 '19 at 11:18

It's CIDR notation.


The number after the / is the number of bits in the network mask. /24 is the same as, just as /16 would be the same as


The number after the / represents the subnet.

Not the answer you're looking for? Browse other questions tagged or ask your own question.