You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

16 lines
537 B

#!/bin/bash
printf "\n################## Setup firewall ##################\n"
# Make ip forwading and make it persistent
echo 1 > "/proc/sys/net/ipv4/ip_forward"
echo "net.ipv4.ip_forward = 1" >> "/etc/sysctl.conf"
# Iptable rules
iptables -I FORWARD -i $VPN_DEV -j ACCEPT
iptables -I FORWARD -o $VPN_DEV -j ACCEPT
iptables -I OUTPUT -o $VPN_DEV -j ACCEPT
iptables -A FORWARD -i $VPN_DEV -o $VPN_IF -j ACCEPT
iptables -t nat -A POSTROUTING -o $VPN_IF -j MASQUERADE
iptables -t nat -A POSTROUTING -s $VPN_NET -o $VPN_IF -j MASQUERADE