安装sshuttle

说明

支持TCP、UDP,不支持ICMP

安装

1
2
export {http,https,ftp}_proxy="http://127.0.0.1:1081"
yum install python3 python3-devel gcc

主机环境安装

1
pip3 install sshuttle

虚拟环境安装

1
2
3
4
5
pip3 install virtualenv
virtualenv -p python3 /tmp/sshuttle
source /tmp/sshuttle/bin/activate
python -V && pip -V
pip install sshuttle

配置

代理TCP

1
sshuttle -r [email protected]:60022 0.0.0.0/0 -x 192.168.128.0/24 -v

代理TCP和DNS

1
sshuttle -r [email protected]:60022 0.0.0.0/0 -x 192.168.128.0/24 --dns -v

代理TCP和UDP

1
2
3
4
5
6
sshuttle -r [email protected]:60022 0.0.0.0/0 -x 192.168.128.0/24 --method tproxy -v
# 添加路由
ip route add local default dev lo table 100
ip rule add fwmark 1 lookup 100
ip -6 route add local default dev lo table 100
ip -6 rule add fwmark 1 lookup 100

常用配置

1
2
3
4
5
6
7
8
9
10
11
12
sshuttle -r [email protected]:60022 0.0.0.0/0 \
-x 0.0.0.0/8 \
-x 10.0.0.0/8 \
-x 100.64.0.0/10 \
-x 127.0.0.0/8 \
-x 169.254.0.0/16 \
-x 172.16.0.0/12 \
-x 192.168.0.0/16 \
-x 198.18.0.0/15 \
-x 224.0.0.0/4 \
-x 240.0.0.0/4 \
-v