Unable to connect to Cisco IOS-XR
See original GitHub issueHi Ron,
Greetings.
I am working with multiple vendor networking devices to execute commands. With the below asyncssh code, I verified connecting to Nokia, Huawei and a few models of Cisco. For some reason, I am unable to connect to Cisco ASR9K which is a IOS-XR device. It returns asyncssh.misc.ConnectionLost: Connection lost
error every time.
async with asyncssh.connect(host, username=user, password=pwd, port=22,
known_hosts=None, kex_algs=k_algs, encryption_algs=e_algs, mac_algs=m_algs,
compression_algs=None, login_timeout=60, ) as conn:
async with conn.create_process() as process:
print('after conn')
print("**************************%s******************************" % disable_paging_cmd)
process.stdin.write(f'{disable_paging_cmd}\r\n')
print("**************************%s******************************" % cmd)
process.stdin.write(f'{cmd}\r\n')
print("**************************%s******************************" % exit_command)
process.stdin.write(f'{exit_command}\r\n')
line = await process.stdout.read()
print(str(line))
Any special cases to be handled for IOS-XR?
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Solved: IOS XR failed to boot - Cisco Community
- Connect to RP console. - Enter rommon by hitting Ctrl+c until you get the rommon prompt. - Enter these commands to disable...
Read more >Solved: Login Problem at IOS-XR(ASR9010) - Cisco Community
Solved: The IOS device has a command of login block-for 60 ... i want do it in the IOS-XR device i can't find...
Read more >Solved: Unable to connect to IOS-XR 6.5.2 with Paramiko.
Hi! After upgrade to IOS-XR 6.5.2 none of my automations are able to connect to to the router. Both my ncclient and Netmiko...
Read more >Can't connect (ssh) to devbox / IOS XRV 9000
Can anyone help me on this since its blocking me since yesterday ? I'm running into same issue even after spinning up a...
Read more >SSH fail access on IOS XR, ASR9000 - Cisco Community
Hi actually we have a trouble with the operation with SSH an access to ASR9000, we installed and actived the PX.PIE packet for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry - the ValueError was my mistake. It should have been
'+ssh-dss'
, rather than'+ssh_dss'
, but it looks like you figured that out.Regarding the output hang, see if sending only ‘\r’ as the line ending works rather than ‘\r\n’. If you set a terminal type, the remote system would be expecting your terminal to only send carriage return when you hit “enter” after typing a command. Also, is the “quit” command you are sending normally enough to trigger the server to do a connection close? If not, that could explain the hang. I’m not seeing any sign of it trying to close the connection in your debug output.
Hi Ron, thanks for your timely responses. After setting the host_key_algs, I had to set the term_type too. I am able to connect to IOS-XR (ASR9K) box with asyncssh now. Pasting below the options I added for someone’s reference
server_host_key_algs=['ssh-dss'], term_type='xterm-color', term_size=(80, 24)
However the issue with NCS540 (another IOS-XR) device still exists. I have the term_type set as you suggested. The
Session request failed
error is gone. But after opening the session, the commands are executed and the session hangs without reading any output indefinitely.Debug logs -
I tried changing the term_type to vt100 after checking some config docs of NCS540. But that doesn’t work either