Skip to content

Commit ee26157

Browse files
committed
Add Windows documentation
Copied from https://coderwall.com/p/adfxgw/sshuttle-on-windows Closes #64
1 parent 0bdfb88 commit ee26157

File tree

6 files changed

+85
-43
lines changed

6 files changed

+85
-43
lines changed

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Contents:
1010
requirements
1111
installation
1212
usage
13+
platform
1314
Man Page <manpage>
1415
how-it-works
1516
support

docs/platform.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Platform Specific Notes
2+
=======================
3+
4+
Contents:
5+
6+
.. toctree::
7+
:maxdepth: 2
8+
9+
tproxy
10+
windows

docs/requirements.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Supports:
3737
Full UDP or DNS support with the TPROXY method requires the ``recvmsg()``
3838
syscall. This is not available in Python 2, however is in Python 3.5 and
3939
later. Under Python 2 you might find it sufficient installing PyXAPI_ to get
40-
the ``recvmsg()`` function.
40+
the ``recvmsg()`` function. See :doc:`tproxy` for more information.
4141

4242

4343
MacOS with PF method
@@ -51,6 +51,12 @@ Requires:
5151

5252
* You need to have the pfctl command.
5353

54+
Windows
55+
~~~~~~~
56+
57+
Not officially supported, however can be made to work with Vagrant. Requires
58+
cmd.exe with Administrator access. See :doc:`windows` for more information.
59+
5460

5561
Server side Requirements
5662
------------------------

docs/tproxy.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
TPROXY
2+
======
3+
TPROXY is the only method that has full support of IPv6 and UDP.
4+
5+
There are some things you need to consider for TPROXY to work:
6+
7+
- The following commands need to be run first as root. This only needs to be
8+
done once after booting up::
9+
10+
ip route add local default dev lo table 100
11+
ip rule add fwmark 1 lookup 100
12+
ip -6 route add local default dev lo table 100
13+
ip -6 rule add fwmark 1 lookup 100
14+
15+
- The ``--auto-nets`` feature does not detect IPv6 routes automatically. Add IPv6
16+
routes manually. e.g. by adding ``'::/0'`` to the end of the command line.
17+
18+
- The client needs to be run as root. e.g.::
19+
20+
sudo SSH_AUTH_SOCK="$SSH_AUTH_SOCK" $HOME/tree/sshuttle.tproxy/sshuttle --method=tproxy ...
21+
22+
- You may need to exclude the IP address of the server you are connecting to.
23+
Otherwise sshuttle may attempt to intercept the ssh packets, which will not
24+
work. Use the ``--exclude`` parameter for this.
25+
26+
- Similarly, UDP return packets (including DNS) could get intercepted and
27+
bounced back. This is the case if you have a broad subnet such as
28+
``0.0.0.0/0`` or ``::/0`` that includes the IP address of the client. Use the
29+
``--exclude`` parameter for this.
30+
31+
- You need the ``--method=tproxy`` parameter, as above.
32+
33+
- The routes for the outgoing packets must already exist. For example, if your
34+
connection does not have IPv6 support, no IPv6 routes will exist, IPv6
35+
packets will not be generated and sshuttle cannot intercept them::
36+
37+
telnet -6 www.google.com 80
38+
Trying 2404:6800:4001:805::1010...
39+
telnet: Unable to connect to remote host: Network is unreachable
40+
41+
Add some dummy routes to external interfaces. Make sure they get removed
42+
however after sshuttle exits.

docs/usage.rst

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Usage
22
=====
3+
4+
.. note::
5+
6+
For information on usage with Windows, see the :doc:`windows` section.
7+
For information on using the TProxy method, see the :doc:`tproxy` section.
8+
39
- Forward all traffic::
410

511
sshuttle -r username@sshserver 0.0.0.0/0
@@ -51,45 +57,3 @@ the data back and forth through ssh.
5157
Fun, right? A poor man's instant VPN, and you don't even have to have
5258
admin access on the server.
5359

54-
Additional information for TPROXY
55-
---------------------------------
56-
TPROXY is the only method that supports full support of IPv6 and UDP.
57-
58-
There are some things you need to consider for TPROXY to work:
59-
60-
- The following commands need to be run first as root. This only needs to be
61-
done once after booting up::
62-
63-
ip route add local default dev lo table 100
64-
ip rule add fwmark 1 lookup 100
65-
ip -6 route add local default dev lo table 100
66-
ip -6 rule add fwmark 1 lookup 100
67-
68-
- The ``--auto-nets`` feature does not detect IPv6 routes automatically. Add IPv6
69-
routes manually. e.g. by adding ``'::/0'`` to the end of the command line.
70-
71-
- The client needs to be run as root. e.g.::
72-
73-
sudo SSH_AUTH_SOCK="$SSH_AUTH_SOCK" $HOME/tree/sshuttle.tproxy/sshuttle --method=tproxy ...
74-
75-
- You may need to exclude the IP address of the server you are connecting to.
76-
Otherwise sshuttle may attempt to intercept the ssh packets, which will not
77-
work. Use the ``--exclude`` parameter for this.
78-
79-
- Similarly, UDP return packets (including DNS) could get intercepted and
80-
bounced back. This is the case if you have a broad subnet such as
81-
``0.0.0.0/0`` or ``::/0`` that includes the IP address of the client. Use the
82-
``--exclude`` parameter for this.
83-
84-
- You need the ``--method=tproxy`` parameter, as above.
85-
86-
- The routes for the outgoing packets must already exist. For example, if your
87-
connection does not have IPv6 support, no IPv6 routes will exist, IPv6
88-
packets will not be generated and sshuttle cannot intercept them::
89-
90-
telnet -6 www.google.com 80
91-
Trying 2404:6800:4001:805::1010...
92-
telnet: Unable to connect to remote host: Network is unreachable
93-
94-
Add some dummy routes to external interfaces. Make sure they get removed
95-
however after sshuttle exits.

docs/windows.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Microsoft Windows
2+
=================
3+
Currently there is no built in support for running sshuttle directly on
4+
Microsoft Windows.
5+
6+
What we can really do is to create a Linux VM with Vagrant (or simply
7+
Virtualbox if you like). In the Vagrant settings, remember to turn on bridged
8+
NIC. Then, run sshuttle inside the VM like below::
9+
10+
sshuttle -l 0.0.0.0 -x 10.0.0.0/8 -x 192.168.0.0/16 0/0
11+
12+
10.0.0.0/8 excludes NAT traffics of Vagrant and 192.168.0.0/16 excludes
13+
traffics to my router.
14+
15+
Assuming the VM has the IP 192.168.1.200 obtained on the bridge NIC (we can
16+
configure that in Vagrant), we can then ask windows to route all its traffic
17+
via the VM by running the following in cmd.exe with admin right::
18+
19+
route add 0.0.0.0 mask 0.0.0.0 192.168.1.200

0 commit comments

Comments
 (0)