This page says that only ipv6 addresses are allowed in the dns field for dhcp pools, but in fact ipv4 addresses also work:
https://openwrt.org/docs/guide-user/base-system/dhcp#dhcp_pools
The ODHCPD page correctly says that both ipv4 and ipv6 are supported:
https://openwrt.org/docs/techref/odhcpd#dhcp_section
Could someone with wiki edit privileges please edit the dhcp page? Probably the text from the ODHCPD page could be copied. It may also be useful to mention on both pages that this is for configuring dhcpv6.
The UI page should probably also be clarified, as it seems to strongly suggest that only ipv6 is supported, when ipv4 also works:
(Network -> Interfaces -> Edit -> DHCP Server -> IPv6 Settings)
I ran into this today since I'm running an internal DNS server on a machine that currently only supports ipv4, so both dhcpv4 and dhcpv6 need to announce that machine's ipv4 address.
Have you verified that the ipv4 address that you are stuffing into an ipv6 field is actually working? Iād be surprised if it does. IPv4 dhcp uses option 6 to specify the dns, which is exactly what the documentation says.
1 Like
Specifying IPv4 would likely only be valid if using odhcpd
as the DHCPv4 DNS server, which is not the default.
I did some more testing, and it looks like @psherman is correct, the ipv4 address I'm putting in there doesn't actually work. I verified by turning off ipv4 and resetting the network interface on my client machine. With only ipv6 enabled, I get the router's ipv6 address as my dns server, unless I have option dns_service '0'
, in which case I don't get a dns server (or in Windows I get some default addresses like fec0:0:0:ffff::1%1
).
I had incorrectly assumed that setting the dns
option had helped my client get the ipv4 address of my local dns server, but it seems that actually only ever gets configured via ipv4 / dhcpv4. So things working for me after changing the dns
setting was probably just a coincidence.
With my client's ipv4 turned back on, and option dns_service '0'
, or "Local IPv6 DNS Server" toggled off in the UI I get the ipv4 address that I'm looking for though I am still dependent on receiving that via ipv4. In the future once my local dns server becomes accessible via ipv6, I can toggle that option back on and have OpenWRT announce it by putting it in the dns
field, or "Announced IPv6 DNS servers" in the UI.
Thanks very much for the replies, and apologies for my misinformed request and my lack of knowledge about ipv6 / dhcpv6.