I want to use an SSH server to provide internet connectivity with sshuttle

I have a local network containing a machine named black running Ubuntu 16 server, and a raspberry pi. The pi has two network cards. One faces this local network, and the other connects to my ISP via a router. black has one interfaces which faces this network. The pi runs an ssh server configured out of the box.

I want to use sshuttle (or something else like it) to provide black with internet connectivity.

This is run before sshuttle is invoked:

username@black:~$ cat /etc/network/interfaces

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

auto enp2s0
iface enp2s0 inet static
    address 192.168.0.11
    netmask 255.255.255.0

username@black:~$ ip route

192.168.0.0/24 dev enp2s0  proto kernel  scope link  src 192.168.0.11 

username@black:~$ ping 8.8.8.8
connect: Network is unreachable

I then run sshuttle like so:

username@black:~$ sshuttle -r [email protected] 0.0.0.0/0
[email protected]'s password:
-c:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
client: Connected.

In a different terminal, I then run this:

username@black:~$ ip route

192.168.0.0/24 dev enp2s0  proto kernel  scope link  src 192.168.0.11 

username@black:~$ ping 8.8.8.8
connect: Network is unreachable

How can I make this work so that sending pings to ips outside of my local network works once connected with sshuttle? For various reasons, it has to be an ssh tunnel, but is there something other than sshuttle?


Solution 1:

From the sshuttle docs:

Any TCP session you initiate to one of the proxied IP addresses will be captured by sshuttle and sent over an ssh session to the remote copy of sshuttle, which will then regenerate the connection on that end, and funnel the data back and forth through ssh.

It looks like it essentially does the same thing as the native SOCKS5 server that ssh -D does except it does so transparently for the local machine so clients don't need to support using a proxy server.

However, I can't see that it support proxying UDP or ICMP.