DHCPv6 ntp server not working

I followed the advice on DHCPv6 option6 for downstreams and added
option:ntp-server,192.168.1.1
option6:ntp-server,[fd22::1]
but it is not working, running tcp dump shows

tcpdump: listening on enp0s25, link-type EN10MB (Ethernet), snapshot length 262144 bytes
23:42:42.703213 IP6 (flowlabel 0x5116a, hlim 1, next-header UDP (17) payload length: 120) fe80::b433:a2fc:f3e5:d04.546 > ff02::1:2.547: [bad udp cksum 0x562a -> 0xd10f!] dhcp6 confirm (xid=749692 (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (option-request DNS-server DNS-search-list Client-FQDN SNTP-servers) (elapsed-time 0) (IA_NA IAID:1942487358 T1:0 T2:0 (IA_ADDR xxx:xxx:xxx:xxx:xxxx pltime:0 vltime:0) (IA_ADDR fd88::eac pltime:0 vltime:0)))
23:42:42.704015 IP6 (flowlabel 0x73461, hlim 64, next-header UDP (17) payload length: 78) fe80::b675:eff:fefd:69f6.547 > fe80::b433:a2fc:f3e5:d04.546: [udp sum ok] dhcp6 reply (xid=749692 (server-ID hwaddr type 1 b4750efd69f6) (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (opt_82) (DNS-server fd22::1) (status-code NotOnLink))
23:42:43.324963 IP6 (flowlabel 0x5116a, hlim 1, next-header UDP (17) payload length: 64) fe80::b433:a2fc:f3e5:d04.546 > ff02::1:2.547: [bad udp cksum 0x55f2 -> 0x2a85!] dhcp6 solicit (xid=d24f70 (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (option-request DNS-server DNS-search-list Client-FQDN SNTP-servers) (elapsed-time 0) (IA_NA IAID:1942487358 T1:3600 T2:5400))
23:42:43.325767 IP6 (flowlabel 0x73461, hlim 64, next-header UDP (17) payload length: 94) fe80::b675:eff:fefd:69f6.547 > fe80::b433:a2fc:f3e5:d04.546: [udp sum ok] dhcp6 advertise (xid=d24f70 (server-ID hwaddr type 1 b4750efd69f6) (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (opt_82) (DNS-server fd22::1) (IA_NA IAID:1942487358 T1:0 T2:0 (status-code NoAddrsAvail)))
23:42:44.406228 IP6 (flowlabel 0x5116a, hlim 1, next-header UDP (17) payload length: 64) fe80::b433:a2fc:f3e5:d04.546 > ff02::1:2.547: [bad udp cksum 0x55f2 -> 0x2a19!] dhcp6 solicit (xid=d24f70 (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (option-request DNS-server DNS-search-list Client-FQDN SNTP-servers) (elapsed-time 108) (IA_NA IAID:1942487358 T1:3600 T2:5400))
23:42:44.406928 IP6 (flowlabel 0x73461, hlim 64, next-header UDP (17) payload length: 94) fe80::b675:eff:fefd:69f6.547 > fe80::b433:a2fc:f3e5:d04.546: [udp sum ok] dhcp6 advertise (xid=d24f70 (server-ID hwaddr type 1 b4750efd69f6) (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (opt_82) (DNS-server fd22::1) (IA_NA IAID:1942487358 T1:0 T2:0 (status-code NoAddrsAvail)))
23:42:46.597011 IP6 (flowlabel 0x5116a, hlim 1, next-header UDP (17) payload length: 64) fe80::b433:a2fc:f3e5:d04.546 > ff02::1:2.547: [bad udp cksum 0x55f2 -> 0x293e!] dhcp6 solicit (xid=d24f70 (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (option-request DNS-server DNS-search-list Client-FQDN SNTP-servers) (elapsed-time 327) (IA_NA IAID:1942487358 T1:3600 T2:5400))
23:42:46.597749 IP6 (flowlabel 0x73461, hlim 64, next-header UDP (17) payload length: 94) fe80::b675:eff:fefd:69f6.547 > fe80::b433:a2fc:f3e5:d04.546: [udp sum ok] dhcp6 advertise (xid=d24f70 (server-ID hwaddr type 1 b4750efd69f6) (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (opt_82) (DNS-server fd22::1) (IA_NA IAID:1942487358 T1:0 T2:0 (status-code NoAddrsAvail)))
23:42:50.880997 IP6 (flowlabel 0x5116a, hlim 1, next-header UDP (17) payload length: 64) fe80::b433:a2fc:f3e5:d04.546 > ff02::1:2.547: [bad udp cksum 0x55f2 -> 0x2792!] dhcp6 solicit (xid=d24f70 (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (option-request DNS-server DNS-search-list Client-FQDN SNTP-servers) (elapsed-time 755) (IA_NA IAID:1942487358 T1:3600 T2:5400))
23:42:50.881753 IP6 (flowlabel 0x73461, hlim 64, next-header UDP (17) payload length: 94) fe80::b675:eff:fefd:69f6.547 > fe80::b433:a2fc:f3e5:d04.546: [udp sum ok] dhcp6 advertise (xid=d24f70 (server-ID hwaddr type 1 b4750efd69f6) (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (opt_82) (DNS-server fd22::1) (IA_NA IAID:1942487358 T1:0 T2:0 (status-code NoAddrsAvail)))
23:42:59.297021 IP6 (flowlabel 0x5116a, hlim 1, next-header UDP (17) payload length: 64) fe80::b433:a2fc:f3e5:d04.546 > ff02::1:2.547: [bad udp cksum 0x55f2 -> 0x2448!] dhcp6 solicit (xid=d24f70 (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (option-request DNS-server DNS-search-list Client-FQDN SNTP-servers) (elapsed-time 1597) (IA_NA IAID:1942487358 T1:3600 T2:5400))
23:42:59.297745 IP6 (flowlabel 0x73461, hlim 64, next-header UDP (17) payload length: 94) fe80::b675:eff:fefd:69f6.547 > fe80::b433:a2fc:f3e5:d04.546: [udp sum ok] dhcp6 advertise (xid=d24f70 (server-ID hwaddr type 1 b4750efd69f6) (client-ID hwaddr/time type 1 time 734844943 180373c8013e) (opt_82) (DNS-server fd22::1) (IA_NA IAID:1942487358 T1:0 T2:0 (status-code NoAddrsAvail)))

Can anyone verify that ntp server for DHCPv6 works? I removed dnsmasq and installed dnsmasq-full and rebooted the router.

Usually dhcpv6 is provided by odhcpd. Try running:

uci add_list dhcp.lan.ntp='fd22::1'
uci commit dhcp
service odhcpd restart
2 Likes

Thanks @dave14305 it worked. Do I need dnsmasq-full for it to work? because in the linked thread it was required to have dnsmasq-full over dnsmasq.

Also can I also use both IPv4 and IPv6 at the same time?

uci add_list dhcp.lan.ntp='fd22::1'
uci add_list dhcp.lan.ntp='192.168.1.1'
uci commit dhcp
service odhcpd restart

DHCPv4 will still be handled by dnsmasq (-full not required) so keep using option:ntp-server for IPv4.

If you were using dnsmasq for both DHCPv6 and v4, then you could follow the linked post, but it isn’t the standard behavior.

1 Like

It's also possible to remove odhcp6 and using only dnsmasq-full for DHCP, dhcpv6, and RA. And then set all DHCP and dhcpv6 options with/for dnsmasq.

1 Like

What I did was forego all the DHCP/RA config and just put in a firewall rule to redirect all my devices to the router. The family any intercepts both IPv4 and IPv6 requests for NTP and handles them on the router.

config redirect
        option target 'DNAT'
        list proto 'udp'
        option family 'any'
        option src 'lan'
        option src_dport '123'
        option reflection '0'
        option name 'NTP-on-router'
1 Like

Do you have any guide or any instruction website on how to do it with OpenWRT? I would like to play with it on a test router.

Sorry. I have no guide or the like. I can only recommend to use https://openwrt.org/docs/guide-user/base-system/dhcp and make the best out of it and pay closer attention to list dhcp_option which translate to dnsmasq config syntax --dhcp-option= (See https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html).
For a full list of dhcp-options, see: https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml#options
If a name is supported by dnsmasq, or not, you can check in the source, see this list: https://github.com/DNSFilter/dnsmasq/blob/master/src/dhcp-common.c#L498

For IPv6: The same.
If you do not find it in the openwrt wiki page, check the dnsmasq man page. And the IANA assignments are located here: https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml#dhcpv6-parameters-2

Config wise, I can provide you with a snippet I have in use:
(I can not recall the details, but I assume in /etc/config/dhcp was some stanza for odhcp6, which I have removed completly.)
I have this minimal config. What was once set in this file but is a default regarding to the wiki, was removed, so I should have only values left, which differ from the default. Please check yourself...
For each VLAN I have more or less the same settings, see below:

config dnsmasq
    option  leasefile           '/tmp/dhcp.leases'
    option  localservice        '0'
    option  fqdn                '1'
    option  nonegcache          '1'
    option  cachesize           '1500'

config dhcp                     'vlan17'
    option  interface           'vlan17'
    option  domain              'srv.mgmt.home.arpa'
    option  local               '/srv.mgmt.home.arpa/'
    option  start               '32'
    option  limit               '215'
    option  leasetime           '12h'
    option  dhcpv4              'server'
    list    dhcp_option         'option:dns-server, 192.168.0.1'
    list    dhcp_option         'option:domain-name, srv.mgmt.home.arpa.'
    list    dhcp_option         'option:ntp-server, 192.53.103.103'
    list    dhcp_option         '100,UTC'  # PCode
    list    dhcp_option         '101,UTC'  # TCode
    list    dhcp_option         'option:domain-search, srv.mgmt.home.arpa.'
    option  dhcpv6              'server'
    list    dhcp_option         'option6:dns-server, [fde6:a09a:b373::1]'
    list    dhcp_option         'option6:domain-search, srv.mgmt.home.arpa.'
    list    dhcp_option         'option6:ntp-server, de.pool.ntp.org.'
    option  ra                  'server'
    option  ra_slaac            '1'
    list    ra_flags            'managed-config'
    list    ra_flags            'other-config'

Edit: Pay attention that the code block has a scrollbar!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.