DNS relay with 3 LEDE on the same LAN

https://yingtongli.me/blog/2017/04/18/dynamic-dns.html

Will give you the basics of installing/configuring a simple BIND setup.

The lease file on openwrt is in /tmp/dhcp.leases

The packages related to mosquitto are the ones that give you MQTT message access

Each router would need a script (perhaps via cron) which scans its lease file at regular intervals, and when it detects a new one, publishes a list of hosts via mosquitto_pub and then each router would also have a mosquitto instance that brokers the messages, and run mosquitto_sub to hear these messages and add them to the DNS on each router.

Beyond that basic architecture, I can't really help you with the details, but I think it's probably easy enough to read docs and get something working.

Thanks, thanks a lot!

Im very excited to try this!

Regards,

Hi,

I have reading a lot about Mosquitto. Its really amazin world. I will need to get inside it deeply cause i also want to deploy an IoT. But, i guess, this cannot be the solution for my problem. It is a really amazin way to send message towards all the routers, but the main problem is to keep the full-dhcp-leases updated even when one of the vpn gets down for long time. Its hards to develop a way to get things updated with a simple script. Its easy for any updates when the dchp become assigned, but not for modification, unassignament, and full update when a routers becomes up again from long time with no connection.

Anyway, it gives me a nice idea i think i would deploy. In Lede, you can use "addittional hosts files" in order to resolve ip/name relationships. I just need to use scp between all devices to get external leases from its dhcp-leases file and convert them into hosts files (get proper columns) i can use inside every router which belongs the same domain. With an easy cron, i can get all of them updated. And i can ignore dhcp-leases single updates, since i will copy all the file every time i do the scp.

I will develop the solution with the script, and how to, so everybody can apply my solution in case the share my problem.

Regards,

MQTT QoS=2 and persistent sessions are "built for this" with a guarantee of "exactly once" delivery. Of course there's a bit more, as you will need to handle cases where the lease has expired or been explicitly released.

See, for example

Then again, kea already handles DDNS notification and can have real hooks for just about everything (in contrast to dnsmasq). If unbound natively handled DDNS notification it would be my "slam-dunk" choice for this. Even with having to use the unbound control agent, it's still top of my short list.

Hi, This is finnaly my solution:

1.- Enable scp between all routers with keys.

2.- Copy dhcp.leases from every router to all.

3.- Enable dnsmasq to use additional hosts files.

This is the shell script i did: (i also used cron to make it periodic)

Router_03 Script (1 and 2 must also get its own scripts aswell)

echo > /etc/Router_01.dhcp
scp -i /etc/dropbear/id_rsa root@Router_01:/tmp/dhcp.leases /etc/Router_01.dhcp 
awk -F ' ' '{print $3" "$4}' /etc/Router_01.dhcp | sort > /etc/Router_01.hosts

echo > /etc/Router_02.dhcp
scp -i /etc/dropbear/id_rsa root@Router_02:/tmp/dhcp.leases /etc/Router_02.dhcp 
awk -F ' ' '{print $3" "$4}' /etc/Router_02.dhcp | sort > /etc/Router_02.hosts

/etc/init.d/dnsmasq restart
logger DNS_Updater.sh - DHCP DNS Updater Completed!

Router_01.hosts and Router_02.hosts must be defined as additional dnsmasqs host file.

1 Like