1

ran into something funny today and am still scratching my head on why this happened. I was trying to increase the number of ip addresses available from my dhcp server by changing the netmask from /24 to /20.

This was the first scenario, I changed the router's subnet mask to /20 to match that of my dhcp server. However, I did not change the subnet mask of any of the workstations with static ips and they stayed at /24. I connected a few workstations and wireless devices to the network and all of them got served the correct range, with /20 and are able to access the network.

My question to this first scenario is: Aren't all devices supposed to have the same subnet mask in order to work? Why are the workstations with static ip addresses and a netmask of /24 still working?

Then I tried the second scenario. This time the router's subnet mask remained at /24 and I only modified the DHCP server's subnet mask to /20. The outcome? The devices with static IPs with subnet mask /24 work. The devices served dynamic IPs with subnet mask /20 cannot access the network. My question to this is: If the previous scenario works with both subnets. Why is it in this situation it doesn't?

I'm not sure whether this is worth mentioning but the DHCP server is running ubuntu dhcp server.

2

This answer assumes that your router has an ip address of 192.169.1.100 (or any ip address between 192.168.1.0-255).

With a /24 subnet mask your ip address range is 192.168.1.0-192.168.1.255 (including the network and broadcast addresses).

With a /20 subnet mask your ip address range is 192.168.0.0-192.168.15.255 (including the network and broadcast addresses).

From the perspective of hosts with either subnet mask, 192.168.1.100 is a valid local address. It exists in both the /20 and the /24 subnets. A Host doesn't know what subnet mask any other host is using, it only knows it's own subnet mask and uses that to determine which ip addresses are local and which are not. Any host with an ip address in the /24 range would appear to belong to the local subnet to any of the hosts and more importantly in this scenario, to the router, BUT the hosts in the /24 subnet will only be be able to communicate with other hosts whose ip addresses also fall within the 192.168.1.0-192.168.1.255 range. That's why the first scenario works but the second scenario doesn't. In the first scenario all the hosts can communicate with the router because the router is using a /20 subnet mask BUT it's ip address falls within both subnets from the perspective of hosts with either subnet mask. In the second scenario the router can only communicate with those ip addresses that fall within the /24 subnet, it can't communicate with any hosts with ip addresses above 192.168.1.255 because those ip addresses fall outside of 192.168.1.0/24, which is the routers subnet in the second scenario.

| improve this answer | |
  • Glad to help... – joeqwerty Jun 22 '15 at 0:41
5

The subnet mask is mostly used to work out whether another IP address can be accessed on the local network, or if it needs to go through a router. Your workstations with the old /24 subnet mask will have been able to access everything else that was inside the old /24 network, because the wrong mask will still give the right answer for those addresses. They won't have been able to communicate with IP addresses in the new /20 network that were not also in the old /24 network, which is why we say that the old mask doesn't work in the new network.

In your second scenario, since the router's mask remained at /24 it won't have been able to access devices with IP addresses outside the old network, and so those devices won't have had router access.

| improve this answer | |
  • Thanks! First Scenario: I don't really get the part where you said "the wrong mask will still give the right answer for those addresses". Do you mean that although 192.168.1.100/24 is not in the /20 subnet, the IP address is still within the /20 network and therefore is able to work with the router which is now /20? Second scenario: Because the router's mask is now /24, it can only provide access to devices that have IP addresses that exist within the /24 range? Meaning 192.168.1.1 to 192.168.1.254 only. Anything outside say 192.168.2.1 will not work? – gp04lch Jun 20 '15 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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