-1

As I understand it IP 192.168.20.4/24 can only describe a host (24) on net 192.168.20.[1-254].

Now when describing a net; can 192.168.20.4/24 be a valid network ID, or should such a network ID always end with 0, as in 192.168.20.0/24, where 0 indicates that it is the network ID itself for net 192.168.20.[1-254]. So adding network:

sudo ip route add 192.168.20.4/24 dev eth0

is not allowed (which it also seems not to be).

I guess what I really want to know is, if something else than 0 is allowed when describing a network? When I look at routing table:

default via 172.18.0.1 dev eth0 
169.254.0.0/16 dev eth0  scope link  metric 1000 
172.18.0.0/24 dev eth0  proto kernel  scope link  src 172.18.0.150 
192.168.10.0/24 dev eth0  proto kernel  scope link  src 192.168.10.150

It kinda seems it could say (.7):

192.168.10.7/24 dev eth0  proto kernel  scope link  src 192.168.10.150

But that can never be right, correct? Instead it would have to say then (/32):

192.168.10.7/32 dev eth0  proto kernel  scope link  src 192.168.10.150

To describe the net consisting of only 1 single host(?). Have i understood things correctly?

JohnyTex
  • 101

1 Answers1

3

There are more possibilities than zero for your network space. You could use .128 if you wanted to use the higher numbers in a /25, or .64 which will give you a range of .65-.126 with a broadcast of .127.

This works all the way up to 32. In the other direction /23, /22 and so on, it will always start with 0 because you will be using the entire 255 (and then some).

The idea is that it is the starting number on your network space, so if you want to use a /24, it will start at .0 If you're using a smaller space, you can start at zero, or at the beginning of any of the divisions.

There is a lot of information here, and on the internet in general about netmasks, it's worth spending a bit of time reading.

NickW
  • 10,289