Linux command
sshuttle 命令
网络
需要网络或远程资源。
常用示例
Tunnel all traffic
sshuttle -r [user@host] 0/0
Tunnel specific network
sshuttle -r [user@host] [192.168.0.0/24]
Tunnel multiple networks
sshuttle -r [user@host] [10.0.0.0/8] [172.16.0.0/12]
Exclude addresses
sshuttle -r [user@host] 0/0 -x [192.168.1.0/24]
Tunnel with DNS
sshuttle --dns -r [user@host] 0/0
Auto-detect networks
sshuttle -r [user@host] --auto-nets
Verbose mode
sshuttle -v -r [user@host] [10.0.0.0/8]
说明
sshuttle creates a VPN-like tunnel over SSH. It transparently redirects traffic through a remote server without configuring VPN software. Unlike VPNs, sshuttle requires only SSH access. No server-side installation is needed beyond Python. It works where VPN ports are blocked. Subnet specifications determine what traffic is tunneled. 0/0 tunnels everything. Specific subnets route only matching traffic. DNS tunneling prevents leaks. Remote DNS resolution hides query patterns from local networks. The tool uses iptables/pf to redirect traffic. Root access is needed locally for routing setup. The remote needs only SSH access. Auto-nets reads the remote routing table to tunnel all its accessible networks.
参数
- -r _SERVER_
- Remote server (user@host).
- --dns
- Tunnel DNS queries.
- -x _SUBNET_
- Exclude subnet.
- -l _ADDR_
- Listen address.
- --auto-nets
- Auto-detect server networks.
- -H, --auto-hosts
- Scan for hostnames on the remote and add them to `/etc/hosts` for the duration of the tunnel.
- -N, --auto-nets
- Read the remote routing table and tunnel all networks the remote can reach (alias for the long option above).
- -e _CMD_, --ssh-cmd _CMD_
- SSH command line to use (default: `ssh`).
- -v
- Verbose.
- --daemon
- Run as daemon.
- --pidfile _FILE_
- PID file.
- --method _METHOD_
- NAT method (auto, nat, tproxy).
FAQ
What is the sshuttle command used for?
sshuttle creates a VPN-like tunnel over SSH. It transparently redirects traffic through a remote server without configuring VPN software. Unlike VPNs, sshuttle requires only SSH access. No server-side installation is needed beyond Python. It works where VPN ports are blocked. Subnet specifications determine what traffic is tunneled. 0/0 tunnels everything. Specific subnets route only matching traffic. DNS tunneling prevents leaks. Remote DNS resolution hides query patterns from local networks. The tool uses iptables/pf to redirect traffic. Root access is needed locally for routing setup. The remote needs only SSH access. Auto-nets reads the remote routing table to tunnel all its accessible networks.
How do I run a basic sshuttle example?
Run `sshuttle -r [user@host] 0/0` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r _SERVER_ do in sshuttle?
Remote server (user@host).