I’m trying to understand subnet masking but have atwo conflicting pieces of evidence to grapple with. Here’s what I am experimenting with:
My LAN runs on the 192.168.0 subnet with a subnet mask of 255.255.255.0, as follows in /etc/config/network::
config interface 'lan'
option ifname 'eth0 eth2'
option force_link '1'
option type 'bridge'
option proto 'static'
option ip6assign '60'
option ipaddr '192.168.0.1'
option netmask '255.255.255.0'
option gateway '192.168.0.1'
option broadcast '192.168.0.255'
All is good. And I am happy. Loads of devices with IPs reserved on my LAN, printers, scanners, servers, other things … all no dramas and great little home LAN and has been for years …
Every now and then I get a peripheral (typically a wifi camera but it matters not) that comes factory set with an IP on the 192.168.1 subnet.
Historically the only way I have of integrating that is to get a laptop, connect it directly to the peripheral with a CAT cable and set the IP of th laptop to 192.168.1.1 and then I can connect to the peripherals web interface and configure it to use DHCP and from there plug it into my LAN.
That works fine,m but is a hassle. And so I wanted to learn a bit more about how I might do it all on my LAN directly.
So I read a little about subnets and turns out I can basically relax the netmask as follows:
config interface 'lan'
option ifname 'eth0 eth2'
option force_link '1'
option type 'bridge'
option proto 'static'
option ip6assign '60'
option ipaddr '192.168.0.1'
option netmask '255.255.0.0'
option gateway '192.168.0.1'
option broadcast '192.168.1.255'
And suddenly I can plug the peripheral into my LAN and see it on my LAN. Awesome. Essentially I’ve moved from a type C to type B subnetwork I guess with a much larger range of IP’s available on the subnet.
Now the simplest test I have for visibility is just the arp
command. I type arp, and if I see the peripheral (the specific one I have is factory set to 192.168.1.88) and with a mask of 255.255.255.0 in /etc/config/network as above I cannot see the peripheral, but with 255.255.0.0 I can!
Between tests I reboot the router so that it rebuilds the arp table and also propagates the netmask to my desktop (and other devices I guess) properly. That’s a mild time consuming hassle between tests, which relevant for the next step.
Essentially, I am keen to learn, more that I am keen to solve this problem. I want to understand how this works. So, thinking I have understood it, I used a subnet calculator:
http://www.subnet-calculator.com/subnet.php
to explore my options. Essentially, can I set it up so my subnet supports not:
192.168.0.0 to 192.168.0.255
192.168.0.0 to 192.168.255.255
(being the type C and type B configs and netmasks as above of 255.255.255.0 and 255.255.0.0 respectively)
But instead supports:
192.168.0.0 to 192.168.1.255
(i.e. just the 0 and 1 subnets).
The mask to do this, is no surprise, rather than zeroing the 8 least significant bits in the mask, zero 9 and the subnet calculator confims that a mask of 255.255.254.0 supports a range of:
192.168.0.0 to 192.168.1.255
(well actually to 192.168.1.255 as the last one is always reserved fro broadcast).
So I configure the Omnia with:
config interface 'lan'
option ifname 'eth0 eth2'
option force_link '1'
option type 'bridge'
option proto 'static'
option ip6assign '60'
option ipaddr '192.168.0.1'
option netmask '255.255.254.0'
option gateway '192.168.0.1'
option broadcast '192.168.1.255'
and reboot … and check with arp and BZZZZZT, fail. I cannot see the peripheral.
Why not?
My problem is cognitive dissonance, namely two pieces of conflicting evidence:
-
a reading of the theory and use of a subnet calculator to confirm understanding (see: http://i772.photobucket.com/albums/yy2/Bernd_Wechner/Subnet%20Mask_zpsiou3zyhk.jpg)
-
empirical observation of what the Omnia does.
They conflict. So I presume the weakness is in 1), but what am I missing? Is there some nuance to subnet masking that I am overlooking here?
Just a reminder, I’m not looking for novel solutions to seeing this and other 192.169.1 peripherals as I have working solutions. I am interested in understanding what is happening with my subnet masking efforts, i.e in learning.