Opened 5 years ago

Last modified 4 years ago

#13115 new enhancement

Add ipv6 support to dnsmasq

Reported by: Paul.Hampson@… Owned by: developers
Priority: normal Milestone:
Component: packages Version: Trunk
Keywords: dnsmasq ipv6 Cc:


Right now, dnsmasq generates PTR records for the IPv4 addresses of static host names.

However, it doesn't do this for IPv6.

I've got a quick-hack workaround patch which uses ipv6calc to determine ip4 and ipv6 reverse names, tested on Backfire 10.03.1

A better solution probably involves getting some ash or awk magic to perform the IPv6 expansion and inversion, but this is working for me now.

Attachments (1)

dnsmasq-ipv6calc-for-inaddr.diff (386 bytes) - added by Paul "TBBle" Hampson <Paul.Hampson@…> 5 years ago.
Use ipv6calc in dnsmasq init script to generate PTR records.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by Paul "TBBle" Hampson <Paul.Hampson@…>

Use ipv6calc in dnsmasq init script to generate PTR records.

comment:1 Changed 4 years ago by admin@…

This is useful but i guess adds a dependency to ipv6calc which they might not want.
Examining the dnsmasq configs generated by the init script in latest stable 12.09 r38863, I suggest the following further improvements:

  1. Purely cosmetic change of replacing --server with --local (they both do the same thing, but --local is more descriptive for the option) as --server is already used in append_server


append_parm "$cfg" "local" "--local"


append_parm "$cfg" "local" "--server"
  1. Replace own hostname handling from using dhcp_domain_add to just using the dnsmasq --host-record option, which automatically handles PTR for us, and DOES NOT make a wildcard entry like address (in dhcp_domain_add) does, which would lead to problems like anythingGoesHere.openwrt.lan returning the router's IP if the router's hostname is openwrt.lan (now it will return NX properly, if there's no dhcp client named anythingGoesHere).

below config_get lanaddr "lan" ipaddr add:

        local lan6addr
        config_get lan6addr "lan" ip6addr

replace the section below # add own hostname with:

        [ $ADD_LOCAL_HOSTNAME -eq 1 ] && {
                local hostname="$(uci_get system.@system[0].hostname)"
                local intips=""
                [ -n "$lanaddr" ] && {
                [ -n "$lan6addr" ] && {
                [ -n "$intips" ] && {
                        xappend "--host-record=${hostname:-OpenWrt}$intips"

This way, if the lan interface has a static ipv6 address, that will be available under the router's hostname as well.

Add Comment

Modify Ticket

as new .

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.