1

I am attempting to use tun2socks/badvpn to force all traffic through the tun device, but am having some issues. From wireshark, it appears that traffic is indeed going out properly, but not coming back in. By that, I mean that I can see an ACK from the target server, but it appears that that ACK isn't getting processed.

I also see in the badvpn command output that the reply is not successful, socks error. I am trying to run it again with a more verbose log level to see if it outputs anything useful.

  1. completely empty iptables ruleset, INPUT, OUTPUT, and FORWARD are all ACCEPT
  2. enabled ip forwarding for all interfaces and explicitly for the tun device as well as my workstation interfaces
  3. created tunnel device with ip 10.0.0.1
  4. setup tun2socks on 10.0.0.2 with a socks server of 127.0.0.1
  5. setup routes: a. route add 127.0.0.1 gw <192.168.1.1> metric 50 b. route add default gw 10.0.0.2 metric 75

Any ideas as to what I may be missing here?

Thanks,

Walter

0

Here are the proper steps:

  1. First check if your DNS is a remote one or a local one cat /etc/resolv.conf if it's a local one like 192.168.1.1 it does not a matter but if the DNS is remote for example 208.67.222.222 you need to add a route for it (see below)

  2. Connect to your ssh server

    ssh -N -C -D 8080 user@222.x.x.222

  3. Add tun interface

    ip tuntap add dev tun0 mode tun user <someuser>

  4. Setup the tun interface

    sudo ifconfig tun0 10.0.0.1 netmask 255.255.255.0

  5. run tun2socks

    badvpn-tun2socks --tundev tun0 --netif-ipaddr 10.0.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 127.0.0.1:1080

  6. if your DNS is a remote one add a route to it with a lower metric than the tun one (lower than metric on step 8)

    route add 208.67.222.222 gw 192.168.1.1 metric 4

  7. Add a route for your ssh server not 127.0.0.1

    route add 222.x.x.222 gw 192.168.1.1 metric 4

  8. Add a default route to forward everything to the tun

    route add default gw 10.0.0.2 metric 6

Your mistake was 127.0.0.1 i guess your ssh server is remote not running on 127.0.0.1...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.