Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

An IP address like this 223.248.0.0/24 or 223.248.0.0/16

What's the last number mean in the IP address (24 or 16 in the above example)? Is there a simple way to understand how to set the number after the slash?

share|improve this question
add comment

3 Answers

up vote 12 down vote accepted

An IP address is just a number. One that - as I'm sure you know - uniquely identifies a computer on a network. But still just a number, which we will get back to.

Let's take an example: 192.168.1.105

You'll notice that the IP address is broken up into four parts: {192, 168, 1, 105}. And you probably also know that each of those parts can have a value from 0-255.

It turns out that the numbers 0..255 can be represented in 8 bits. So an IP address consists of four sections, and each section can have a value 0..255. This means that each section can be represented with 8 bits. With four of these sections, you have (4 sections) * (8 bits/section) = 32 bits. To represent the entire IP address.

Remember when we said that an IP address is just a number? Well, an IP is a 32-bit integer. For convenience, we write it as "192.168.1.105" but you could easily write it as 0xC0A80169

In binary, all 32 binary digits in their glory: 11000000101010000000000101101001

Okay. So now your question: what does 192.168.1.105/24 mean?

It means that the first 24 bits of the IP address are the "subnet". It means that the first 24 bits of items on your network are the same. As you add new computers, you only have 8 bits remaining (remember, an IP is a 32-bit number) for addressing new devices.

Because you have 8 bits worth of addressability, in this example, you may only add 255 devices.

110000001010100000000001 01101001
------------------------
(subnet)

Let's break apart the subnet:

11000000 10101000 00000001 = 192 168 1

See?

Same example with a /16 subnet: 192.168.1.105/16

1100000010101000 0000000101101001
----------------
(subnet)

So in this case, every IP address begins with 192.168 - the first 16 bits of the IP address. And then we have 16 bits remaining for new devices. 16 bits = 65535 devices.

So if you have a small subnet, you have a larger portion of internet addresses. MIT owns a /8 subnet - that is, have a block IP addresses and they can add 2^24 devices. Very cool!

share|improve this answer
    
how do you get this," the numbers 0..255 can be represented in 8 bits?" thank you. –  runeveryday Dec 10 '11 at 5:52
4  
You've misused the term "subnet mask" here. Just "subnet" or "network (address)" should be used. The part after the slash is the subnet mask. –  camh Dec 10 '11 at 6:08
    
@runeveryday If you open your calculator in binary/hex mode it'll be easier to see. Each bit can have 2 states. Every bit you add will double the number of states you can represent. With 8bits you can have 2^8 = 256 states, thus 0-255. –  greatwolf Dec 10 '11 at 8:53
    
what camh said, and when you use subnet masks in other contexts (e.g., in any network configuration settings) 192.168.0.1/16 has a subnet mask of 255.255.0.0, what you're speaking of is definitely the network address. –  derobert Dec 10 '11 at 13:31
add comment

Those aren't ip addresses per se, they are ranges. The last number (which, as psusi mentions is called a subnet mask) indicates the number of relevant bits: /16 means the network includes all numbers starting with the first 16 bits of the specified ip (223.248 in your example). A /8 is a class A network with 2^24 addresses, /16 is class B with 2^16 (65536), and a /24 is a class C with 2^8 = 256 addresses. You most often see this in local networks: 192.168.0.0/24 (usually used in small home networks) and 10.0.0.0/16, usually seen in larger company intranets. You can see other reserved ranges listed in subnet notation and a range list, and the total number of doamins on Wikipedia.

share|improve this answer
5  
It's also important to note that numbers besides 8, 16, and 24 are allowed. 10.1.2.0/23 is perfectly valid, and means 10.1.2.0–10.1.3.255. –  derobert Dec 10 '11 at 4:35
add comment

It is the subnet mask for the network. In other words, it says how large the network is. A /24 is a class C network, having 256 addresses and a subnet mask of 255.255.255.0. A /16 is class B, with a subnet mask of 255.255.0.0.

share|improve this answer
    
how many addresses A /16 are having? how to get 24 or 16? are there still other numbers –  runeveryday Dec 10 '11 at 3:47
2  
/24 isn't class C, nor is /16 class B, nor /8 class A. Those classes are all specific ranges of IP addresses, a class C comes from 192.0.0.0–223.255.255.255. So 10.0.0.0/24 is not class C, it's actually a subnetwork in class A space. Its best to avoid using the old classfull terminology. –  derobert Dec 10 '11 at 4:30
    
@derobert, a possible technicality, though you very well can write 192.168.1.0/24 and it really is a class C. –  psusi Dec 11 '11 at 3:06
    
@runeveryday, a /16 has 16 bits for the network and 16 for the host address, giving 2^16, or 65536 addresses. A /24 uses 24 bits for the network leaving 8 for the host, giving 2^8 or 256 addresses. You can use any value after the / between 1 and 31. –  psusi Dec 11 '11 at 3:08
add comment

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.