zivid-python icon indicating copy to clipboard operation
zivid-python copied to clipboard

Connect to Camera from different Subnet

Open YBachmann opened this issue 4 months ago • 5 comments

Hello,

Issue Summary:

I'm encountering an issue where the Zivid SDK cannot establish a TCP/IP connection to a Zivid camera located on a different subnet, even though the camera is reachable and the network routing is correctly configured. The SDK reports:

"This camera was discovered, but the SDK is unable to establish a TCP/IP connection to it. The network configuration of your PC and the camera are incompatible. The camera has IP address 172.24.2.20, but your PC is not able to connect to this IP. The camera IP is not in the subnet of your PC's network adapter."

My Network Setup:

  • Host A

    • This computer has two subnets. One is a bridge br0 of multiple ethernet ports and another one is a WIFI client that's connected to a router.
    • Interfaces:
      • br0 (bridge interface): 172.24.2.1/24
      • wlp17s0 (Wi-Fi interface): 172.24.1.2/24
    • Connected Devices:
      • Zivid camera connected to br0. Zivid has static IP 172.24.2.20/24
    • Configuration:
      • IP forwarding enabled to route traffic between br0 and wlp17s0
      • mdns-repeater (GitHub Project) used to forward mDNS traffic between subnets
  • Host B (My Laptop):

    • My laptop is also connected to the router as a WIFI client and as such also is in the 172.24.1.0/24 subnet.
    • Interface:
      • wlp0s20f3: 172.24.1.101/24
    • Routing:
      • Static route added to reach the camera's subnet via Host A:
        sudo ip route add 172.24.2.0/24 via 172.24.1.2
        

State before my workaround

  • The Zivid SDK is able to discover the camera but tells me it can't connect to it because it is in a different subnet (see top of issue).
  • I am able to ping the camera from my laptop.
  • I am able to create a TCP connection to the camera using netcat:
    yannic:~$ nc -vz 172.24.2.20 52811
    Connection to 172.24.2.20 52811 port [tcp/*] succeeded!
    

Problem

  • Despite successful network connectivity, the SDK refuses to establish a connection because it detects that the camera's IP is not in the same subnet as any of the PC's network interfaces.
  • The SDK seems to enforce a check that requires the PC to have an IP address within the same subnet as the camera.

Workaround

I added a secondary IP 172.24.2.101/24 to my laptops WIFI interface wlp0s20f3. This IP is from the cameras subnet but it does not actually do anything in terms of networking/routing. However it bypasses the Subnet-Check from the SDK, enabling me to successfully connect to the camera.

Request

  • Could the SDK be updated to allow connections to cameras on different subnets when routing is properly configured?
    • This would involve the SDK attempting to establish a TCP/IP connection even if the camera is not on the same subnet as the PC.
  • Alternatively, could there be an option to disable or override the subnet check in the SDK?

Additional Information

  • SDK Version: 2.13.1
  • Camera Model: Zivid 2+ L110
  • Operating System: Ubuntu 22.04 LTS

Note: I also tried other ethernet cameras instead of a Zivid and those worked even without my workaround so I would assume that my network setup works in general.

YBachmann avatar Oct 09 '24 10:10 YBachmann