[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: netcfg: using udhcpc to get dhcp lease fails



On Saturday 30 January 2010, Otavio Salvador wrote:
> > I built a netboot image without dhcp3-udeb to test udhcpc, but it
> > failed miserably as it did not manage to get a lease during netcfg.
> > How well was this tested?

Works OK now. Nice.

> Now it has one. /var/lib/udhcp/udhcpc.leases.

udhcpc given me:
lease {
  interface "eth0";
  fixed-address "10.19.66.61";
  filename "http://www/preseed.cfg";;
  subnet-mask "/255.255.255.0";
  option domain-nam "fjphome.nl";
  option routers "10.19.66.1";
  option ntp-servers "";
}

While dhcp3 gives:
lease {
  interface "eth0";
  fixed-address 10.19.66.61;
  filename "http://www/preseed.cfg";;
  option subnet-mask 255.255.255.0;
  option routers 10.19.66.1;
  option dhcp-lease-time 7200;
  option unknown-208 f1:0:74:7e;
  option dhcp-message-type 5;
  option unknown-209 "debian-installer/pxelinux.cfg/default";
  option domain-name-servers 10.19.66.2,10.19.66.1;
  option dhcp-server-identifier 10.19.66.2;
  option unknown-210 "/";
  option host-name "vbox1";
  option domain-name "fjphome.nl";
  renew 0 2010/01/31 01:23:15;
  rebind 0 2010/01/31 02:19:33;
  expire 0 2010/01/31 02:34:33;
}

Probably worth adding/fixing for udhcpc is:
- missing option host-name
- missing option domain-name-servers
- missing option dhcp-server-identifier
- strange leading slash for subnet-mask
- typo option domain-nam (missing e)
The other differences are probably not that relevant.

Oh, and we also need 'ntpservers' I think. I can't test that here now, but 
netcfg does (in dhcp.c):
    if ((d = fopen(NTP_SERVER_FILE, "r")) != NULL) {
        char ntpservers[DHCP_OPTION_LEN + 1] = { 0 };
        fgets(ntpservers, DHCP_OPTION_LEN, d);
        fclose(d);
        unlink(NTP_SERVER_FILE);

        if (!empty_str(ntpservers)) {
            debconf_set(client, "netcfg/dhcp_ntp_servers",
                        ntpservers);
        }
    }
and the clock-setup postinst has:
    db_get netcfg/dhcp_ntp_servers

Also, if I run netcfg multiple times with dhcp3, I get multiple leases in 
the leases file. You seem to overwrite the existing file. Not sure if that 
needs fixing or not.

Cheers,
FJP


Reply to: