[Dnsmasq-discuss] Conditional sending of different DHCP-Options

Simon Kelley simon at thekelleys.org.uk
Wed Aug 13 16:20:34 BST 2008


joerg jungermann wrote:
> Hi !
> 
> I have the following setup here:
> - DNSMasq 2.41 on an OpenWrt box. (192.168.137.1/wrt)
> - A DBOX2 in Debug Mode I want to boot via BOOTP/DHCP/TFTP. (192.168.137.14)
> 
> The problem: The DBOX refuses to boot, because a certain file 'uboot.0'
> is send twice.
> 
> On WRT dnsmasq is called in the following way:
> /usr/sbin/dnsmasq -K -D -y -Z -b -E -s lan -S /lan/ -l
> /var/cache/dhcp.leases -r /tmp/resolv.conf.auto
> --dhcp-range=lan,192.168.137.34,192.168.137.63,255.255.255.0,12h -I ppp0
> 
> The file /etc/dnsmasq.conf constains the following:
> ## /etc/dnsmasq.conf
> ## user dns masq is running as
> user=root
> ## log dns queries
> #log-queries
> ## enable dhcp logging
> log-dhcp
> ## tftp base
> enable-tftp
> tftp-root=/mnt/tftproot
> #- default netboot
> dhcp-boot=/tftpboot/pxelinux.0
> #- i386 netboot
> dhcp-boot=net:i386pxe,/tftpboot/pxelinux.0,wrt.lan,192.168.137.1
> #- DBox2 netboot setup
> dhcp-host=00:50:9c:12:34:56,bibu.lan,ignore
> dhcp-boot=net:dbox2-uboot,/tftpboot/dbox/uboot.0,wrt.lan,192.168.137.1
> dhcp-mac=dbox2-uboot,00:50:9c:*:*:*
> # "DBOX2, EMPTY" is the complete string for yadi cdk-uboot,
> # but dnsmasq searches for a substring
> dhcp-boot=net:dbox2-kernel,/tftpboot/dbox/kernel,wrt.lan,192.168.137.1
> #dhcp-vendorclass=dbox2-kernel,DBOX2, EMPTY
> dhcp-vendorclass=dbox2-kernel,DBOX2
> 
> At first (stage1) the embedded bootloader of the DBOX2 request an IP +
> some options eg. the bootfile uboot.0 via BOOTP.
> 
> Then (stage2) uboot.0 is started an request IP + bootoptions via DHCP.
> The vendor class is "DBOX2, EMPTY" (obtained via tcpdump/wireshark) , so
> the line
> dhcp-vendorclass=dbox2-kernel,DBOX2
> should match.

dnsmasq logs the vendor-class when log-dhcp is on, and it's not doing so
here, so the vendor class is not being picked up. That's enough to
explain the problems you are having. Could you send me a dump of the
packet which has the vendor-class ID in it, so I can check what's
happening?

> 
> Here is the syslog extract:
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: Available DHCP range:
> 192.168.137.34 -- 192.168.137.63
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: next server: 192.168.137.1
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: bootfile name:
> /tftpboot/dbox/uboot.0
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: server name: wrt.troja
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: BOOTP(br-lan)
> 192.168.137.14 00:50:9c:12:34:56
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: tags: lan, bootp, known,
> dbox2-uboot
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 1:netmask  ff:ff:ff:00
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 28:broadcast  c0:a8:89:ff
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 3:router  c0:a8:89:01
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 6:dns-server  c0:a8:89:01
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: sent size:  5 option:
> 15:domain-name  74:72:6f:6a:61
> Aug 12 18:08:51 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 12:hostname  62:69:62:75
> Aug 12 18:08:52 wrt daemon.info dnsmasq[369]: TFTP sent
> /mnt/tftproot/tftpboot/dbox/uboot.0 to 192.168.137.14
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: DHCP packet:
> transaction-id is 827861916
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: Available DHCP range:
> 192.168.137.34 -- 192.168.137.63
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: DHCPDISCOVER(br-lan)
> 00:50:9c:12:34:56
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: DHCPOFFER(br-lan)
> 192.168.137.14 00:50:9c:12:34:56
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: next server: 192.168.137.1
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: bootfile name:
> /tftpboot/dbox/uboot.0
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: server name: wrt.troja
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: tags: lan, known, dbox2-uboot
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  1 option:
> 53:message-type  02
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 54:server-identifier  c0:a8:89:01
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 51:lease-time  00:00:a8:c0
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 58:T1  00:00:54:60
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 59:T2  00:00:93:a8
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 1:netmask  ff:ff:ff:00
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 28:broadcast  c0:a8:89:ff
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 3:router  c0:a8:89:01
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 6:dns-server  c0:a8:89:01
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  5 option:
> 15:domain-name  74:72:6f:6a:61
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: sent size:  4 option:
> 12:hostname  62:69:62:75
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: DHCP packet:
> transaction-id is 827861916
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: Available DHCP range:
> 192.168.137.34 -- 192.168.137.63
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: DHCPREQUEST(br-lan)
> 192.168.137.14 00:50:9c:12:34:56
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: DHCPACK(br-lan)
> 192.168.137.14 00:50:9c:12:34:56 bibu
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: next server: 192.168.137.1
> Aug 12 18:08:54 wrt daemon.info dnsmasq[369]: bootfile name:
> /tftpboot/dbox/uboot.0
> 
> 
> The first autoconfiguration request is done via BOOTP, so I have no
> chance to match on this.

in that case, just use the "built-in" tag bootp, but that might not be
enough to distinguish PXE, which you seem to have in there too.


> The second request is as you can see in the done via DHCP. Wireshark
> says there option 60 (vendor class) in the request with content "DBOX2,
> EMTPY".
> So the line
> dhcp-vendorclass=dbox2-kernel,DBOX2
> should match, but the boot file is still
> /mnt/tftproot/tftpboot/dbox/uboot.0 instead of /tftpboot/dbox/kernel.
> 
> The pcap file I have omitted, yet, because I think all relevant facts
> are in here. I can reproduce and make it avaiable for download if needed.

Yes please.

> 
> Do you have an hint where look in documentation, or what settings I can
> try to solve this issue.
> 
> There has been a similar problem on this list, but it was not solved,
> because the poster did not answer on the list [1]. Perhaps were now able
> to solve it with more information provided.
> 
> kind regards
> joerg jungermann
> 
> [1]
> http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2006q1/000651.html
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 




More information about the Dnsmasq-discuss mailing list