
我試圖在我的 Beaglebone Black(運行 Debian)上運行 DHCP 伺服器,並且我想給它一個靜態 IP 位址 - 192.168.17.1 - 但它不斷為自己分配不同的 IP 位址 - 192.168.17.12。我檢查了租約,以確保它實際上分配了自己的地址,而不是我在某個地方寫錯了。
這是我的 /etc/network/interfaces 檔案:
auto eth0
iface eth0 inet static
address 192.168.17.1
netmask 255.255.255.0
gateway 192.168.17.1
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1
這是我的 dhcpd.conf 檔案:
option domain-name "BBB";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.17.0 netmask 255.255.255.0 {
range 192.168.17.10 192.168.17.20;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.17.255;
option routers 192.168.17.1;
}
一個可能的解決方案是修復 dhcpd.conf 檔案中的 IP 位址。例如:
host fantasia {
hardware ethernet 08:00:07:26:c0:a5;
fixed-address fantasia.fugue.com;
}
但這種方法似乎不正確,也不安全。有誰知道更好的解決方案?