有沒有辦法拒絕來自特定 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 伺服器並修復它。

相關內容