Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # start vpn in background with automatic routing disabled
- sudo openvpn --config /etc/openvpn/CA\ Vancouver.ovpn --daemon --pull-filter ignore redirect-gateway
- # run this then change the values below
- sudo nano /etc/sysctl.conf
- net.ipv4.ip_forward = 1 # Enable IP Forwarding
- net.ipv4.conf.default.rp_filter = 0 # Disable Source Route Path Filtering
- net.ipv4.conf.all.rp_filter = 0 # Disable Source Route Path Filtering on All interfaces
- # execute this to reload config
- sudo sysctl -p /etc/sysctl.conf
- # Set interface values
- INTERNET_IFACE=enp2s0
- VPN_IFACE=eth0
- # Enable masquerading
- sudo iptables -A FORWARD -i "$INTERNET_IFACE" -j ACCEPT
- sudo iptables -t nat -A POSTROUTING -o "$INTERNET_IFACE" -j MASQUERADE
- # Forward the vpn to internet
- sudo iptables -A FORWARD -i "$INTERNET_IFACE" -o "$VPN_IFACE" -j ACCEPT
- sudo iptables -A FORWARD -i "$VPN_IFACE" -o "$INTERNET_IFACE" -m state --state RELATED,ESTABLISHED -j ACCEPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement