What's the meaning of 10.0.0.1/24 address of my computer (from the "ip addr" command)?
What's the meaning of 10.0.0.1/24 address of my computer (from the ip addr
- command)?
-
Why is it 1/24 and not 0/8?
-
Why is it using the 10.0.0 range and not 192.168.10?
Solution 1:
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.
Solution 2:
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.
Solution 3:
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
Solution 4:
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
Solution 5:
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.