• ROS
  • 16-bit vs 24-bit subnet mask on network adapter configuration

I just started working with an OAK-D S2 POE. I'm not using DCHP of any kind and I'm using a D-LINK POE switch to which only my laptop and the camera are connected. I've configured by laptop's network adapter with a static IP of 169.254.1.1. When I set my network adapter to have a 24-bit subnet mask (255.255.255.0) I'm unable to connect to the camera using depthai-ros, but it does succeed when I set the adapter to have a 16-bit subnet mask (i.e. 255.255.0.0).

Why is this happening? I'm able to ping the camera with both subnet mask settings and clearly the camera's default address of 169.254.1.222 is inside my LAN whether I've set my laptop's network adapter to 169.254.1.1/24 or 169.254.1.1/16 (hence I'm able to ping the camera in both cases).

I really appreciate this answer, but it is not satisfying. By my knowledge, the subnet mask configured on one host does not have to match the subnet mask configured on the other host for them to communicate. If my computer is configured for 169.254.1.x/24 (where "x" is not 222 to avoid conflict with the camera IP), the fact is, the camera's IP address of 169.254.1.222 will fall into that network and the computer will send packets to the camera (instead of the default gateway, of which there is not one because I'm using a switch and no router). Similarly, if the camera is configured to 169.254.1.222/16, the IP I configured for my computer will fall into that network regardless of my choice of "x" (again with the exception of 222 due to IP conflicts) and the subnet mask on my computer is completely irrelevant to that. There must be something else going on here.

As added context, if I configure my computer to 169.254.1.10/16 as the link you gave suggests, I can connect to the camera (using depthai-ros) but something is very wrong (not sure where) such that I'm not able to see any images coming from the ROS topics. Just changing the last number of the computer's static IP from 10 to 1 makes images come through.

    In fact, I haven't tested it with every value for the last number in the IP, but it appears that all other IP addresses other than 169.254.1.1/16 seem to have problems.

    Hi @asperry

    asperry By my knowledge, the subnet mask configured on one host does not have to match the subnet mask configured on the other host for them to communicate.

    No, theoretically they don't need to. I don't know for sure, but I think that unless you directly specify the IP of the device, the host will first send a broadcast signal (which differs depending on the set subnet mask) to find the device. And the broadcast won't work since the subnets are different. Perhaps this is the issue here.

    asperry As added context, if I configure my computer to 169.254.1.10/16 as the link you gave suggests, I can connect to the camera (using depthai-ros) but something is very wrong (not sure where) such that I'm not able to see any images coming from the ROS topics. Just changing the last number of the computer's static IP from 10 to 1 makes images come through.

    That is strange. Have you tried a similar thing but on depthai only examples? Could be a misconfiguration on ROS side.

    Thanks,
    Jaka

      jakaskerl Have you tried a similar thing but on depthai only examples?

      I will attempt this and report back! Thanks for the feeback!