DHCP Network Configuration - PC
Warning
Make sure you are familiar with DHCP before you configure this mode. It is easy to run into issues with DHCP. For example, running more than one DHCP server with overlapping address range on the same network.
Recall that the Zivid SDK looks at Cameras.yml
to find cameras, see Zivid Two Network Configuration.
There are two options to make a camera available to the Zivid SDK.
You can list all the IP addresses that the DHCP can assign.
You can list the hostnames assigned to the connected cameras. The hostname is by default
zivid-<serial number>
(e.g.zivid-2022C0DE
). You can also assign a custom hostname when you enable DHCP mode on the camera, see DHCP or Link Local IP Network Configuration - Camera.
In the following guide we will refer to these two options.
The DHCP configuration depends on the static IP, or the name of the network interface. For simplicity we use a statically assigned IP address. Please follow the steps in Static IP Network Configuration - PC.
Install a DHCP server. If the network already has a DHCP server running you can skip this step.
Install from https://www.dhcpserver.de/cms/.
We want to use the latest DHCP server from ISC, Kea, and we will use their automatic setup script.
$ curl -1sLf 'https://dl.cloudsmith.io/public/isc/kea-2-1/setup.deb.sh' | sudo -E bash
Now that the repository is ready we can install the DHCPv4 server.
$ sudo apt -y install isc-kea-dhcp4-server
Configure the DHCP server. The example here is based on the DHCP server implementation referred to in the previous step. The concepts should apply to alternative DHCP servers.
Option: List IP addresses.
Configure the settings in the
dhcpsrv.ini
file[Settings] IPBIND_1=172.28.60.2 IPPOOL_1=172.28.60.3-172.28.60.10 AssociateBindsToPools=1 [General] SUBNETMASK=255.255.255.0
Find interface name:
zivid@se-zivid-xps15:~$ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 8: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 48:65:ee:1c:12:ba brd ff:ff:ff:ff:ff:ff inet 172.21.96.50/24 brd 172.28.60.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::4a65:eeff:fe1c:12ba/64 scope link valid_lft forever preferred_lft forever
Next we will use the most basic default configuration. Replace the default file
/etc/kea/kea-dhcp4.conf
with. Create a backup if you want to keep it as a local reference.$ sudo nano /etc/kea/kea-dhcp4.conf
Add the following:
{ "Dhcp4": { "interfaces-config": { "interfaces": [ "eth0" ], "dhcp-socket-type": "raw" }, "valid-lifetime": 4000, "renew-timer": 1000, "rebind-timer": 2000, "subnet4": [{ "pools": [ { "pool": "172.28.60.3-172.28.60.10" } ], "subnet": "172.28.60.0/24" }], "loggers": [{ "name": "*", "severity": "WARNING" }] } }
Option: List hostnames.
Configure the settings in the
dhcpsrv.ini
file[Settings] IPBIND_1=172.28.60.2 [DNS-Settings] EnableDNS=1 [General] SUBNETMASK=255.255.255.0 DNS_1=$(IPBIND_1)
Find interface name:
zivid@se-zivid-xps15:~$ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 8: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 48:65:ee:1c:12:ba brd ff:ff:ff:ff:ff:ff inet 172.21.96.50/24 brd 172.28.60.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::4a65:eeff:fe1c:12ba/64 scope link valid_lft forever preferred_lft forever
Next we will use the most basic default configuration. Replace the default file
/etc/kea/kea-dhcp4.conf
with. Create a backup if you want to keep it as a local reference.$ sudo nano /etc/kea/kea-dhcp4.conf
Add the following:
{ "Dhcp4": { "interfaces-config": { "interfaces": [ "eth0" ], "dhcp-socket-type": "raw" }, "valid-lifetime": 4000, "renew-timer": 1000, "rebind-timer": 2000, "subnet4": [{ "pools": [ { "pool": "172.28.60.3-172.28.60.10" } ], "subnet": "172.28.60.0/24" }], "loggers": [{ "name": "*", "severity": "WARNING" }] } }
On Ubuntu we need to enable NetBIOS Naming Service in order to use hostnames instead of the assigned IP address.
$ sudo apt install winbind libnss-winbind
This will install and start a winbind service.
$ systemctl status winbind ● winbind.service - Samba Winbind Daemon Loaded: loaded (/lib/systemd/system/winbind.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2022-03-30 14:41:26 CEST; 4min 19s ago Docs: man:winbindd(8) man:samba(7) man:smb.conf(5) Main PID: 6248 (winbindd) Status: "winbindd: ready to serve connections..." Tasks: 2 (limit: 9322) Memory: 3.8M CGroup: /system.slice/winbind.service ├─6248 /usr/sbin/winbindd --foreground --no-process-group └─6250 winbindd: domain child [THIS-PC1] mars 30 14:41:26 this-pc1 systemd[1]: Starting Samba Winbind Daemon... mars 30 14:41:26 this-pc1 systemd[1]: Started Samba Winbind Daemon.
The NetBIOS Naming Service service is not enabled by default in winbind. We enable this by adding
wins
to hosts:$ sudo nano /etc/nsswitch.conf
# /etc/nsswitch.conf # # Example configuration of GNU Name Service Switch functionality. # If you have the 'glibc-doc-reference' and 'info' packages installed, try: # 'info libc "Name Service Switch"' for information about this file. passwd: files systemd group: files systemd shadow: files gshadow: files hosts: files wins mdns4_minimal [NOTFOUND=return] dns networks: files protocols: db files services: db files ethers: db files rpc: db files netgroup: nis
Now restart winbind in order for the changes to take effect.
$ sudo systemctl restart winbind
We currently do not support Link-Local Multicast Name Resolution, and this should be disabled.
$ sudo nano /etc/systemd/resolved.conf
# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # Entries in this file show the compile time defaults. # You can change settings by editing this file. # Defaults can be restored by simply deleting this file. # # See resolved.conf(5) for details [Resolve] #DNS= #FallbackDNS= #Domains= LLMNR=no #MulticastDNS=no #DNSSEC=no #DNSOverTLS=no #Cache=no-negative #DNSStubListener=yes #ReadEtcHosts=yes
Update
Cameras.yml
according to the DHCP configuration.Option: List IP addresses.
__version__: 1 Cameras: NetworkCameras: - NetworkCamera: Host: 172.28.60.3 - NetworkCamera: Host: 172.28.60.4 - NetworkCamera: Host: 172.28.60.5 - NetworkCamera: Host: 172.28.60.6 - NetworkCamera: Host: 172.28.60.7 - NetworkCamera: Host: 172.28.60.8 - NetworkCamera: Host: 172.28.60.9 - NetworkCamera: Host: 172.28.60.10
Option: List hostnames.
__version__: 1 Cameras: NetworkCameras: - NetworkCamera: Host: zivid-two - NetworkCamera: Host: zivid-two-alt-1 - NetworkCamera: Host: zivid-two-alt-2 - NetworkCamera: Host: zivid-two-2022C0DE
Path to
Cameras.yml
mkdir %LOCALAPPDATA%\Zivid\API move %HOMEPATH%\Downloads\Cameras.yml %LOCALAPPDATA%\Zivid\API\
Path to
Cameras.yml
mkdir --parents $XDG_CONFIG_HOME/Zivid/API mv ~/Downloads/Cameras.yml $XDG_CONFIG_HOME/Zivid/API/
Caution
If
$XDG_CONFIG_HOME
is not set use$HOME/.config
.Caution
Zivid configuration files must use .yml file extension ( not .yaml).
(Re-)start the DHCP server.
Once you have configured both the camera and the PC you can open Zivid Studio and the camera will be found automatically.
Hint
The status LEDs at the back of the camera show the current link capacity.