proxy_port = 22
proxy_client = SSHClient()
proxy_client.load_host_keys('~/.ssh/known_hosts/')
proxy_client.connect(proxy_hostname, port=proxy_port, username=
    proxy_username, key_filename='/path/to/your/private/key/')
transport = proxy_client.get_transport()
dest_addr = '0.0.0.0', 8000
local_addr = '127.0.0.1', 1234
channel = transport.open_channel('direct-tcpip', dest_addr, local_addr)
remote_client = SSHClient()
remote_client.load_host_keys(hosts_file)
remote_client.connect('localhost', port=1234, username='remote_username',
    sock=channel)
remote_client.exec_command('pwd')
Paramiko: переадресация портов вокруг NAT-маршрутизатора