有没有办法拒绝来自特定 IP 的 dhcp 响应?

有没有办法拒绝来自特定 IP 的 dhcp 响应?

我的网络上有两个 dhcp 服务器(不是我的错)。有没有办法拒绝来自特定 dhcp 服务器的 dhcp 响应?

答案1

根据dhclient.conf手册页,应该可以通过向文件添加reject指令来执行您想要的操作/etc/dhcp/dhclient.conf

   reject cidr-ip-address [, ... cidr-ip-address ] ;

   The reject statement causes the  DHCP  client  to  reject  offers  from
   servers  whose  server identifier matches any of the specified hosts or
   subnets.  This can be used to avoid being configured by rogue  or  mis‐
   configured  dhcp  servers, although it should be a last resort - better
   to track down the bad DHCP server and fix it.
   .
   .
   .   
   reject 192.168.0.0/16, 10.0.0.5;

The above example would cause offers from any server identifier in the  entire
RFC  1918  "Class  C"  network  192.168.0.0/16, or the specific single address
10.0.0.5, to be rejected.

不过请注意手册页中的注释——最好找到坏的 DHCP 服务器并修复它。

相关内容