Skip to content

Multi-tunnel SSH TUN manager with split-tunneling, autossh + systemd, and policy routing (Ubuntu 24.04 and 22.04 tested).

Notifications You must be signed in to change notification settings

MahdiGraph/SSH-Tunnel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SSH Tunnel Manager

SSH Tunnel Manager Demo

فارسی

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


Quick install

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

What this project does

  • Client mode

    • Creates an SSH TUN interface (default: tun100, tun101, ...)
    • Assigns subnet automatically (10.99.100.0/3010.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)
  • Server mode

    • Ensures SSHD supports tunneling (PermitTunnel yes)
    • Keeps server-side TUN interface configured
    • Enables NAT (MASQUERADE) for the tunnel subnet

Usage

Run:

sudo ./ssh_tunnel.sh

On first run, select Server or Client mode. After that, a menu is shown:

  • Create new tunnel
  • Manage tunnels (status, logs, edit split targets)
  • Exit

Donations

  • TRC20 (USDT/TRX/etc): TXqZ4x7N1c8FvRdsKZsBtPQpkeiiYd41Z7
  • BSC / BEP20 (USDT/BNB/etc): 0x36746a1E963716e1bc16d15edB3e8653d8d083DB
  • DOGE: DEp3a8fN8aDWqaFBKhh5hpzMtEux1EakDn

About

Multi-tunnel SSH TUN manager with split-tunneling, autossh + systemd, and policy routing (Ubuntu 24.04 and 22.04 tested).

Topics

Resources

Stars

Watchers

Forks

Languages