brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: check IPV6=yes in /etc/default/ufw, or your IPv6 ports stay unfiltered by ufw

Ufw
~/tips/tip-ufw-ipv6-yes

grep IPV6 /etc/default/ufw

Makes sure ufw writes rules for IPv6 as well as IPv4.

If your server has an IPv6 address, an IPv4-only firewall leaves half the door open. ufw handles both, but only when one setting says so.

Check the file first:

grep IPV6 /etc/default/ufw

Ubuntu ships with IPV6=yes, but a cloud image or an old setup script may have switched it off. If it says no, change it and reload:

sudo sed -i 's/^IPV6=no/IPV6=yes/' /etc/default/ufw
sudo ufw reload
sudo ufw status

With IPv6 enabled, every rule you add without a specific address gets a second copy marked (v6) in ufw status. That’s how you can tell at a glance it works: no (v6) lines while the server has a public IPv6 address means trouble.

Rules you added while IPv6 was off don’t get a v6 copy afterwards. Delete them and add them again after the change, or add the v6 versions by hand.

I’d think twice before switching it off, though. The manual says that with IPV6=no, ufw only accepts IPv6 on the loopback interface. On a machine that needs IPv6 for something, like updates over a v6-only network, switching it off can quietly break things. Test from outside with an IPv6 address afterwards, for example with nmap -6.

Further reading: ufw(8) manual page

More Ufw tips sudo ufw app update all sudo ufw show raw sudo ufw allow to 10.0.0.1 proto esp sudo ufw allow to 224.0.0.0/24 from 10.0.0.1 proto vrrp sudo ufw show listening All Ufw tips (32) All topics

Link