请考虑以下几点:
如何配置我的 DHCP 服务器(ubuntu 上的 isc-dhcp-server 包)来为 172.16.0.0/18 子网提供地址,因为该子网中没有任何接口?我尝试在该范围内配置一个环回来欺骗服务,但它不起作用。
# ip add
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
inet 172.16.0.1/18 scope global lo:10
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 94:c6:91:ab:68:d0 brd ff:ff:ff:ff:ff:ff
inet 192.168.111.14/30 brd 192.168.111.15 scope global enp3s0
# cat dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
option domain-name-servers 8.8.8.8, 1.1.1.1;
option domain-name "thankForYourHelp.stackoverflow";
authorative;
subnet 172.16.0.0 netmask 255.255.192.0 {
range 172.16.0.100 172.16.0.150;
option subnet-mask 255.255.192.0;
option domain-name-servers 8.8.8.8, 1.1.1.1;
option routers 172.16.0.1;
get-lease-hostnames true;
use-host-decl-names true;
default-lease-time 600;
max-lease-time 7200;
}
# cat /etc/default/isc-dhcp-server
INTERFACESv4="lo"
INTERFACESv6=""
感谢您的帮助。
答案1
我明白了。为此,需要在 dhcp.conf 文件中创建一个具有组合池的共享网络。这将如下所示,其中第一个子网是不直接连接到 dhcp 服务器的子网,然后添加没有定义任何与您的接口地址匹配的选项的其他子网。
shared-network Combined-pools {
subnet 10.0.0.0 netmask 255.255.0.0 {
range 10.0.0.10 10.0.200.200;
option subnet-mask 255.255.0.0;
option routers 10.0.0.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
subnet 192.168.120.0 netmask 255.255.255.0 {
}
}