Dynamic DNS, Android Phones, IPv6 and DNSMASQ

Hello again,

It has been a while since my last post. Too many things going on.

But in a previous post regarding the setup of DDNS, DHCP and IPV6, I mentioned that while Android phones are IPV6 enabled, they only support SLAAC configuration.

I also stated that using DNSMASQ, this could be overcome.

So here it is, keep on reading.

So to make a long story short, as you probably already know, Android phones support IPV6 but only via the SLAAC method of configuration.

They do not support configuration via DHCPv6 unlike other smart devices for example like Iphones.

This means that you cannot do DDNS registration.

In a small network with a handful of devices this is not a problem, on a bigger network this is more problematic since while IPv4 addresses can be remembered that is not the case with IPv6 addresses and remembering the name is much easier.

This is where DNSMASQ comes to the rescue. Unlike normal DNS and DHCP,  DNSMASQ is a very lightway DNS+DHCP server which was originally developed for small networks.

Having said that it will actually work nicely for this particular task and provide name resolution for smart devices that do not support DHCPv6.

Configuration

This setup is very particular.

You should have a wireless network that uses HOSTAPD and have access point(s) that use it, if you want to use DNSMASQ just to do DDNS then it is not necessary since DNSMASQ will take over the assignments of addresses.

Configure HOSTAPD and make sure that you can associate to the access point.

At this point install DNSMASQ on the Linux server and edit dnsmasq.conf (normally under /etc).

Enter the following configuration:

interface=wlan0
dhcp-range=10.x.x.10,10.x.x.20,255.255.255.0,12h
dhcp-range=fd00:d:6680:7d::2,fd00:d:6680:7d::10,ra-names,slaac,2h
no-hosts
enable-ra
domain=YOURDMOMAIN
addn-hosts=/etc/hosts.dnsmasq
#dhcp-host=XX:XX:XX:XX:XX:XX,net:allow
dhcp-host=11:22:33:44:55:66,net:allow
#dhcp-host=xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx,net:allow
dhcp-host=11:22:33:44:55:66:77:77:88:99:AA:BB:CC:DD:EE:FF,net:allow

Please note:

  • interface=use your wireless interface
  • dhcp-range=the ipv4 or ipv6 range you want to use (use your own not the ones on my example).
  • The ra-names, slaac mean:
    • ra-names: allows giving DNS names to dual hosts using SLAAC.
    • slaac:use SLAAC autoconfiguration for this segment.
  • enable-ra:enable dnsmasq’s IPv6 Router Advertisement feature.
  • I also assign static address at the bottom, you do not have to, just an example. Note one entry uses the MAC address (for IPv4), the other entry uses the UUID of the IPv6 device.
  • domain:use your own FQDN.
  • Other settings read the man pages.

At this point you will be set, restart the services, HOSTAPD and DNSMASQ.

If everything is ok, you should have it working, to test:

  • If you have a laptop, it should have obtained 2 IPv6 addresses, one via SLAAC and one via DHCPv6. The DHCPv6 is recognizable by the last characters as configured on the file.
  • On a smart device you will see again 2 such addresses but because the Android device will not use DHCPv6, it will not get an IPv6 on the range configured but instead it will get 2 SLAAC addresses.
  • On either case if you go to the laptop and ping nameofdevice.domain you will get a response showing you the IPv6 name. Voila you have name resolution, the name DNSMASQ uses is the name that is configured on the device requesting the address.

Conclusions

This works very well, I have tested and it does indeed.

Few things to be aware:

  • What is if you are using a wireless router. In this case you will need to disable the DHCP server running on it. Then use DNSMASQ on a server on your LAN to take over DHCP.
  • If your are adventurous you could try using OpenWRT for example, or one of its variants if your router supports it. I have not tested this but since it supports HOSTAPD and DNSMASQ it would be possible.
  • On the enterprise this would be a bit more problematic since you are probably using an enterprise grade system, Ubiquity, Meraki, etc. This will make it much more difficult to implement, but since in that kind of environment VLANs are probably in use then you can redirect DHCP requests for wireless devices to the DNSMASQ server. Then configure your regular DNS server to forward requests to DNSMASQ (since you control DNS you will have to create a sub-domain) and that should do it.

Hope this is will be useful information..

Ciao.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *