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: ufw route allow controls traffic that passes through the host

Ufw
~/tips/tip-ufw-route-allow-forwarding

sudo ufw route allow in on wg0 out on eth0 to 192.168.1.0/24

Writes firewall rules for traffic that is forwarded between interfaces.

A VPN gateway or a router has packets that enter on one interface and leave on another. Normal ufw rules only look at traffic for the host itself.

sudo ufw route allow in on wg0 out on eth0 to 192.168.1.0/24

ufw route writes rules for forwarded traffic. The rule above lets traffic from the wg0 interface go out to the 192.168.1.0/24 network via eth0. Forwarding itself must be on as well: enable net/ipv4/ip_forward=1 in /etc/ufw/sysctl.conf, then run sudo ufw disable and sudo ufw enable, because ufw reads that file when it is enabled. Unless the routed policy is set to allow, nothing passes without a rule like this one.

Further reading: ufw 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