In OpenSSH, multiplexing can re-use an existing outgoing TCP connection for multiple concurrent SSH sessions to a remote SSH server, avoiding the overhead of creating a new TCP connection and reauthenticating each time. (https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing)
- sshuttle
- ssh
Multiplex by default (https://sshuttle.readthedocs.io/en/stable/how-it-works.html)
For example tunnel NS service:
/usr/bin/sshuttle --ns-hosts 192.168.0.1 -r [email protected] 254.254.254.254/32
~/.ssh/config or /etc/ssh/ssh_config example for all connections
Host *
# Multiplex
ControlMaster auto
ControlPath ~/.ssh/controlmasters/%C
ControlPersist 2h
NOTE: mkdir ~/.ssh/controlmasters/ or /root/.ssh/controlmasters before run the first connection
ssh -M -S /home/fred/.ssh/controlmasters/[email protected]:22 server.example.org
Then for subsquent Multiplex
ssh -S /home/fred/.ssh/controlmasters/[email protected]:22 server.example.org