question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cisco SG300 series breaking on SSH connection

See original GitHub issue

Hello @ktbyers

Thanks for the amazing open source project that NetMiko is. 👍

I would like to get some help on the following issue:

I have a very simple script trying to copy the config of a Cisco SG300 device. My code (I have verbose enabled on Netmiko):

if Device_Model_List[i] == "Cisco":

            #create profile for Juniper for NetMiko
            provision_router_object = {
            'device_type': 'cisco_ios',
            'ip': Public_IP_List[i],
            'username': User_List[i], 
            'password': Password_List[i],
            'port': SSH_Port_List[i],
            'global_delay_factor': 1,
            'verbose': true,
            }

            print(provision_router_object)
            provision_router = ConnectHandler(**provision_router_object)    
            output = provision_router.send_command("show running-config")
            file_name = Name_List[i] + '-' + str(date)
            path = "/Users/sam/Documents/Backup_Router/" + Customer_List[i] + "/" + Customer_Site[i] + "/"
            print(path)
            os.makedirs(os.path.dirname(path), exist_ok=True)

            with open(os.path.join(path,file_name),"w") as file_:
                file_.write(output)   

And here’s the verbose + error I am getting:

SSH connection established to 184.68.129.6:2210
Interactive SSH session established

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/paramiko/channel.py", line 613, in recv
    out = self.in_buffer.read(nbytes, self.timeout)
  File "/usr/local/lib/python3.5/site-packages/paramiko/buffered_pipe.py", line 160, in read
    raise PipeTimeout()
paramiko.buffered_pipe.PipeTimeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/netmiko/base_connection.py", line 387, in read_until_pattern
    output += self.remote_conn.recv(MAX_BUFFER).decode('utf-8', 'ignore')
  File "/usr/local/lib/python3.5/site-packages/paramiko/channel.py", line 615, in recv
    raise socket.timeout()
socket.timeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sam/Documents/git/OPS/ops/python/router_backup/Backup_Test.py", line 56, in <module>
    provision_router = ConnectHandler(**provision_router_object)  
  File "/usr/local/lib/python3.5/site-packages/netmiko/ssh_dispatcher.py", line 84, in ConnectHandler
    return ConnectionClass(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/netmiko/base_connection.py", line 69, in __init__
    self.session_preparation()
  File "/usr/local/lib/python3.5/site-packages/netmiko/base_connection.py", line 83, in session_preparation
    self.disable_paging()
  File "/usr/local/lib/python3.5/site-packages/netmiko/base_connection.py", line 212, in disable_paging
    output = self.read_until_prompt()
  File "/usr/local/lib/python3.5/site-packages/netmiko/base_connection.py", line 374, in read_until_prompt
    return self.read_until_pattern()
  File "/usr/local/lib/python3.5/site-packages/netmiko/base_connection.py", line 393, in read_until_pattern
    raise NetMikoTimeoutException("Timed-out reading channel, data not available.")
netmiko.ssh_exception.NetMikoTimeoutException: Timed-out reading channel, data not available.

I’m running the latest version of Netmiko and Paramiko. It is working perfect with Juniper devices.

UPDATE: I have tried my script using a truly Cisco IOS device line and it works with no problem. So I believe the issue is the compatibility with the Cisco SG line. I have also tried to make Paramiko works with this Cisco SG device but it hangs on the connection and never times out. Hope this info will help.

Would you have any idea on whaw to try next?

Thank you so much.

Sam.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ktbyerscommented, Aug 26, 2016
1reaction
ktbyerscommented, Aug 12, 2016

Will try to get to this in dev_1_0 release (i.e. add support for SG300)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: SG300 ssh strange error: "A client is already connected"
Hi,. I've got a few SG300-52 switches running software version 1.3.0.62 which I configured for ssh management access with public key authentication via:....
Read more >
SSH CLI issues on SG350X - Cisco Community
I have SG350X switches and I'm experiencing pretty slow ssh connectivity when using it for management - console port with 9600b is probably ......
Read more >
Cant connect to my Cisco SG300-10 switch via SSH Putty
Ive connected a different cisco switch in this same way (ethernet port to laptop) but putty just says 'Connection refused'. Any help would...
Read more >
Problems acccessing SG300-28P via management interface
I have a new SG300-28P, and have had occasional issues with being unable to connect to it via anything other than the serial...
Read more >
Cisco Small Business 300 Series Managed Switch ...
Cisco Small Business 300 Series Managed Switch Administration Guide. 7. Contents. Protection Methods. 342. SSH Server Authentication. 344. SSH Client ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found