Skip to content

redirect all traffic through tinyfecVPN

wangyu- edited this page Feb 25, 2018 · 8 revisions

This tutorial explains how to redirect all traffic through tinyfecVPN, it essentially works for all VPNs.

prepare

clear all you iptables rule on both sides(suggested for first-time use):

https://github.com/wangyu-/tinyfecVPN/wiki/how-to-fully-clear-iptables

run at server side:

#enable ip forward:
echo 1 >/proc/sys/net/ipv4/ip_forward

#setup SNAT rule:
iptables -t nat -A POSTROUTING -s 10.222.0.0/16 ! -d 10.222.0.0/16 -j MASQUERADE

#run tinyfecVPN server
./tinyvpn_amd64 -s -l 0.0.0.0:8855 --sub-net 10.222.2.0 --tun-dev tun100 --report 10 -k 1234

run at client side:

#run tinyFecVPN client
./tinyvpn_x86 -c -r 44.55.66.77:8855 --sub-net 10.222.2.0 --tun-dev tun100 --keep-reconnect  --report 10 -k 1234

#add route rules
ip route add 44.55.66.77/32 via 192.168.99.1     #change 44.55.66.77 to your server ip; 192.168.99.1 to your default gateway.
ip route add 0.0.0.0/1 via 10.222.2.1 dev tun100
ip route add 128.0.0.0/1 via 10.222.2.1 dev tun100

note:

You need to compile un-restricted tinyfecVPN server by youself.