Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The connection was closed by the server: idle connection timeout expired (ProtocolError) #952

Closed
Shafqat-Ali opened this issue Apr 22, 2022 · 11 comments
Labels
Milestone

Comments

@Shafqat-Ali
Copy link

Shafqat-Ali commented Apr 22, 2022

Hi, @IgorMilavec @drieseng
I'm using ssh.net library for CISCO SG-350 switch configuration from C# web application and facing this error for only CISCO SG-350 model.
All the commands are working fine for CISCO SG-300 and HP switch but I'm unable to make connection only for CISCO SG-350 model.
If anyone facing and solved the same issue, please help me.

Error: The connection was closed by the server: idle connection timeout expired (ProtocolError).
StackTrace:
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.CreateAndConnectSession()
at Renci.SshNet.BaseClient.Connect()

@IgorMilavec
Copy link
Collaborator

At first glance it seems that SG-350 is not responding. Are you able to connect using telnet? Did you try to capture network traffic (you can use Wireshark) and see what is happening?

@Shafqat-Ali
Copy link
Author

Shafqat-Ali commented Apr 23, 2022

@IgorMilavec From same PC using Putty I can run all the commands, but from ssh.net library I'm getting this error "The connection was closed by the server: idle connection timeout expired (ProtocolError)."

@IgorMilavec
Copy link
Collaborator

Can you capture network traffic in both cases and check for differences?

@Shafqat-Ali
Copy link
Author

Can you capture network traffic in both cases and check for differences?

Sure, I'll capture network traffic and share results here.
Thank you for your prompt response.

@Shafqat-Ali
Copy link
Author

Shafqat-Ali commented Apr 25, 2022

Can you capture network traffic in both cases and check for differences?

NetworkTraffic.zip

I attached files of traffic monitoring with Wireshark. Please use this filter: "(ip.src == 10.1.7.26 && ip.dst == 172.17.21.254) || (ip.src == 172.17.21.254 && ip.dst == 10.1.7.26)"

Traffic monitored for Putty (file name): PuttySession.pcapng
Traffic monitored for C# application traffic (file name): ApplicationSession.pcapng

I'm not network expert to analyze the traffic. Please take a look into files. @IgorMilavec Please support.

@Shafqat-Ali
Copy link
Author

@IgorMilavec @darinkes @hifi @drieseng
Need your support for CISCO SG-350 switch connection using SSH.NET.
Please help me with this issue.

@KrisMie
Copy link

KrisMie commented May 23, 2022

@Shafqat-Ali @IgorMilavec @drieseng
Not an expert here but by comparing those two Wireshark captures with recommended filters, it looks like the problem is that for some reason SSH.NET doesn't initiate Key Exchange process with the server.

Then - as expected - sends [FIN, ACK] disconnection signal after 30s timeout due to inactivity.

Why would the SSH/Net not start the Key Exchange Init?

@Shafqat-Ali
Copy link
Author

@KrisMie Thank you for comparing Wireshark captured results and identification of issue.

@IgorMilavec @darinkes @hifi @drieseng Please support for above mentioned issue by @KrisMie.
I'm stuck at this point, Need support.

@geoffstewart
Copy link

geoffstewart commented Sep 13, 2022

I have created a PR to resolve a similar issue I encountered: #972

@WojciechNagorski
Copy link
Collaborator

It's done in #1274

@WojciechNagorski WojciechNagorski added this to the 2023.0.1 milestone Dec 21, 2023
@WojciechNagorski
Copy link
Collaborator

The 2023.0.1 version has been released to Nuget: https://www.nuget.org/packages/SSH.NET/2023.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants