Topic: odhcpd logging & static dhcpv6?

I'm trying to debug my configuration for dhcpv6 and setting the ipv6 suffix. For some reason, it disregards the hostid setting, and I don't see any logging statements via logread from odhcpd, even though they do exist in the source code and the daemon is running and I'm getting ipv6 leases from DHCP with DDNS updates.

Any ideas?

My /etc/config/dhcp :

config dnsmasq
    option domainneeded '1'
    option boguspriv '1'
    option localise_queries '1'
    option rebind_protection '1'
    option rebind_localhost '1'
    option expandhosts '1'
    option authoritative '1'
    option readethers '1'
    option leasefile '/tmp/dhcp.leases'
    option resolvfile '/tmp/resolv.conf.auto'
    option local '/lab/'
    option domain 'lab'

config dhcp 'lan'
    option interface 'lan'
    option limit '150'
    option leasetime '12h'
    option start '127'
    list domain 'lab'
    option ra 'server'
    option dhcpv6 'server'
    option ra_management '2'

config dhcp 'wan'
    option interface 'wan'
    option ignore '1'

config odhcpd 'odhcpd'
    option maindhcp '0'
    option leasefile '/tmp/hosts/odhcpd'
    option leasetrigger '/usr/sbin/odhcpd-update'

config dhcp 'wan6'
    option dhcpv6 'hybrid'
    option ra 'hybrid'
    option ndp 'hybrid'
    option master '1'

config host
    option name 'xxxxxx'
    option mac '00:xx:xx:xx:xx:xx'
    option ip 'xx.xx.xx.xx'
    option hostid '102'

config domain
    option name 'WCTR3550'
    option ip 'xxxx:xxx:x:xxx::3550'

config host
    option name 'xxxxx'
    option mac '48:5b:39:xx:xx:xx'
    option ip 'xx.xx.xx.xx'
    option hostid '000'

Re: odhcpd logging & static dhcpv6?

I can get it to assign an IP address if I add the DUID to the config file too, but there's no UI for this in LuCI

Re: odhcpd logging & static dhcpv6?

jhnphm wrote:

I can get it to assign an IP address if I add the DUID to the config file too, but there's no UI for this in LuCI

Could you show us an example, please? I'm also trying to assign static DHCPv6 leases, but I've found a severe lack of documentation about odhcpd

4 (edited by jhnphm 2014-06-11 00:27:21)

Re: odhcpd logging & static dhcpv6?

You'd have to have it first get a DHCPv6 lease in order to obtain the duid in /var/hosts/odhcpd (or look in the web interface under DHCPv6 leases)

Then, in /etc/config/dhcp, add the DUID (or use uci to do this) and the hostid, which is the last 8 hex digits of the IPV6 address.

Then reload with killall -HUP odhcpd

Example entry in /etc/config/dhcp:

config host
    option name 'jpham'
    option mac 'XX:XX:XX:XX:XX:XX'
    option duid '0004bf0aa926XXXXXXX27c6be9919d6' # <- add this
    option ip 'XX.XX.XX.XX'
    option hostid 'd1e7c01a' # <- 8 digits

Do be aware that killall -HUP might not work and you might have to restart odhcp with "/etc/init.d/odhcpd restart"

Re: odhcpd logging & static dhcpv6?

Here's a script to do it:

#! /bin/sh

ID=$(uci show dhcp|awk -F '[][=.]' "{if (\$2==\"@host\" && \$6==\"$1\") print \$3}")
uci set dhcp.@host[$ID].duid=$2
uci commit
killall -HUP odhcpd

Pass host as first parameter, duid as second

Re: odhcpd logging & static dhcpv6?

This should autoupdate DUIDs (use at your own risk)

#! /bin/sh

for I in $(uci show dhcp|awk -F '[][=.]' '{if ($2=="@host" && $5=="name") print $6}'); do # find existing static host entries and find hostnames
    DUID=$(cat /var/hosts/odhcpd |awk -F ' '  "{if (\$1 == \"#\" && \$5 == \"$I\") print \$3 }"|head -n 1)  # find duid for existing hostname in leases 
    ID=$(uci show dhcp|awk -F '[][=.]'  "{if (\$2==\"@host\" && \$6==\"$I\") print \$3}") # Find placement of host entry
    uci set dhcp.@host[$ID].duid=$DUID # Set DUID
done
uci commit
killall -HUP odhcpd

Re: odhcpd logging & static dhcpv6?

Thank you, I've got it.

Re: odhcpd logging & static dhcpv6?

I don't see that you ever received an answer to you original question about odhcpd log files.  Did you ever figure out where log file is?  I'm trying to find this myself, but can't.

For me, I'm trying to use odhcdp to issue DHCPv4 addresses in addition to DHCPv6.  The v4 addresses are being issued, but they do not adhere to the range constraint of the /etc/config/dhcp files states.  I have a starting address of 25, with a limit of 25 and I'm picking up an address of 152.

I've chosen to use odhcpd for DHCPv4, because it seems to be the only way that the /tmp/hosts/odhcp file can update a new DHCPv6 lease.  When running /usr/sbin/odhcpd-update manually, it doesn't appear to reread this file.

If anyone knows where the logfiles are I'd appreciate it.  If anyone has a solution for odhcpd rereading the /tmp/hosts/odhcp when a DHVPv6 lease gets renewed; I'm all ears.

Re: odhcpd logging & static dhcpv6?

I just bumped odhcpd in both trunk and bb branches: It now respects the range constraints correctly and DHCPv6-parts now log to syslog as well, e.g.:

Tue Aug 19 06:00:53 2014 daemon.warn odhcpd[1924]: DHCPV6 REQUEST IA_NA from 000300010a0027000000 on br-lan: ok fde8:19c3:a699::571/128 
Tue Aug 19 06:00:53 2014 daemon.warn odhcpd[1924]: DHCPV6 REQUEST IA_PD from 000300010a0027000000 on br-lan: ok fde8:19c3:a699:4::/62

Also rewriting the hosts file should be fixed for a while now, what revision were you using?

Re: odhcpd logging & static dhcpv6?

Shouldn't the message in the log be a info/debug and not a warning?

Netgear WNDR3800 Custom Build;
Netgear Nighthawk X4S D7800;
Buffalo WBMR-HP-G300H Custom Build;

Re: odhcpd logging & static dhcpv6?

CyrusFF wrote:

I just bumped odhcpd in both trunk and bb branches: It now respects the range constraints correctly and DHCPv6-parts now log to syslog as well, e.g.:

Tue Aug 19 06:00:53 2014 daemon.warn odhcpd[1924]: DHCPV6 REQUEST IA_NA from 000300010a0027000000 on br-lan: ok fde8:19c3:a699::571/128 
Tue Aug 19 06:00:53 2014 daemon.warn odhcpd[1924]: DHCPV6 REQUEST IA_PD from 000300010a0027000000 on br-lan: ok fde8:19c3:a699:4::/62

Also rewriting the hosts file should be fixed for a while now, what revision were you using?

Cyrus,
I'm running hnyman's build of BB 14.07 rc3, r42161 / LuCI Trunk (svn-r10520).  opkg only shows me the odhcpd package I already have installed;
odhcpd - 2014-08-12-479cd9f6a5b6c68285004aa30bacfb284121ac8e.

Under trunk I find this one, odhcpd_2014-08-13-f41da55f11f06361e23f11a87f179aa56565c106_ar71xx, I don't see one with a date of 2014-08-19.  Which one should I be looking for?

12

Re: odhcpd logging & static dhcpv6?

billmc wrote:

Cyrus,
I'm running hnyman's build of BB 14.07 rc3, r42161 / LuCI Trunk (svn-r10520).  opkg only shows me the odhcpd package I already have installed;
odhcpd - 2014-08-12-479cd9f6a5b6c68285004aa30bacfb284121ac8e.

Under trunk I find this one, odhcpd_2014-08-13-f41da55f11f06361e23f11a87f179aa56565c106_ar71xx, I don't see one with a date of 2014-08-19.  Which one should I be looking for?

It isn't built yet by the buildbots. You'll need to compile it yourself or wait for (at least) tomorrow .

Re: odhcpd logging & static dhcpv6?

snk wrote:

It isn't built yet by the buildbots. You'll need to compile it yourself or wait for (at least) tomorrow .

Thanks, didn't know that.  I'll wait until its built.

14 (edited by hnyman 2014-08-19 16:05:50)

Re: odhcpd logging & static dhcpv6?

billmc wrote:

Under trunk I find this one, odhcpd_2014-08-13-f41da55f11f06361e23f11a87f179aa56565c106_ar71xx, I don't see one with a date of 2014-08-19.  Which one should I be looking for?

I have uploaded a new version of my trunk build, and also separately odhcpd_2014-08-19 both for trunk and BB14.07. See http://db.tt/4FM5if8e  (you can download the package with wget and manually opkg install it)

15 (edited by ashus 2015-12-13 22:08:51)

Re: odhcpd logging & static dhcpv6?

jhnphm wrote:

This should autoupdate DUIDs (use at your own risk)

Modified version for new OpenWRT releases (uci show dhcp values are enclosed in quotes):

#!/bin/sh

for I in $(uci show dhcp|awk -F '[][=.]' '{if ($2=="@host" && $5=="name") print $6}'); do # find existing static host entries and find host$
    NAME=$(echo -ne $I | sed -r "s/'//g")
    DUID=$(cat /var/hosts/odhcpd |awk -F ' '  "{if (\$1 == \"#\" && \$5 == \"$NAME\") print \$3 }"|head -n 1)  # find duid for existing hos$
    ID=$(uci show dhcp|awk -F '[][=.]'  "{if (\$2==\"@host\" && \$6==\"$I\") print \$3}") # Find placement of host entry
    uci set dhcp.@host[$ID].duid=$DUID # Set DUID
done
uci commit
killall -HUP odhcpd

Even more recent version for Designated Driver is here.