Is it possible to use a reverse ssh tunnel to force all network connection on the remote host through the local host.

Essentially:

local -> ssh -> remote remote web request -> ssh tunnel -> local -> internet

I want the remote to make connections through the locals VPN without having to authenticate on the remote as well

Hopefully this makes sense

  • solrize@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    1 month ago

    You can but it kind of sucks and you would only normally do it on a very temporary hacky basis. Otherwise use OpenVPN or Wireguard or whatever. If you want to do it with ssh, see the VPN instructions on the man page. But I mean it’s janky.

  • Slotos@feddit.nl
    link
    fedilink
    arrow-up
    4
    arrow-down
    1
    ·
    1 month ago
    • ssh to remote, forwarding some remote port to your local ssh port (-R)
    • ssh from remote through the exposed port, starting socks proxy in the process (-D)
    • use socks proxy explicitly or find some tool that can route the traffic into it

    Similar approach can be used to establish VPN tunnel with no encryption (ssh already provides that), routing everything but your ssh connection through it.

    • ssh to remote, reverse forwarding your VPN-over-tcp server’s listening port
    • establish vpn connection on remote, route everything but your ssh connection through the newly established interface

    It will be wasteful, but it will work.

  • Hazematman@lemmy.ca
    link
    fedilink
    arrow-up
    2
    ·
    1 month ago

    I’m not sure if you can do it without authenticating on the remote. Have you seen sshuttle? Maybe you can run that on the remote to connect to the local machine. If the issue is that the remote “can’t see” the local machine to ssh into it then you could try something like reverse tunnel the ssh port to the remote, and then use sshuttle to connect to the local port that is forwarding traffic.

  • BCsven@lemmy.ca
    link
    fedilink
    arrow-up
    2
    ·
    1 month ago

    Wireguard might be what you want. You connect to your remote machine ( assume it is at home). You can setup what traffic goes over wireguard (some or all). On your home machine you can run port forward command and masquerading command once connected on home machine so that you have full lan access too. It is described in the wireguard setup docs.

  • just_another_person@lemmy.world
    link
    fedilink
    arrow-up
    1
    arrow-down
    3
    ·
    1 month ago

    Wut. C’mon.

    If I’m reading this right, you just need to learn about routing. SSH has nothing to do with this. This is basic networking at best.