Making a SSH VPNSystemwide proxy settings in ubuntuSetting-up SSH-tunnel for VPN?How to add a private IP address?VPN for SSH, Internet for all the restCisco VPN Connection only for ssh?How to redirect all internet traffic to SSH tunnel?SSH to Server that is connected to VPNSSH and VPN Cisco connection working on one laptop but not on another. Both laptops using Ubuntu 14.04. Where is the difference?SSH into Virtual Private Server connected to VPNSSH through VPN ChromebookUsing SSH when behind VPNHow to make a killswitch for OpenVPN client running on a server that allows SSH connections into the server?How to use VPN in a similar manner as SSH tunes?

Which country has more?

Is divide-by-zero a security vulnerability?

What do you call someone who likes to pick fights?

Was it really inappropriate to write a pull request for the company I interviewed with?

What would be the most expensive material to an intergalactic society?

Is it appropriate to ask a former professor to order a book for me through an inter-library loan?

I am the person who abides by rules, but breaks the rules. Who am I?

Under what conditions can the right to be silence be revoked in the USA?

When an outsider describes family relationships, which point of view are they using?

How can a demon take control of a human body during REM sleep?

Is there a logarithm base for which the logarithm becomes an identity function?

What is Tony Stark injecting into himself in Iron Man 3?

Does an unused member variable take up memory?

Are small insurances worth it?

Are all players supposed to be able to see each others' character sheets?

Is it possible to clone a polymorphic object without manually adding overridden clone method into each derived class in C++?

Has a sovereign Communist government ever run, and conceded loss, on a fair election?

Boss Telling direct supervisor I snitched

If sound is a longitudinal wave, why can we hear it if our ears aren't aligned with the propagation direction?

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

PTIJ: Sport in the Torah

Help! My Character is too much for her story!

How do we create new idioms and use them in a novel?

What should I do when a paper is published similar to my PhD thesis without citation?



Making a SSH VPN


Systemwide proxy settings in ubuntuSetting-up SSH-tunnel for VPN?How to add a private IP address?VPN for SSH, Internet for all the restCisco VPN Connection only for ssh?How to redirect all internet traffic to SSH tunnel?SSH to Server that is connected to VPNSSH and VPN Cisco connection working on one laptop but not on another. Both laptops using Ubuntu 14.04. Where is the difference?SSH into Virtual Private Server connected to VPNSSH through VPN ChromebookUsing SSH when behind VPNHow to make a killswitch for OpenVPN client running on a server that allows SSH connections into the server?How to use VPN in a similar manner as SSH tunes?













1















So by using ssh you will connect to a server by typing in ssh User@PrivateIP how would it be possible to turn that code into a piece of code that works like a VPN (so searching for example google from a different geolocation). FYI: By connecting I mean that you connect to a computer of your own and not a supplied VPN server.










share|improve this question



















  • 1





    Do you mean you want to run a socks proxy server at your home desktop and connect to it from your laptop when traveling?

    – user68186
    Jan 29 at 12:58











  • You are looking for SSH Tunneling. Otherwise you can setup VPN via ordinary VPN server.

    – kukulo
    Jan 29 at 13:39











  • I don't know if you're looking for something like this: How to build your own VPN ...

    – glenn jackman
    Jan 29 at 18:30






  • 3





    Possible duplicate of Setting up SSH tunnel for VPN?

    – karel
    Feb 1 at 15:02






  • 3





    @Reviewers: Let's reopen this question and close it as a duplicate of Setting up SSH tunnel for VPN?

    – pa4080
    yesterday
















1















So by using ssh you will connect to a server by typing in ssh User@PrivateIP how would it be possible to turn that code into a piece of code that works like a VPN (so searching for example google from a different geolocation). FYI: By connecting I mean that you connect to a computer of your own and not a supplied VPN server.










share|improve this question



















  • 1





    Do you mean you want to run a socks proxy server at your home desktop and connect to it from your laptop when traveling?

    – user68186
    Jan 29 at 12:58











  • You are looking for SSH Tunneling. Otherwise you can setup VPN via ordinary VPN server.

    – kukulo
    Jan 29 at 13:39











  • I don't know if you're looking for something like this: How to build your own VPN ...

    – glenn jackman
    Jan 29 at 18:30






  • 3





    Possible duplicate of Setting up SSH tunnel for VPN?

    – karel
    Feb 1 at 15:02






  • 3





    @Reviewers: Let's reopen this question and close it as a duplicate of Setting up SSH tunnel for VPN?

    – pa4080
    yesterday














1












1








1


0






So by using ssh you will connect to a server by typing in ssh User@PrivateIP how would it be possible to turn that code into a piece of code that works like a VPN (so searching for example google from a different geolocation). FYI: By connecting I mean that you connect to a computer of your own and not a supplied VPN server.










share|improve this question
















So by using ssh you will connect to a server by typing in ssh User@PrivateIP how would it be possible to turn that code into a piece of code that works like a VPN (so searching for example google from a different geolocation). FYI: By connecting I mean that you connect to a computer of your own and not a supplied VPN server.







command-line ssh vpn proxy






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 30 at 9:26









pa4080

14.4k52670




14.4k52670










asked Jan 29 at 12:49









ijndkgeoijndkgeo

153




153







  • 1





    Do you mean you want to run a socks proxy server at your home desktop and connect to it from your laptop when traveling?

    – user68186
    Jan 29 at 12:58











  • You are looking for SSH Tunneling. Otherwise you can setup VPN via ordinary VPN server.

    – kukulo
    Jan 29 at 13:39











  • I don't know if you're looking for something like this: How to build your own VPN ...

    – glenn jackman
    Jan 29 at 18:30






  • 3





    Possible duplicate of Setting up SSH tunnel for VPN?

    – karel
    Feb 1 at 15:02






  • 3





    @Reviewers: Let's reopen this question and close it as a duplicate of Setting up SSH tunnel for VPN?

    – pa4080
    yesterday













  • 1





    Do you mean you want to run a socks proxy server at your home desktop and connect to it from your laptop when traveling?

    – user68186
    Jan 29 at 12:58











  • You are looking for SSH Tunneling. Otherwise you can setup VPN via ordinary VPN server.

    – kukulo
    Jan 29 at 13:39











  • I don't know if you're looking for something like this: How to build your own VPN ...

    – glenn jackman
    Jan 29 at 18:30






  • 3





    Possible duplicate of Setting up SSH tunnel for VPN?

    – karel
    Feb 1 at 15:02






  • 3





    @Reviewers: Let's reopen this question and close it as a duplicate of Setting up SSH tunnel for VPN?

    – pa4080
    yesterday








1




1





Do you mean you want to run a socks proxy server at your home desktop and connect to it from your laptop when traveling?

– user68186
Jan 29 at 12:58





Do you mean you want to run a socks proxy server at your home desktop and connect to it from your laptop when traveling?

– user68186
Jan 29 at 12:58













You are looking for SSH Tunneling. Otherwise you can setup VPN via ordinary VPN server.

– kukulo
Jan 29 at 13:39





You are looking for SSH Tunneling. Otherwise you can setup VPN via ordinary VPN server.

– kukulo
Jan 29 at 13:39













I don't know if you're looking for something like this: How to build your own VPN ...

– glenn jackman
Jan 29 at 18:30





I don't know if you're looking for something like this: How to build your own VPN ...

– glenn jackman
Jan 29 at 18:30




3




3





Possible duplicate of Setting up SSH tunnel for VPN?

– karel
Feb 1 at 15:02





Possible duplicate of Setting up SSH tunnel for VPN?

– karel
Feb 1 at 15:02




3




3





@Reviewers: Let's reopen this question and close it as a duplicate of Setting up SSH tunnel for VPN?

– pa4080
yesterday






@Reviewers: Let's reopen this question and close it as a duplicate of Setting up SSH tunnel for VPN?

– pa4080
yesterday











1 Answer
1






active

oldest

votes


















1














It's not exactly VPN, but could be enough in the most cases. You can create ssh connection with dynamic port forwarding to create socks proxy:



ssh -D 9050 user@sshserver -fTNC


  • -D [bind_address:]port Specifies a local “dynamic” application-level port forwarding... Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported... read more at man ssh.


  • The options -fTNC will enable the compression and will push the connection in the background.


  • Optionally use autossh instead of ssh.



  • In addition, you can create crontab entry as this:



    @reboot autossh -D 9050 user@sshserver -fTNC


The rest you need to do is to tell your applications to use localhost:9050 as socks proxy. Here are few references dedicated to this task:



  • Systemwide proxy settings in ubuntu or How to on Ubuntu 18.04


  • Set Ubuntu System Proxy Settings without Restart from command-line


  • How To Route Web Traffic Securely Without a VPN Using a SOCKS Tunnel


  • Setting up Proxy in Ubuntu


  • For any other special requirements probably iptables rules can be applied.



Another solution that is more close to VPN is sshuttle, which works over ssh too. Here is its overview:




sshuttle: where transparent proxy meets VPN meets ssh



As far as I know, sshuttle is the only program that solves the following common case:



  • Your client machine (or router) is Linux, FreeBSD, or MacOS.

  • You have access to a remote network via ssh.

  • You don't necessarily have admin access on the remote network.

  • The remote network has no VPN, or only stupid/complex VPN protocols (IPsec, PPTP, etc). Or maybe you are the admin and you just got
    frustrated with the awful state of VPN tools.

  • You don't want to create an ssh port forward for every single host/port on the remote network.

  • You hate openssh's port forwarding because it's randomly slow and/or stupid.

  • You can't use openssh's PermitTunnel feature because it's disabled by default on openssh servers; plus it does TCP-over-TCP, which has
    terrible performance (see below).



It is available in Ubuntu repository, so you can install it and start your examination by the command:



sudo apt install sshuttle


It is also possible to install into a virtualenv as a non-root user. Once it is installed you can use:



 sshuttle --dns -r user@sshserver 0.0.0.0/0


This command will forward all traffic including DNS queries will be proxied through the DNS server of the server you are connect to.






share|improve this answer
























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2faskubuntu.com%2fquestions%2f1113801%2fmaking-a-ssh-vpn%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









    1














    It's not exactly VPN, but could be enough in the most cases. You can create ssh connection with dynamic port forwarding to create socks proxy:



    ssh -D 9050 user@sshserver -fTNC


    • -D [bind_address:]port Specifies a local “dynamic” application-level port forwarding... Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported... read more at man ssh.


    • The options -fTNC will enable the compression and will push the connection in the background.


    • Optionally use autossh instead of ssh.



    • In addition, you can create crontab entry as this:



      @reboot autossh -D 9050 user@sshserver -fTNC


    The rest you need to do is to tell your applications to use localhost:9050 as socks proxy. Here are few references dedicated to this task:



    • Systemwide proxy settings in ubuntu or How to on Ubuntu 18.04


    • Set Ubuntu System Proxy Settings without Restart from command-line


    • How To Route Web Traffic Securely Without a VPN Using a SOCKS Tunnel


    • Setting up Proxy in Ubuntu


    • For any other special requirements probably iptables rules can be applied.



    Another solution that is more close to VPN is sshuttle, which works over ssh too. Here is its overview:




    sshuttle: where transparent proxy meets VPN meets ssh



    As far as I know, sshuttle is the only program that solves the following common case:



    • Your client machine (or router) is Linux, FreeBSD, or MacOS.

    • You have access to a remote network via ssh.

    • You don't necessarily have admin access on the remote network.

    • The remote network has no VPN, or only stupid/complex VPN protocols (IPsec, PPTP, etc). Or maybe you are the admin and you just got
      frustrated with the awful state of VPN tools.

    • You don't want to create an ssh port forward for every single host/port on the remote network.

    • You hate openssh's port forwarding because it's randomly slow and/or stupid.

    • You can't use openssh's PermitTunnel feature because it's disabled by default on openssh servers; plus it does TCP-over-TCP, which has
      terrible performance (see below).



    It is available in Ubuntu repository, so you can install it and start your examination by the command:



    sudo apt install sshuttle


    It is also possible to install into a virtualenv as a non-root user. Once it is installed you can use:



     sshuttle --dns -r user@sshserver 0.0.0.0/0


    This command will forward all traffic including DNS queries will be proxied through the DNS server of the server you are connect to.






    share|improve this answer





























      1














      It's not exactly VPN, but could be enough in the most cases. You can create ssh connection with dynamic port forwarding to create socks proxy:



      ssh -D 9050 user@sshserver -fTNC


      • -D [bind_address:]port Specifies a local “dynamic” application-level port forwarding... Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported... read more at man ssh.


      • The options -fTNC will enable the compression and will push the connection in the background.


      • Optionally use autossh instead of ssh.



      • In addition, you can create crontab entry as this:



        @reboot autossh -D 9050 user@sshserver -fTNC


      The rest you need to do is to tell your applications to use localhost:9050 as socks proxy. Here are few references dedicated to this task:



      • Systemwide proxy settings in ubuntu or How to on Ubuntu 18.04


      • Set Ubuntu System Proxy Settings without Restart from command-line


      • How To Route Web Traffic Securely Without a VPN Using a SOCKS Tunnel


      • Setting up Proxy in Ubuntu


      • For any other special requirements probably iptables rules can be applied.



      Another solution that is more close to VPN is sshuttle, which works over ssh too. Here is its overview:




      sshuttle: where transparent proxy meets VPN meets ssh



      As far as I know, sshuttle is the only program that solves the following common case:



      • Your client machine (or router) is Linux, FreeBSD, or MacOS.

      • You have access to a remote network via ssh.

      • You don't necessarily have admin access on the remote network.

      • The remote network has no VPN, or only stupid/complex VPN protocols (IPsec, PPTP, etc). Or maybe you are the admin and you just got
        frustrated with the awful state of VPN tools.

      • You don't want to create an ssh port forward for every single host/port on the remote network.

      • You hate openssh's port forwarding because it's randomly slow and/or stupid.

      • You can't use openssh's PermitTunnel feature because it's disabled by default on openssh servers; plus it does TCP-over-TCP, which has
        terrible performance (see below).



      It is available in Ubuntu repository, so you can install it and start your examination by the command:



      sudo apt install sshuttle


      It is also possible to install into a virtualenv as a non-root user. Once it is installed you can use:



       sshuttle --dns -r user@sshserver 0.0.0.0/0


      This command will forward all traffic including DNS queries will be proxied through the DNS server of the server you are connect to.






      share|improve this answer



























        1












        1








        1







        It's not exactly VPN, but could be enough in the most cases. You can create ssh connection with dynamic port forwarding to create socks proxy:



        ssh -D 9050 user@sshserver -fTNC


        • -D [bind_address:]port Specifies a local “dynamic” application-level port forwarding... Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported... read more at man ssh.


        • The options -fTNC will enable the compression and will push the connection in the background.


        • Optionally use autossh instead of ssh.



        • In addition, you can create crontab entry as this:



          @reboot autossh -D 9050 user@sshserver -fTNC


        The rest you need to do is to tell your applications to use localhost:9050 as socks proxy. Here are few references dedicated to this task:



        • Systemwide proxy settings in ubuntu or How to on Ubuntu 18.04


        • Set Ubuntu System Proxy Settings without Restart from command-line


        • How To Route Web Traffic Securely Without a VPN Using a SOCKS Tunnel


        • Setting up Proxy in Ubuntu


        • For any other special requirements probably iptables rules can be applied.



        Another solution that is more close to VPN is sshuttle, which works over ssh too. Here is its overview:




        sshuttle: where transparent proxy meets VPN meets ssh



        As far as I know, sshuttle is the only program that solves the following common case:



        • Your client machine (or router) is Linux, FreeBSD, or MacOS.

        • You have access to a remote network via ssh.

        • You don't necessarily have admin access on the remote network.

        • The remote network has no VPN, or only stupid/complex VPN protocols (IPsec, PPTP, etc). Or maybe you are the admin and you just got
          frustrated with the awful state of VPN tools.

        • You don't want to create an ssh port forward for every single host/port on the remote network.

        • You hate openssh's port forwarding because it's randomly slow and/or stupid.

        • You can't use openssh's PermitTunnel feature because it's disabled by default on openssh servers; plus it does TCP-over-TCP, which has
          terrible performance (see below).



        It is available in Ubuntu repository, so you can install it and start your examination by the command:



        sudo apt install sshuttle


        It is also possible to install into a virtualenv as a non-root user. Once it is installed you can use:



         sshuttle --dns -r user@sshserver 0.0.0.0/0


        This command will forward all traffic including DNS queries will be proxied through the DNS server of the server you are connect to.






        share|improve this answer















        It's not exactly VPN, but could be enough in the most cases. You can create ssh connection with dynamic port forwarding to create socks proxy:



        ssh -D 9050 user@sshserver -fTNC


        • -D [bind_address:]port Specifies a local “dynamic” application-level port forwarding... Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported... read more at man ssh.


        • The options -fTNC will enable the compression and will push the connection in the background.


        • Optionally use autossh instead of ssh.



        • In addition, you can create crontab entry as this:



          @reboot autossh -D 9050 user@sshserver -fTNC


        The rest you need to do is to tell your applications to use localhost:9050 as socks proxy. Here are few references dedicated to this task:



        • Systemwide proxy settings in ubuntu or How to on Ubuntu 18.04


        • Set Ubuntu System Proxy Settings without Restart from command-line


        • How To Route Web Traffic Securely Without a VPN Using a SOCKS Tunnel


        • Setting up Proxy in Ubuntu


        • For any other special requirements probably iptables rules can be applied.



        Another solution that is more close to VPN is sshuttle, which works over ssh too. Here is its overview:




        sshuttle: where transparent proxy meets VPN meets ssh



        As far as I know, sshuttle is the only program that solves the following common case:



        • Your client machine (or router) is Linux, FreeBSD, or MacOS.

        • You have access to a remote network via ssh.

        • You don't necessarily have admin access on the remote network.

        • The remote network has no VPN, or only stupid/complex VPN protocols (IPsec, PPTP, etc). Or maybe you are the admin and you just got
          frustrated with the awful state of VPN tools.

        • You don't want to create an ssh port forward for every single host/port on the remote network.

        • You hate openssh's port forwarding because it's randomly slow and/or stupid.

        • You can't use openssh's PermitTunnel feature because it's disabled by default on openssh servers; plus it does TCP-over-TCP, which has
          terrible performance (see below).



        It is available in Ubuntu repository, so you can install it and start your examination by the command:



        sudo apt install sshuttle


        It is also possible to install into a virtualenv as a non-root user. Once it is installed you can use:



         sshuttle --dns -r user@sshserver 0.0.0.0/0


        This command will forward all traffic including DNS queries will be proxied through the DNS server of the server you are connect to.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited yesterday

























        answered Jan 29 at 22:47









        pa4080pa4080

        14.4k52670




        14.4k52670



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Ask Ubuntu!


            • 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%2faskubuntu.com%2fquestions%2f1113801%2fmaking-a-ssh-vpn%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

            Are there any comparative studies done between Ashtavakra Gita and Buddhim?How is it wrong to believe that a self exists, or that it doesn't?Can you criticise or improve Ven. Bodhi's description of MahayanaWas the doctrine of 'Anatta', accepted as doctrine by modern Buddhism, actually taught by the Buddha?Relationship between Buddhism, Hinduism and Yoga?Comparison of Nirvana, Tao and Brahman/AtmaIs there a distinction between “ego identity” and “craving/hating”?Are there many differences between Taoism and Buddhism?Loss of “faith” in buddhismSimilarity between creation in Abrahamic religions and beginning of life in Earth mentioned Agganna Sutta?Are there studies about the difference between meditating in the morning versus in the evening?Can one follow Hinduism and Buddhism at the same time?Are there any prohibitions on participating in other religion's practices?Psychology of 'flow'

            Where else does the Shulchan Aruch quote an authority by name?Parashat Metzora+HagadolPesach/PassoverShulchan Aruch UTF-8Anonymous glosses in the Shulchan AruchWhy is the Shulchan Aruch definitive?Siman 32, Kitzur Shulchan Aruch: UntranslatedLitvaks/Yeshivish and Shulchan AruchBuying a Shulchan AruchEnglish version of SHULCHAN ARUCHIs there any place where Shulchan Aruch rules with the Rosh against the Rif and Rambam?Are there practices where Sepharadim do not hold by Shulchan Aruch?5th part of the shulchan aruch

            fallocate: fallocate failed: Text file busy in Ubuntu 17.04? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)defragmenting and increasing performance of old lubuntu system with swap partitionIssue with increasing the root partition from the swapthis /usr/bin/dpkg returned error || ubuntu-16.04, 64bitDefault 17.04 swap file locationHow to Resize Ubuntu 17.04 Zesty Swap file size?Ubuntu freezes from online formsMy Laptop is not starting after upgrade ubuntu 16.04 (Kernel 4.8.0-38 to 04.10.0-36)hcp: ERROR: FALLOCATE FAILED!Not sure my swap is being usedWine 3.0 asking for more virtual free swap