tun2socks (badvpn) - having trouble with setup












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










share|improve this question

























  • Would you mind posting a link about tun2vpn? cant find it in google.

    – Rui F Ribeiro
    Mar 21 '16 at 11:05











  • Oops, it is tun2socks (badvpn): github.com/ambrop72/badvpn

    – Walter
    Mar 21 '16 at 18:57
















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










share|improve this question

























  • Would you mind posting a link about tun2vpn? cant find it in google.

    – Rui F Ribeiro
    Mar 21 '16 at 11:05











  • Oops, it is tun2socks (badvpn): github.com/ambrop72/badvpn

    – Walter
    Mar 21 '16 at 18:57














1












1








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










share|improve this question
















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







linux tunneling






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 '16 at 19:50









Rui F Ribeiro

39.5k1479132




39.5k1479132










asked Mar 21 '16 at 0:16









WalterWalter

5172618




5172618













  • Would you mind posting a link about tun2vpn? cant find it in google.

    – Rui F Ribeiro
    Mar 21 '16 at 11:05











  • Oops, it is tun2socks (badvpn): github.com/ambrop72/badvpn

    – Walter
    Mar 21 '16 at 18:57



















  • Would you mind posting a link about tun2vpn? cant find it in google.

    – Rui F Ribeiro
    Mar 21 '16 at 11:05











  • Oops, it is tun2socks (badvpn): github.com/ambrop72/badvpn

    – Walter
    Mar 21 '16 at 18:57

















Would you mind posting a link about tun2vpn? cant find it in google.

– Rui F Ribeiro
Mar 21 '16 at 11:05





Would you mind posting a link about tun2vpn? cant find it in google.

– Rui F Ribeiro
Mar 21 '16 at 11:05













Oops, it is tun2socks (badvpn): github.com/ambrop72/badvpn

– Walter
Mar 21 '16 at 18:57





Oops, it is tun2socks (badvpn): github.com/ambrop72/badvpn

– Walter
Mar 21 '16 at 18:57










1 Answer
1






active

oldest

votes


















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...






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f271167%2ftun2socks-badvpn-having-trouble-with-setup%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    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...






    share|improve this answer




























      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...






      share|improve this answer


























        0












        0








        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...






        share|improve this answer













        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...







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 58 mins ago









        intikaintika

        1925




        1925






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f271167%2ftun2socks-badvpn-having-trouble-with-setup%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            サソリ

            広島県道265号伴広島線

            Accessing regular linux commands in Huawei's Dopra Linux