<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Netmiko SSH jump box server in Network Devices</title>
    <link>https://community.cisco.com/t5/network-devices/netmiko-ssh-jump-box-server/m-p/3698897#M263</link>
    <description>&lt;P&gt;I’m trying to implement a Python script to collect to some outputs from Switches and routers. My problem is that I need to go through a proxy server. The flow is like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personal Mac ----1-----&amp;gt; jumpbox ----2----&amp;gt;&amp;nbsp;Nexus SW&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 1:&lt;BR /&gt;- Authentication via SSH Key and password&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 2:&lt;/P&gt;
&lt;P&gt;- Authentication via username/password&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’m using SSH File config, as below. Using this SSH File, I can connect to the jumphost so I don’t think the issue is on the first step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;host VPS&lt;BR /&gt;&amp;nbsp; IdentityFile&amp;nbsp;&amp;lt;keyfile&amp;gt;&lt;BR /&gt;&amp;nbsp; user &amp;lt;username&amp;gt;&lt;BR /&gt;&amp;nbsp; hostname &amp;lt;IP&amp;gt;&lt;BR /&gt;&amp;nbsp; port 22&lt;BR /&gt;&lt;BR /&gt;host * !VPS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Use the SSH proxy for all endpoints&lt;BR /&gt;&amp;nbsp; ProxyCommand ssh VPS nc %h %p&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I try to connect to a switch using the script below, I’m getting the error below it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;PYTHON SCRIPT&amp;gt;&lt;/P&gt;
&lt;P&gt;from netmiko import ConnectHandler&lt;BR /&gt;from getpass import getpass&lt;BR /&gt;import logging&lt;BR /&gt;&lt;BR /&gt;logging.basicConfig(filename='test.log', level=logging.DEBUG)&lt;BR /&gt;logger = logging.getLogger("my_log")&lt;BR /&gt;logger.debug('This message should go to the log file')&lt;BR /&gt;&lt;BR /&gt;device = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'device_type': 'cisco_ios',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'host': 'HOST',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'username': '&amp;lt;device username&amp;gt;',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'password': '#######,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'ssh_config_file': 'ssh_config.txt',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'global_delay_factor': 4&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;net_connect = ConnectHandler(**device)&lt;BR /&gt;output = net_connect.send_command("show users")&lt;BR /&gt;print(output)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/usr/local/bin/python2.7 "/Users/zammes/PycharmProjects/Network Automation/proxy_test.py"&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "/Users/zammes/PycharmProjects/Network Automation/proxy_test.py", line 19, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; net_connect = ConnectHandler(**device)&lt;BR /&gt;&amp;nbsp; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/netmiko/ssh_dispatcher.py", line 190, in ConnectHandler&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ConnectionClass(*args, **kwargs)&lt;BR /&gt;&amp;nbsp; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/netmiko/base_connection.py", line 245, in __init__&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.establish_connection()&lt;BR /&gt;&amp;nbsp; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/netmiko/base_connection.py", line 738, in establish_connection&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.remote_conn_pre.connect(**ssh_connect_params)&lt;BR /&gt;&amp;nbsp; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/paramiko/client.py", line 392, in connect&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.start_client(timeout=timeout)&lt;BR /&gt;&amp;nbsp; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/paramiko/transport.py", line 545, in start_client&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;BR /&gt;paramiko.ssh_exception.SSHException: Error reading SSH protocol banner&lt;BR /&gt;&lt;BR /&gt;Process finished with exit code 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there someone that could help me with it?&lt;/P&gt;</description>
    <pubDate>Fri, 31 Aug 2018 18:27:01 GMT</pubDate>
    <dc:creator>tiagosil</dc:creator>
    <dc:date>2018-08-31T18:27:01Z</dc:date>
    <item>
      <title>Netmiko SSH jump box server</title>
      <link>https://community.cisco.com/t5/network-devices/netmiko-ssh-jump-box-server/m-p/3698897#M263</link>
      <description>&lt;P&gt;I’m trying to implement a Python script to collect to some outputs from Switches and routers. My problem is that I need to go through a proxy server. The flow is like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personal Mac ----1-----&amp;gt; jumpbox ----2----&amp;gt;&amp;nbsp;Nexus SW&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 1:&lt;BR /&gt;- Authentication via SSH Key and password&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 2:&lt;/P&gt;
&lt;P&gt;- Authentication via username/password&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’m using SSH File config, as below. Using this SSH File, I can connect to the jumphost so I don’t think the issue is on the first step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;host VPS&lt;BR /&gt;&amp;nbsp; IdentityFile&amp;nbsp;&amp;lt;keyfile&amp;gt;&lt;BR /&gt;&amp;nbsp; user &amp;lt;username&amp;gt;&lt;BR /&gt;&amp;nbsp; hostname &amp;lt;IP&amp;gt;&lt;BR /&gt;&amp;nbsp; port 22&lt;BR /&gt;&lt;BR /&gt;host * !VPS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Use the SSH proxy for all endpoints&lt;BR /&gt;&amp;nbsp; ProxyCommand ssh VPS nc %h %p&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I try to connect to a switch using the script below, I’m getting the error below it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;PYTHON SCRIPT&amp;gt;&lt;/P&gt;
&lt;P&gt;from netmiko import ConnectHandler&lt;BR /&gt;from getpass import getpass&lt;BR /&gt;import logging&lt;BR /&gt;&lt;BR /&gt;logging.basicConfig(filename='test.log', level=logging.DEBUG)&lt;BR /&gt;logger = logging.getLogger("my_log")&lt;BR /&gt;logger.debug('This message should go to the log file')&lt;BR /&gt;&lt;BR /&gt;device = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'device_type': 'cisco_ios',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'host': 'HOST',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'username': '&amp;lt;device username&amp;gt;',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'password': '#######,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'ssh_config_file': 'ssh_config.txt',&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'global_delay_factor': 4&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;net_connect = ConnectHandler(**device)&lt;BR /&gt;output = net_connect.send_command("show users")&lt;BR /&gt;print(output)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/usr/local/bin/python2.7 "/Users/zammes/PycharmProjects/Network Automation/proxy_test.py"&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "/Users/zammes/PycharmProjects/Network Automation/proxy_test.py", line 19, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; net_connect = ConnectHandler(**device)&lt;BR /&gt;&amp;nbsp; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/netmiko/ssh_dispatcher.py", line 190, in ConnectHandler&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ConnectionClass(*args, **kwargs)&lt;BR /&gt;&amp;nbsp; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/netmiko/base_connection.py", line 245, in __init__&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.establish_connection()&lt;BR /&gt;&amp;nbsp; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/netmiko/base_connection.py", line 738, in establish_connection&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.remote_conn_pre.connect(**ssh_connect_params)&lt;BR /&gt;&amp;nbsp; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/paramiko/client.py", line 392, in connect&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.start_client(timeout=timeout)&lt;BR /&gt;&amp;nbsp; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/paramiko/transport.py", line 545, in start_client&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;BR /&gt;paramiko.ssh_exception.SSHException: Error reading SSH protocol banner&lt;BR /&gt;&lt;BR /&gt;Process finished with exit code 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there someone that could help me with it?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 18:27:01 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-devices/netmiko-ssh-jump-box-server/m-p/3698897#M263</guid>
      <dc:creator>tiagosil</dc:creator>
      <dc:date>2018-08-31T18:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Netmiko SSH jump box server</title>
      <link>https://community.cisco.com/t5/network-devices/netmiko-ssh-jump-box-server/m-p/3922221#M264</link>
      <description>&lt;P&gt;It's a bit of an old post but I randomly popped into it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1). Can you ssh into this 'HOST' from the same machine? Is the DNS resolving properly? If not, just use IP address as this error indicates that you simply cant get there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2). Why are you using 2.7? It's 2019 (well you posted it in 2018) get onto 3.x &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3). There is a special method to get onto terminal server using netmiko&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 04:55:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-devices/netmiko-ssh-jump-box-server/m-p/3922221#M264</guid>
      <dc:creator>inkubus</dc:creator>
      <dc:date>2019-09-11T04:55:08Z</dc:date>
    </item>
  </channel>
</rss>

