sudo add-apt-repository ppa:hda-me/badvpn-tun2socks
sudo apt-get update
sudo apt-get install badvpn-tun2socks
ip tuntap add dev tun1 mode tun user nobody
ifconfig tun1 up 10.0.0.1/24
# --netif-ipaddr 10.0.0.2 is not a typo.
# It specifies the IP address of the virtual router inside the TUN device,
# and must be different than the IP of the TUN interface itself.
# This command assumes you have tor up and running on 127.0.0.1:9050.
# Of course, you can use any other SOCKS proxy instead.
badvpn-tun2socks --tundev tun1 --netif-ipaddr 10.0.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 127.0.0.1:9050