Create a new file in ~/.ssh called config and insert the following:
Host *
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p
Reuse an existing SSH connection when you connect to the same host multiple times. Be sure to chmod 600 the config file.
Update: This is also nice to add (not supported on all versions of ssh client), ControlPersist 4h
also make sure to use -o ControlMaster=no when ssh tunneling. multiple tunnels won’t work over a shared socket