netmiko: Cisco 3560 SSH problem "paramiko.ssh_exception.SSHException: No existing session"
I have problem to connect to Cisco catalyst 3560 switch using Napalm:
>>> from netmiko import ConnectHandler
>>> from napalm import get_network_driver
>>> get_network_driver('ios')
<class 'napalm_ios.ios.IOSDriver'>
>>> driver = get_network_driver('ios')
>>> device = driver('<REMOVED>', '<REMOVED>', '<REMOVED>')
>>> device.open()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jaakkorau/ansible-env/lib/python2.7/site-packages/napalm_ios/ios.py", line 116, in open
**self.netmiko_optional_args)
File "/home/jaakkorau/ansible-env/lib/python2.7/site-packages/netmiko/ssh_dispatcher.py", line 105, in ConnectHandler
return ConnectionClass(*args, **kwargs)
File "/home/jaakkorau/ansible-env/lib/python2.7/site-packages/netmiko/base_connection.py", line 144, in __init__
self.establish_connection()
File "/home/jaakkorau/ansible-env/lib/python2.7/site-packages/netmiko/base_connection.py", line 468, in establish_connection
self.remote_conn_pre.connect(**ssh_connect_params)
File "/home/jaakkorau/ansible-env/lib/python2.7/site-packages/paramiko/client.py", line 341, in connect
server_key = t.get_remote_server_key()
File "/home/jaakkorau/ansible-env/lib/python2.7/site-packages/paramiko/transport.py", line 670, in get_remote_server_key
raise SSHException('No existing session')
paramiko.ssh_exception.SSHException: No existing session
Manual SSH enforced to version 2 works well. Output of show ip ssh is below:
SSH Enabled - version 2.0
Authentication methods:publickey,keyboard-interactive,password
Encryption Algorithms:aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc
MAC Algorithms:hmac-sha1,hmac-sha1-96
Authentication timeout: 120 secs; Authentication retries: 3
Minimum expected Diffie Hellman key size : 1024 bits
IOS Keys in SECSH format(ssh-rsa, base64 encoded):
ssh-rsa <KEY_REMOVED>
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 31 (14 by maintainers)
@ktbyers I was using paramiko straight not via netmiko but was looking for a solution to this problem NoExistingSession (same method get_remote_server_key) and the solution at the end was to increase the timeout when connecting. So I thought that maybe they could try with an extended timeout to see if that also solved their problem.