Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
possible duplicate of How does Subnetting Work? –  EEAA May 16 '11 at 2:15

4 Answers 4

up vote 29 down vote accepted

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. http://tools.ietf.org/html/rfc1878

share|improve this answer
    
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. –  Eduardo Ivanec 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

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

share|improve this answer

The number after the / represents the subnet.

share|improve this answer

It's CIDR notation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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