DHCP网络配置 - PC

小心

The correct instructions for network configuration will depend on your SDK version. Choose your SDK version in the top left drop-down.

警告

在配置此模式之前,请确保您熟悉DHCP。使用DHCP很容易遇到问题。例如,在同一网络上运行多个具有重叠地址范围的DHCP服务器。

这将指导您如何在PC上设置DHCP服务器。在继续之前,请确保您首先已将相机配置为DHCP。跳转到 DHCP或链接本地IP网络配置 - 相机 以执行此操作。

  1. 安装DHCP服务器。如果网络已经运行了DHCP服务器,您可以跳过此步骤。

    从https://www.dhcpserver.de/cms/安装。

    我们想使用ISC的最新DHCP服务器, Kea,我们将使 用 their automatic setup script

    $ curl -1sLf 'https://dl.cloudsmith.io/public/isc/kea-2-1/setup.deb.sh' | sudo -E bash
    

    现在存储库已准备就绪,我们可以安装DHCPv4服务器了。

    $ sudo apt -y install isc-kea-dhcp4-server
    
  2. 配置DHCP服务器。此处的示例基于上一步中提到的DHCP服务器实现。这些概念应适用于替代DHCP服务器。您可以列出DHCP可以分配的IP地址,或者列出分配给连接的相机的主机名。

    1. 选项:列出IP地址

      dhcpsrv.ini 文件中配置设置

      [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
      

      查找接口名称:

      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
      

      接下来我们将使用最基本的默认配置。将默认文 件 /etc/kea/kea-dhcp4.conf 替换掉。如果要将其保留为本地参考,请创建备份。

      $ sudo nano /etc/kea/kea-dhcp4.conf
      

      添加以下内容:

      {
         "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"
            }]
         }
      }
      
    2. 选项:列出主机名

      dhcpsrv.ini 文件中配置设置

      [Settings]
      IPBIND_1=172.28.60.2
      [DNS-Settings]
      EnableDNS=1
      [General]
      SUBNETMASK=255.255.255.0
      DNS_1=$(IPBIND_1)
      

      查找接口名称:

      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
      

      接下来我们将使用最基本的默认配置。将默认文 件 /etc/kea/kea-dhcp4.conf 替换掉。如果要将其保留为本地参考,请创建备份。

      $ sudo nano /etc/kea/kea-dhcp4.conf
      

      添加以下内容:

      {
         "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"
            }]
         }
      }
      

      From SDK 2.7, enabling NetBIOS Naming Service is no longer required. There is an additional step for earlier SDK versions to enable NetBIOS Naming Service. Change the Knowledge Base version in the top left corner to see instructions.

    如果您使用的是Cameras.yml

    根据DHCP配置更新 Cameras.yml ,IP地址或主机名的示例如下所示。

    转到 Cameras.yml以及如何限制可发现的相机 以获取有关 Cameras.yml 的更多信息。

    1. 选项:列出IP地址

      __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
      
    2. 选项:列出主机名

      __version__: 1
      Cameras:
         NetworkCameras:
               - NetworkCamera:
                  Host: zivid-2022C0DE.local
               - NetworkCamera:
                  Host: zivid-two.local
               - NetworkCamera:
                  Host: zivid-two-alt-1.local
               - NetworkCamera:
                  Host: zivid-two-alt-2.local
      
  3. (重新)启动DHCP服务器。

    导航到您提取可执行文件的文件夹,然后双击 dhcpsrv.exe,或打开命令提示符并

    C:\dhcpsrv>dhcpsrv.exe -runapp
    

    您可以通过检查tray来验证DHCP服务器是否正在运行:

    显示 DHCP 正在 Windows 上运行的屏幕截图
    sudo systemctl restart isc-kea-dhcp4-server
    

一旦您 配置相机 为DHCP并在PC上启动DHCP服务器,回到 发现并连接到相机