Use these iptables commands as root:
iptables -A INPUT -i tun+ -j ACCEPT
iptables -A FORWARD -i tun+ -j ACCEPT
iptables -A FORWARD -i tun+ -o YOUR_NETWORK_INTERFACE -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i YOUR_NETWORK_INTERFACE -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
Change tun+ and tun0 with wg0 if you are using Wireguard
To make the rules persistent, install iptables-persistent:
apt-get install iptables-persistent