Retaining information between DHCP requests

Anders Blomdell anders.blomdell at control.lth.se
Thu Oct 9 20:55:06 UTC 2014


On 10/08/2014 07:26 PM, CLOSE Dave wrote:
> I understand that dhcpd doesn't record requests for static addresses in
> the leases file, and that makes sense to me. But without that recording
> I'm at a loss of how to save information between requests.
>
> The problem I'm trying to solve is to provide different nameserver
> values to the same machine under different circumstances. In particular,
> I need a different nameserver configuration when the machine is being
> installed, via PXE kickstart, and during normal operation. The machines
> are running Fedora but that may not be important.
>
> During installation, kickstart seems to exchange messages with dhcpd
> three times. The first time it goes through the full DISCOVER, OFFER,
> REQUEST, ACK sequence. The second and third times it only sends REQUEST
> and gets ACK. All responses give it a full-day lease.
>
> The DISCOVER and REQUEST messages in the first exchange include a unique
> vendor-class-identifier starting with "anaconda". I can and do detect
> that string and provide the special nameserver response needed. But the
> subsequent REQUESTs do not include that string and dhcpd then provides
> the normal operation response. That confuses kickstart and the
> installation fails.
>
> (I'm also puzzled why kickstart would send the subsequent REQUESTS,
> given that it was told it had a full-day lease. But I probably can't do
> anything about that.)
It might help to copy the lease information in a %post rule

%post --nochroot
mkdir -p /mnt/sysimage/var/lib/NetworkManager
cp /var/lib/NetworkManager/dhclient*.lease 
/mnt/sysimage/var/lib/NetworkManager/
%end

>
> Ideally, I'm looking for a way to remember the status of the most recent
> DISCOVER/OFFER and to continue to use that to determine the response to
> any subsequent REQUESTs. But, because these machines have static
> addresses, I can't record anything in the leases file. Is there any
> other solution that anyone can suggest? Is there a way I can add
> something to the OFFER that would always be included in a later REQUEST?
>


-- 
Anders Blomdell                  Email: anders.blomdell at control.lth.se
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118
SE-221 00 Lund, Sweden



More information about the dhcp-users mailing list