A lightweight CLI tool to create and manage multiple SSH TUN (tun100+) tunnels with split-tunneling on Linux.
It generates per-tunnel configs under /etc/sshtunnel/, creates systemd units, and keeps routes/rules applied reliably.
✅ Tested on Ubuntu 24.04, 22.04
curl -fsSL https://raw.githubusercontent.com/MahdiGraph/SSH-Tunnel/refs/heads/main/ssh_tunnel.sh -o ssh_tunnel.sh \
&& chmod +x ssh_tunnel.sh \
&& sudo ./ssh_tunnel.sh-
Client mode
- Creates an SSH TUN interface (default:
tun100,tun101, ...) - Assigns subnet automatically (
10.99.100.0/30…10.99.255.0/30) - Applies split-tunnel policy routing (ip rule + separate routing table per tunnel)
- Uses autossh + systemd for auto-reconnect
- Ensures no tunnel conflicts (unique interface, subnet, routing table, and autossh monitor port)
- Creates an SSH TUN interface (default:
-
Server mode
- Ensures SSHD supports tunneling (
PermitTunnel yes) - Keeps server-side TUN interface configured
- Enables NAT (MASQUERADE) for the tunnel subnet
- Ensures SSHD supports tunneling (
Run:
sudo ./ssh_tunnel.shOn first run, select Server or Client mode. After that, a menu is shown:
- Create new tunnel
- Manage tunnels (status, logs, edit split targets)
- Exit
- TRC20 (USDT/TRX/etc):
TXqZ4x7N1c8FvRdsKZsBtPQpkeiiYd41Z7 - BSC / BEP20 (USDT/BNB/etc):
0x36746a1E963716e1bc16d15edB3e8653d8d083DB - DOGE:
DEp3a8fN8aDWqaFBKhh5hpzMtEux1EakDn
