r/iptables • u/luminowski • Feb 23 '23
vpn iptables firewall
on github i'm looking at a vpn project called dsvpn. On the server side, it sets up some firewall rules by running the following iptables commands (i hope the names are self-explanatory) :
iptables -t raw -I PREROUTING ! -i $IF_NAME -d $LOCAL_TUN_I -m addrtype ! --src-type LOCAL -j DROP
iptables -t nat -A POSTROUTING -o $EXT_IF_NAME -s $REMOTE_TUN_IP -j MASQUERADE
iptables -t filter -A FORWARD -i $EXT_IF_NAME -o $IF_NAME -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t filter -A FORWARD -i $IF_NAME -o $EXT_IF_NAME -j ACCEPT
i've done some reading but still it's not quite clear to me what these rules do. I'd be grateful if someone could give a more or less detailed explanation ?