26

What's the meaning of 10.0.0.1/24 address of my computer (from the ip addr - command)?

  1. Why is it 1/24 and not 0/8?

  2. Why is it using the 10.0.0 range and not 192.168.10?

2
  • 1
    if your computer is getting the address via dhcp, it means that the "box" handing out ip's is set up to use the 10 net. some soho routers use this, most use 192.168.?.0 /24.
    – dbasnett
    Jun 30 '10 at 13:49
  • 1
    SOHO stands for small office / home office
    – duhaime
    Sep 10 '19 at 13:10
38

Thought I would expand on this with a few examples

/8 = 255.0.0.0

/16 = 255.255.0.0

/24 = 255.255.255.0

/32 = 255.255.255.255

192.168.1.0/24 = 192.168.1.0-192.168.1.255

192.168.1.5/24 is still in the same network as above we would have to go to 192.168.2.0 to be on a different network.

192.168.1.1/16 = 192.168.1.0-192.168.255.255

When you have a network you lose two IP addresses one for broadcast and one for the network. The first IP is reserved to refer to the network while the last ip of the range is reserved for the broadcast address.

3
  • According to RFC1878 "*Subnet all zeroes and all ones excluded. (Obsolete) *Host all zeroes and all ones excluded. (Obsolete)
    – dbasnett
    Jul 1 '10 at 13:12
  • 1
    @chris isn't 192.168.1.1/16 = 192.168.0.0-192.168.255.255 ? May 6 '14 at 15:08
  • @Rajani, I was looking over some of these old posts and you are correct. I'm surprised I even made this mistake at the time; thank you for pointing it out. Aug 21 '15 at 19:24
8

In addition to Tim's answer:

The /24 instead of /8 means that the first 3 octets of the ip address are used to specify the network. This is just a setting you can change if you want to. It's not super common to use the 10. private range with a /24 mask but there's no reason you can't do it.

/8 is using only the first octet to specify the network portion, which is what a 10. network explicitly meant back in the pre-CIDR days, and that's why you still see it more often with a /8 than with a 24.

As for the last octet being a 0 not a 1, that's because a 10.0.0.0 would in this case be the network address, with 10.0.0.1 being your computers ip.

0
7

RFC 1918 reserves 3 ranges for private IP addresses. Your DHCP server/router is configured to assign this range.

10.0.0.0 - 10.255.255.255/8

172.16.0.0 - 172.31.255.255/12

192.168.0.0 - 192.168.255.255/16

http://en.wikipedia.org/wiki/Private_network

5
  • Sorry, didn't see that part. Dmatig answered above :-) So, your ip address is 10.0.0.1 and the /8 subnet mask or 255.255.255.0
    – TD1
    Jun 29 '10 at 20:28
  • I think you got the /8 and /24 from the post switched around /24 is 255.255.255.0 /8 is 255.0.0.0 :) Jun 29 '10 at 21:02
  • Thanks,Can you please explain to me more simple I dont know networks
    – Ben
    Jun 29 '10 at 21:05
  • see superuser.com/questions/54802/… A subnet mask can also be represented in CIDR notation, like /8. /8 means 255.0.0.0 because the first 8 bits equal 255. (think 8 binary 1's). Now from left to right if 24 binary ones and 8 0's were used we'd get /24 - 255.255.255.0
    – Dmatig
    Jun 29 '10 at 21:08
  • @Chris, you are absolutely right, I have dyslexic mind domsetimes :-)
    – TD1
    Jun 29 '10 at 21:10
6

This format 10.0.0.1/24 is so called Classless Inter-Domain Routing CIDR representation so in short it's a bit mask that describes what portion of the IP address can be used for the range.

Here is an example, in your case 10.0.0.1/24 you have 24 bits preserved out of the total 32 bit address field. If you think of an IP address as 4 parts of 8 bits that gives you 255.255.255.255 respectively 2^8.2^8.2^8.2^8 in your case that means this portion, 3 parts of 8 bits, is protected (will not change) 10.0.0 and just the final 8th of the IP will be used as part of the range .1 giving you range in this format: 10.0.0.1 - 10.0.0.255

I presume the 10.0.0.0 IP is preserved for your router, network card or some other device that's why it's not included.

One other thing, probably obvious, the smaller the range number e.g. 32, 24, 16, 8 the larger the IP range.

And finally here is a nice tool for CIDR manipulations http://www.ipaddressguide.com/cidr

2

Just noting that 10.0.0.0/24 is an invalid subnet. The first valid subnet within the 10.0.0.0/8 (Class A) network, now sliced with a /24 subnet mask is... 10.0.1.0/24. You have to throw away the top/bottom on the network side just like you do for the top/bottom for the host side of that bitmask. For the same reason, 10.255.255.0/24 is also invalid.

For any given subnet mask there are 2x - 2 subnets and 2x - 2 hosts

...where x is the number of bits on that side of the mask. So for /24 that's 24 on the network side and 8 on the host side making 16777214 subnets and 254 hosts. Note the "- 2" part of that calculation on the network side of the bitmask. That means that you have to throw away (you can't issue) those since they mean something to the transport layer of tcp/ip, in this case.

This should make sense to anyone who already knows that you similarly can't bind any 10.x.y.0/24 and 10.x.y.255/24 addresses since they already mean something.

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