TODO
SSH to your UDM
ssh root@<udm ip address>
<enter the password you set when prompted>
Configure the IPv6 Tunnel - You get the addresses from the Tunnel Details page on TunnelBroker
ip tunnel add he-ipv6 mode sit remote <server ipv4 address> local <client ipv4 address> ttl 255
ip link set he-ipv6 up
ip addr add <client ipv6 address> dev he-ipv6
ip route add ::/0 dev he-ipv6
ip -f inet6 addr
Test Connectivity from UDM
ping 2600::
Setup Address Allocation
TODO
It doesn't do anything at all with ipv4 rules, those stay intact... you have to have separate rules on the UDM line for ipv6 and ipv4.
The script I have basically takes any ipv6-internet rules that are applied to your default WAN and applies them to the newly created interface. All ipv4 stuff is untouched.
By just adding the he-ipv6 interface / tunnel, you're creating a network tunnel on the unifi router that the unifi software knows nothing about, so no iptables are applied at all... it's just flapping in the wind. So you're correct in that JUST setting up the tunnel means there is no firewall in place at all for the ipv6 traffic coming into your network from that tunnel. Every ipv6 address on the network is exposed, wide open.
...Hence the creation of the script that applies rules to the new interface.
What the script does:
export ip6tables (specifically the ipv6 firewall rules) that have been applied to your actual WAN interface
modify the export to replace references to the WAN interface with references to the he-ipv6 interface
imports / restores the rules using the replacements
so it basically just 'switches out' your WAN interface's ipv6 rules to the he-ipv6 interface. (including forwards, blocks etc)
Then the reason there's a cron job to check every minute and re-apply if things have changed, is because when you go into the unifi user interface and make a change, the network application basically re-creates the firewall rules again... to the regular interface. So if the cron job detects that that has happened, it re-applies again to the tunnel.
It's a little hacky, but it works and allows you to still use the user interface to make rules that will apply to the tunnel. No need to mess with iptables or janky rules on the command-line. It also means that geo-ip blocking, forward etc will be applied to the tunnel.