Modify

Opened 3 years ago

Last modified 20 months ago

#17457 new enhancement

dnsmasq: add AAAA DNS record for the router hostname, for local ipv6 lookups

Reported by: braveheart_leo@… Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: base system Version: Trunk
Keywords: dnsmasq ipv6 ping6 lookup host-record Cc: maddes

Description

Currently, doing ping6 ROUTER_NAME.lan or ping6 ROUTER_NAME results in an unknown host reply from a Linux box, or ping6: bad address 'ROUTER_NAME.lan' on the router.

This is because the AAAA DNS record for the router is not automatically registered with dnsmasq, along with its A DNS record, like this:

/tmp/etc/dnsmasq.conf:
[...]
host-record=ROUTER_NAME.lan,ROUTER_NAME,192.168.1.1,fdxx:xxxx::1
[...]

I hope that this may be implemented.

Attachments (0)

Change History (8)

comment:1 Changed 3 years ago by ferrets@…

editing "/etc/hosts" or "luci-network-hostname" can make Openwrt knowing what ipv6 address is that record, but the external query to the dnsmasq can not give out the right answer. like this

root@OpenWrt:~# nslookup ipv6.nas
Server:    127.0.0.1
Address 1: 127.0.0.1 localhost

Name:      ipv6.nas
Address 1: fe80::2e0:4cff:fe68:5b6 ipv6.nas
[root@nas ~]# nslookup ipv6.nas
Server:         192.168.1.1
Address:        192.168.1.1#53

Non-authoritative answer:
*** Can't find ipv6.nas: No answer

[root@nas ~]#

comment:2 Changed 3 years ago by maddes

  • Cc maddes added

Still present in Barrier Breaker 14.07

The generated /tmp/hosts/dhcp only includes the IPv4 address for the routers name:

# auto-generated config file from /etc/config/dhcp
10.0.0.254 <router name>

Ohter related IPv6 config files like /tmp/hosts/odhcpd also do not include any entries for the router.

comment:3 Changed 3 years ago by eric

Adding entries to /etc/hosts file is really for the local machine. It helps fix startup chicken and egg before DNS can be connected and resolved. It really should only have allias's for 'localhost' and 'multicast.'

The file /tmp/hosts/dhcp is generated in /etc/init.d/dnsmasq but I am unsure how to robustly push the IP6 host name out there. This should be easy for someone who knows what they did with init.d scripts. (Seriously, does no one put comments in this stuff.)

comment:4 Changed 3 years ago by eric

This is an exact copy of the IPV4 script part in /etc/init.d/dnsmasq. It will only grab the "first" IPV6 so you should disable ULA by assigning a blank string . Then only the global address is first. It would be more complete to get the IPV6 list using /lib/functions/network.sh; however, with IPV6 having so many possible assignment per interface a paring script would need to be made for robustness.

        # add own hostname
        local lanaddr
        local lanaddr6

        [ $ADD_LOCAL_HOSTNAME -eq 1 ] && network_get_ipaddr lanaddr "lan" && {
                local hostname="$(uci_get system @system[0] hostname OpenWrt)"
                dhcp_domain_add "" "$hostname" "$lanaddr"
        }

        [ $ADD_LOCAL_HOSTNAME -eq 1 ] && network_get_ipaddr6 lanaddr6 "lan" && {
                local hostname6="$(uci_get system @system[0] hostname OpenWrt)"
                dhcp_domain_add "" "$hostname6" "$lanaddr6"
        }

comment:5 Changed 3 years ago by eric

It appears that DNSMASQ has all of this built in. Unfortunately, OPENWRT team seem to be focused on the more broad solutions in ODHCPD and consequently missed opportunities in DNSMASQ. For most with just one router (and maybe one dumb-bridge AP), DNSMASQ gets the job done. Its too bad options to un/install or in/activate either one are not part of UCI/LUCI.

The following should be placed in /etc/dnsmasq.conf. Note that the auto-generated one in /var/etc/dnsmasq.conf will link to it and append your options. The following will: push client DNS req. away from port 8080 or other favorites, generate names for hosts that forget to say who they are, set your router name to bridged-lan, create dhcpv6 pool ::1000-::ffff on bridged-lan, and begin router advertisements (ipv6) appropriate for the lone router on link.

#
# DNSMASQ Options Not Covered in UCI
#
min-port=16384
dhcp-generate-names
interface-name=YourRouterName.lan,br-lan
dhcp-range=lan6,::1000,::ffff,constructor:br-lan,8h
ra-param=br-lan,high,300,3600
enable-ra

You should remove ODHCPD to prevent conflicts, although disabling its IPV6 settings on a subnet seem to be robust. You should remove the ...[$ADD_LOCAL_HOSTNAME -eq 1]... section from /etc/init.d/dnsmasq to prevent conflicts with /tmp/hosts/dhcp, but again it seems robust even so.

comment:6 Changed 3 years ago by eric

Please refer to the DNSMASQ documentation for special conditions for the option dhcp-range= within DHCPv6. You can configure the stateful, stateless, router-advertise, and such. You can configure infering SLAAC hostnames from DHCPv4 lease requests. link:[www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html]

comment:7 Changed 20 months ago by bam80

Eric, how to "disable ODHCPD IPV6 settings on a subnet"? Do you mean "IPv6 Settings" tab of "DHCP Server" in "Interfaces - LAN" configuration window?

comment:8 Changed 20 months ago by bam80

Eric, your /etc/dnsmasq.conf won't work for Chaos Calmer's dnsmasq - seems it has IPv6 features compiled out:

dnsmasq[5104]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-DNSSEC loop-detect inotify
daemon.crit dnsmasq[5102]: unsupported option (check that dnsmasq was compiled with DHCP/TFTP/DNSSEC/DBus support) at line 49 of /etc/dnsmasq.conf
daemon.crit dnsmasq[5102]: FAILED to start up

Any clues?

Add Comment

Modify Ticket

Action
as new .
Author


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

 
Note: See TracTickets for help on using tickets.