Назад | Перейти на главную страницу

Как запретить ISC-DHCPD предлагать разные IP-адреса при двух запросах от одного и того же MAC

У меня есть набор узлов, которые получают свои адреса от ISC-DHCPD. Поскольку они загружаются с использованием PXE, будет два раунда DHCP (один из PXE, один из ОС), и по какой-то причине ISC-DHCPD предложит два разных IP-адреса. Это плохо, так как номера узлов должны соответствовать последнему байту ip.

Вот отрывок из системного журнала, показывающий, что происходит:

May 25 23:16:26 cluster dhcpd: DHCPDISCOVER from 08:00:27:d3:d5:3b via eth1
May 25 23:16:27 cluster dhcpd: DHCPOFFER on 192.168.0.1 to 08:00:27:d3:d5:3b via eth1
May 25 23:16:29 cluster dhcpd: DHCPREQUEST for 192.168.0.1 (192.168.0.254) from 08:00:27:d3:d5:3b via eth1
May 25 23:16:29 cluster dhcpd: DHCPACK on 192.168.0.1 to 08:00:27:d3:d5:3b via eth1
May 25 23:17:07 cluster dhcpd: DHCPDISCOVER from 08:00:27:d3:d5:3b via eth1
May 25 23:17:08 cluster dhcpd: DHCPOFFER on 192.168.0.2 to 08:00:27:d3:d5:3b via eth1
May 25 23:17:08 cluster dhcpd: DHCPREQUEST for 192.168.0.2 (192.168.0.254) from 08:00:27:d3:d5:3b via eth1
May 25 23:17:08 cluster dhcpd: DHCPACK on 192.168.0.2 to 08:00:27:d3:d5:3b via eth1
May 25 23:17:08 cluster dhcpd: DHCPREQUEST for 192.168.0.2 (192.168.0.254) from 08:00:27:d3:d5:3b via eth1
May 25 23:17:08 cluster dhcpd: DHCPACK on 192.168.0.2 to 08:00:27:d3:d5:3b via eth1

Вот соответствующая выдержка из leases-файла:

lease 192.168.0.1 {
  starts 1 2015/05/25 21:16:28;
  ends 5 2151/07/02 03:44:43;
  cltt 1 2015/05/25 21:16:28;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 08:00:27:d3:d5:3b;
  uid "\001\010\000'\323\325;";
}
lease 192.168.0.2 {
  starts 1 2015/05/25 21:17:08;
  ends 5 2151/07/02 03:45:23;
  cltt 1 2015/05/25 21:17:08;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 08:00:27:d3:d5:3b;
}
lease 192.168.0.2 {
  starts 1 2015/05/25 21:17:08;
  ends 5 2151/07/02 03:45:23;
  cltt 1 2015/05/25 21:17:08;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 08:00:27:d3:d5:3b;
}

Это конфигурация dhcp-сервера:

ddns-update-style none;

default-lease-time -1;
max-lease-time -1;

authoritative;

allow booting;
allow bootp;
next-server 192.168.0.254;
filename "/pxelinux.0";

log-facility local7;

subnet 192.168.0.0 netmask 255.255.255.0 {

    range 192.168.0.1 192.168.0.253;
    interface eth1;
    option routers 192.168.0.254;
    option domain-name "cluster.hpc.org";
    option domain-name-servers 192.168.0.254;

}

Вы можете получить его с помощью флагов ignore-client-uids. Он включен, начиная с версии isc-dchpd 4.2.0:

Добавьте эту строку:

ignore-client-uids истина;

     ignore-client-uids flag;

     If the ignore-client-uids statement is present and has a value of
     true or on, the UID for clients will not be recorded.  If this
     statement is not present or has a value of false or off, then client
     UIDs will be recorded.

попробуйте что-нибудь вроде

ddns-update-style none;

# Client control
deny duplicates;
one-lease-per-client on;

# Lease authority
default-lease-time 3600;
min-lease-time 3600;
max-lease-time 21600;

authoritative;

allow booting;
allow bootp;
next-server 192.168.0.254;
filename "/pxelinux.0";

log-facility local7;

subnet 192.168.0.0 netmask 255.255.255.0 {

    range 192.168.0.1 192.168.0.253;
    interface eth1;
    option routers 192.168.0.254;
    option domain-name "cluster.hpc.org";
    option domain-name-servers 192.168.0.254;

}
  deny duplicates;

   Host declarations can match client messages based on  the  DHCP  Client
   Identifier  option  or  based on the client's network hardware type and
   MAC address.   If the MAC address is used, the  host  declaration  will
   match  any  client  with that MAC address - even clients with different
   client identifiers.   This doesn't normally  happen,  but  is  possible
   when  one computer has more than one operating system installed on it -
   for example, Microsoft Windows and NetBSD or Linux.

   The duplicates flag tells the DHCP server that if a request is received
   from  a  client that matches the MAC address of a host declaration, any
   other leases matching that MAC  address  should  be  discarded  by  the
   server,  even  if the UID is not the same.   This is a violation of the
   DHCP protocol, but can prevent clients whose client identifiers  change
   regularly  from  holding  many  leases  at  the same time.  By default,
   duplicates are allowed.

источники

http://www.bctes.com/dhcpd.conf.5.html

http://www.xdracco.net/howto-configure-and-deploy-isc-dhcp-server/