Search code examples
network-programmingip-addressmask

Understanding why some IPs don't have a mask address


I am given a list of IPs, some of them have a netmask, other no. I got the idea of how to create a mask but i'm not understanding why there are cases where an IP doesn't have a mask.

Like the following:

  • 121.34.56.64–121.34.56.128 > Don't have mask
  • 128.131.9.0–128.131.9.192 > Don't have mask
  • 93.20.10.0–93.20.11.0 > Don't have mask

While the following actually have mask address:

  • 67.56.34.64-67.56.34.79 > Prefix notation: 67.56.34.64/28 | Address/Mask: 67.56.34.64/255.255.255.240 and so on.

For example if I look at the third one of the addresses without mask i do the following:

93.20.10.0–93.20.11.0

93.20. 0000 101|0 . 0000 0000
93.20. 0000 101|1 . 0000 0000

NetMask: 255.255.254.0, that is not correct.

Can somebody explain me why and how to understand when a mask exists?


Solution

  • All IP addresses have a subnet mask and through Variable Length Subnet Masking (VLSM) they can change subnet masks depending on how we carve up the larger address pool.

    Most likely your addresses are slightly off but based on the ranges given we can figure out what the masks should be.

    Using your list:

    • 121.34.56.64–121.34.56.128 if this range is inclusive then there are addresses in 2 subnets listed here and the actual range is probably 121.34.56.64-121.34.56.127 so the mask would be 255.255.255.192 or a /26.
    • 128.131.9.0–128.131.9.192 if this range is inclusive then there are addresses in multiple subnets listed here and the actual range is probably 128.131.9.0-128.131.9.191. This is tricky since there isn't a mask that allows 192 addresses so it is likely that this isn't a single subnet but an aggregation of multipe subnets that could be 3 /26s, 6 /27s, 12 /28s, 24 /29s, 48, /30s, 96 /31s, or 192 /32s, or some combination of those. For example it could be 2 /26s and 2 /27s.
    • 93.20.10.0–93.20.11.0 if this range is inclusive then there are addresses in 2 subnets listed here and the actual range is probably 92.20.10.0-92.20.10.255 so the mask would be 255.255.255.0 or a /24.

    So you can deduce what some of the subnet masks might be but for the ones that don't fall on the subnet boundaries more information will be required.