Hi,
Without making a DHCP lease of any kind
Is there yet a reliable method to port forward, not to an hardcoded IP address but an hostname ?
I am fine with a process making a dns request at a regular interval for each such hostname.
I am fine with short interruption periods when the IP address associated with the hostname occurs.
It would be great if when the IP address does change in the DNS server, that it would be the DNS server that would inform the port forward rules rather than having the port forward rules polling the DNS server but that’s not strictly necessary.
So has anyone done this yet ?
uci add firewall redirect
uci set firewall.@redirect[-1].dest='lan'
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].name='example'
uci add_list firewall.@redirect[-1].proto='tcp'
uci add_list firewall.@redirect[-1].proto='udp'
uci add_list firewall.@redirect[-1].proto='icmp'
uci set firewall.@redirect[-1].src='wan'
uci set firewall.@redirect[-1].src_dport='10000'
uci set firewall.@redirect[-1].dest_ip='example.lan'
uci set firewall.@redirect[-1].dest_port='10000'
I’m asking because, something like that could be scripted, in a manner similar to how we do dynamic dns, where you poll your external ip address and if you detect that it changes, you update your dns record.
In this case this is almost the same thing, we poll the dns record and if it changes we update the firewall rules. The question is doing that, reliably, minimizing disruption duration and scope (like for instance /etc/init.d/firewall restart might be more crude than necessary) and still being efficient with lots of records.
And if the DNS server or DHCP server are accessible, using them to push update to the “Dynamic Port Forward” process.
And I know this is starting to sound like the universally revilled UPnP which, I swear, I have never used and don’t even know how it works and I, as a shut-in hermit, also spit on the grave of the “end-to-end principle” as much as the next networking forum dweller,
but I hope you can appreciate the nuance between the firewall maintaining dynamic port forwarding based on router-based policies, rather than allowing the anarchy of UPnP to run rampant on the internet and just “have things work” without spending 3 hours with grandma to explain to her how to forward a port, no, of course I would never want to live in such a dystopia ! If it just worked like that when why would Grandma give me cookies if I don’t spend 2 weeks setting up her self-hosted infrastructure so she can finally renounce the cloud, but I digress.