python: gaierror [Error -2] Name or service not known sshTunnelForwarder

390 views Asked by At

Below code is giving the gaierror [Error -2] Name or service not known sshTunnelForwarder

self.server=sshtunnel.SSHTunnelForwarder(
                        ('abc.int.net', 22),
                        ssh_username="sshuser",
                        ssh_password="sshpassword",
                        remote_bind_address=('remote.address.host', 4040)
                        )

It works fine in windows

1

There are 1 answers

0
Pradeep Vairamani On

Try passing the local_bind_address parameter too. It is better to explicitly state which local port the remote port is being mapped to.

self.server=sshtunnel.SSHTunnelForwarder(
                    ('abc.int.net', 22),
                    ssh_username="sshuser",
                    ssh_password="sshpassword",
                    remote_bind_address=('remote.address.host', 4040),
                    local_bind_address=('127.0.0.1', 3331)
                    )