[Dnsmasq-discuss] Wrong hostname in DHCP answer if FQDN in /etc/hosts

Michael Heimpold michael.heimpold at s2000.tu-chemnitz.de
Tue May 8 20:05:38 BST 2007


Hi,

>> Oh, sorry, I'm still using v2.38.
> That's fine.
> There was no change to any of this code between 2.38 and 2.39, the stuff
> I'm half-remembering was much longer ago.

Ok, then let's try again with v2.38.

> What exactly is being sent? DHCP has options for hostname, domain name
> and "Full-qualified domain name". I would expect hostname to be a  bare
> name, domain name to be what's set by the --domain dnsmasq option and
> FQDN to be both together.

ACK (actually, I've not yet seen the FQDN in the response, but I know
that there is an RFC out there...)

> If the automatic installation is using the
> FQDN as its domain name, then that's a bug in the installer.
> If the domain name option is set as the FQDN that's a bug in dnsmasq.

ACK, but this both seems not to be the case, see below.

> Are you sure that the installer (is it FAI?) isn't doing a reverse-DNS
> lookup on the IP address and using that to set the hostname?

The installer is the standard debian etch installer, simply using a
preseed file. I don't think that it is doing a reverse lookup, since the
documentation also states that the hostname is set via DHCP if supplied.

Below, I've appended my two test cases. When I understand the output
from dhcpdump correctly the wrong hostname is already 'on the wire', so this
was the reason I'm targeting dnsmasq :-)

Thanks,
Michael

=== Case 1 - The expected behavior ===

/etc/hosts on the Router where dnsmasq is running:
	192.168.8.30    vpc
	...

And the dnsmasq.conf
	-snip-
	no-poll
	domain-needed
	expand-hosts
	localise-queries
	no-negcache
	domain=mhei.heimpold.itr
	dhcp-option=119,mhei.heimpold.itr,heimpold.itr
	dhcp-option=44,192.168.8.253
	dhcp-option=46,8
	dhcp-boot=pxelinux.0,tonne.mhei.heimpold.itr,192.168.8.253
	dhcp-range=192.168.8.40,192.168.8.50,12h
	read-ethers
	-snap-

Some testing on host TONNE:
	tonne:~# cat /etc/resolv.conf
	nameserver 192.168.8.254
	tonne:~# host vpc
	vpc has address 192.168.8.30
	tonne:~# host vpc.mhei.heimpold.itr
	vpc.mhei.heimpold.itr has address 192.168.8.30
	tonne:~# host 192.168.8.30
	30.8.168.192.in-addr.arpa domain name pointer vpc.mhei.heimpold.itr.
	tonne:~#
	tonne:~# echo -e "search mhei.heimpold.itr\nnameserver 192.168.8.254"  
 > /etc/resolv.conf
	tonne:~# cat /etc/resolv.conf
	search mhei.heimpold.itr
	nameserver 192.168.8.254
	tonne:~# host vpc
	vpc.mhei.heimpold.itr has address 192.168.8.30
	tonne:~# host vpc.mhei.heimpold.itr
	vpc.mhei.heimpold.itr has address 192.168.8.30
	tonne:~# host 192.168.8.30
	30.8.168.192.in-addr.arpa domain name pointer vpc.mhei.heimpold.itr.
	tonne:~#

Then I booted the box and startet the installer. Here is what a
  "tcpdump -lenx -s 1500 port bootps or port bootpc | dhcpdump" shows  
(I stripped
  down to options only):

     OP: 1 (BOOTPREQUEST)
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  60 (  3) Vendor class identifier   d-i
OPTION:  55 (  7) Parameter Request List      1 (Subnet mask)
                                              28 (Broadcast address)
                                               2 (Time offset)
                                               3 (Routers)
                                              15 (Domainname)
                                               6 (DNS server)
                                              12 (Host name)

OPTION:  61 (  7) Client-identifier         01:00:03:ff:32:ac:41
---------------------------------------------------------------------------
     OP: 2 (BOOTPREPLY)
  SNAME: tonne.mhei.heimpold.itr.
  FNAME: pxelinux.0.
OPTION:  53 (  1) DHCP message type         2 (DHCPOFFER)
OPTION:  54 (  4) Server identifier         192.168.8.254
OPTION:  51 (  4) IP address leasetime      43164 (11h59m24s)
OPTION:  58 (  4) T1                        21582 (5h59m42s)
OPTION:  59 (  4) T2                        37768 (10h29m28s)
OPTION:   1 (  4) Subnet mask               255.255.255.0
OPTION:  28 (  4) Broadcast address         192.168.8.255
OPTION:   3 (  4) Routers                   192.168.8.254
OPTION:   6 (  4) DNS server                192.168.8.254
OPTION:  15 ( 17) Domainname                mhei.heimpold.itr
OPTION:  12 (  3) Host name                 vpc
---------------------------------------------------------------------------
     OP: 1 (BOOTPREQUEST)
OPTION:  53 (  1) DHCP message type         3 (DHCPREQUEST)
OPTION:  54 (  4) Server identifier         192.168.8.254
OPTION:  50 (  4) Request IP address        192.168.8.30
OPTION:  60 (  3) Vendor class identifier   d-i
OPTION:  55 (  7) Parameter Request List      1 (Subnet mask)
                                              28 (Broadcast address)
                                               2 (Time offset)
                                               3 (Routers)
                                              15 (Domainname)
                                               6 (DNS server)
                                              12 (Host name)

OPTION:  61 (  7) Client-identifier         01:00:03:ff:32:ac:41
---------------------------------------------------------------------------
     OP: 2 (BOOTPREPLY)
  SNAME: tonne.mhei.heimpold.itr.
  FNAME: pxelinux.0.
OPTION:  53 (  1) DHCP message type         5 (DHCPACK)
OPTION:  54 (  4) Server identifier         192.168.8.254
OPTION:  51 (  4) IP address leasetime      43200 (12h)
OPTION:  58 (  4) T1                        21600 (6h)
OPTION:  59 (  4) T2                        37800 (10h30m)
OPTION:   1 (  4) Subnet mask               255.255.255.0
OPTION:  28 (  4) Broadcast address         192.168.8.255
OPTION:   3 (  4) Routers                   192.168.8.254
OPTION:   6 (  4) DNS server                192.168.8.254
OPTION:  15 ( 17) Domainname                mhei.heimpold.itr
OPTION:  12 (  3) Host name                 vpc
---------------------------------------------------------------------------


On freshly installed box VPC:
	vpc:~# cat /var/lib/dhcp3/dhclient.eth0.leases
	lease {
	  interface "eth0";
	  fixed-address 192.168.8.30;
	  filename "pxelinux.0";
	  server-name "pxelinux.0";                 <--- this is also mysterious
	  option subnet-mask 255.255.255.0;              but another topic for
	  option routers 192.168.8.254;                  ISC dhclient
	  option dhcp-lease-time 43200;
	  option dhcp-message-type 5;
	  option domain-name-servers 192.168.8.254;
	  option dhcp-server-identifier 192.168.8.254;
	  option dhcp-renewal-time 21600;
	  option broadcast-address 192.168.8.255;
	  option dhcp-rebinding-time 37800;
	  option host-name "vpc";
	  option netbios-name-servers 192.168.8.253;
	  option domain-name "mhei.heimpold.itr";
	  renew 3 2007/5/9 00:30:11;
	  rebind 3 2007/5/9 06:29:26;
	  expire 3 2007/5/9 07:59:26;
	}
	vpc:~# cat /etc/hostname
	vpc

=== Case 2 - The unexpected hostname ===

/etc/hosts on the Router where dnsmasq is running:
	192.168.8.30    vpc.mhei.heimpold.itr
	...

dnsmasq.conf is not changed, some as above.

Same testing on TONNE as above, with changed results as expected:
	tonne:~# cat /etc/resolv.conf
	nameserver 192.168.8.254
	tonne:~# host vpc
	Host vpc not found: 3(NXDOMAIN)
	tonne:~# host vpc.mhei.heimpold.itr
	vpc.mhei.heimpold.itr has address 192.168.8.30
	tonne:~# host 192.168.8.30
	30.8.168.192.in-addr.arpa domain name pointer vpc.mhei.heimpold.itr.
	tonne:~#
	tonne:~# echo -e "search mhei.heimpold.itr\nnameserver 192.168.8.254"  
 > /etc/resolv.conf
	tonne:~# cat /etc/resolv.conf
	search mhei.heimpold.itr
	nameserver 192.168.8.254
	tonne:~# host vpc
	vpc.mhei.heimpold.itr has address 192.168.8.30
	tonne:~# host vpc.mhei.heimpold.itr
	vpc.mhei.heimpold.itr has address 192.168.8.30
	tonne:~# host 192.168.8.30
	30.8.168.192.in-addr.arpa domain name pointer vpc.mhei.heimpold.itr.
	tonne:~#

Output of tcpdump/dhcpdump:
     OP: 1 (BOOTPREQUEST)
  SNAME: .
  FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  60 (  3) Vendor class identifier   d-i
OPTION:  55 (  7) Parameter Request List      1 (Subnet mask)
                                              28 (Broadcast address)
                                               2 (Time offset)
                                               3 (Routers)
                                              15 (Domainname)
                                               6 (DNS server)
                                              12 (Host name)

OPTION:  61 (  7) Client-identifier         01:00:03:ff:32:ac:41
---------------------------------------------------------------------------
     OP: 2 (BOOTPREPLY)
  SNAME: tonne.mhei.heimpold.itr.
  FNAME: pxelinux.0.
OPTION:  53 (  1) DHCP message type         2 (DHCPOFFER)
OPTION:  54 (  4) Server identifier         192.168.8.254
OPTION:  51 (  4) IP address leasetime      43172 (11h59m32s)
OPTION:  58 (  4) T1                        21586 (5h59m46s)
OPTION:  59 (  4) T2                        37775 (10h29m35s)
OPTION:   1 (  4) Subnet mask               255.255.255.0
OPTION:  28 (  4) Broadcast address         192.168.8.255
OPTION:   3 (  4) Routers                   192.168.8.254
OPTION:   6 (  4) DNS server                192.168.8.254
OPTION:  15 ( 17) Domainname                mhei.heimpold.itr
OPTION:  12 ( 21) Host name                 vpc.mhei.heimpold.itr
---------------------------------------------------------------------------
     OP: 1 (BOOTPREQUEST)
  SNAME: .
  FNAME: .
OPTION:  53 (  1) DHCP message type         3 (DHCPREQUEST)
OPTION:  54 (  4) Server identifier         192.168.8.254
OPTION:  50 (  4) Request IP address        192.168.8.30
OPTION:  60 (  3) Vendor class identifier   d-i
OPTION:  55 (  7) Parameter Request List      1 (Subnet mask)
                                              28 (Broadcast address)
                                               2 (Time offset)
                                               3 (Routers)
                                              15 (Domainname)
                                               6 (DNS server)
                                              12 (Host name)

OPTION:  61 (  7) Client-identifier         01:00:03:ff:32:ac:41
---------------------------------------------------------------------------
     OP: 2 (BOOTPREPLY)
YIADDR: 192.168.8.30
SIADDR: 192.168.8.253
  SNAME: tonne.mhei.heimpold.itr.
  FNAME: pxelinux.0.
OPTION:  53 (  1) DHCP message type         5 (DHCPACK)
OPTION:  54 (  4) Server identifier         192.168.8.254
OPTION:  51 (  4) IP address leasetime      43200 (12h)
OPTION:  58 (  4) T1                        21600 (6h)
OPTION:  59 (  4) T2                        37800 (10h30m)
OPTION:   1 (  4) Subnet mask               255.255.255.0
OPTION:  28 (  4) Broadcast address         192.168.8.255
OPTION:   3 (  4) Routers                   192.168.8.254
OPTION:   6 (  4) DNS server                192.168.8.254
OPTION:  15 ( 17) Domainname                mhei.heimpold.itr
OPTION:  12 ( 21) Host name                 vpc.mhei.heimpold.itr
---------------------------------------------------------------------------

And finally on the freshly installed debian etch box VPC:
	vpc:~# cat /etc/hostname
	vpc.mhei.heimpold.itr
	vpc:~# cat /var/lib/dhcp3/dhclient.eth0.leases
	lease {
	  interface "eth0";
	  fixed-address 192.168.8.30;
	  filename "pxelinux.0";
	  server-name "pxelinux.0";
	  option subnet-mask 255.255.255.0;
	  option routers 192.168.8.254;
	  option dhcp-lease-time 43200;
	  option dhcp-message-type 5;
	  option domain-name-servers 192.168.8.254;
	  option dhcp-server-identifier 192.168.8.254;
	  option dhcp-renewal-time 21600;
	  option broadcast-address 192.168.8.255;
	  option dhcp-rebinding-time 37800;
	  option host-name "vpc.mhei.heimpold.itr";
	  option netbios-name-servers 192.168.8.253;
	  option domain-name "mhei.heimpold.itr";
	  renew 3 2007/5/9 01:19:52;
	  rebind 3 2007/5/9 07:15:53;
	  expire 3 2007/5/9 08:45:53;
	}

Thanks for reading until here.





More information about the Dnsmasq-discuss mailing list