I have a simple requirement to connect to a network device through a proxy/terminal server. When I connect using Putty I use:
username:ttyS1@terminalservername
where username is the user name the number after :ttyS is the port number to which we want to connect, and terminalservername is the name of the proxy server. I have tried the code I got from these two links Link1 and Link2
from netmiko import ConnectHandler
import time
from netmiko import redispatch
jumpserver = {'device_type': 'terminal_server','ip': 'x.x.x.x','username': 'name','password': 'pass','global_delay_factor':5}
net_connect = ConnectHandler(**jumpserver)
print net_connect.find_prompt()
net_connect.write_channel('command to access router')
time.sleep(1)
net_connect.read_channel()
redispatch(net_connect, device_type='arista_eos')
net_connect.send_command('show hostname')
However, in my case, when I run the script it is already on the terminal server and unable to connect further to the network device.
Can someone please suggest how to connect to a network device through a proxy/terminal server as PUTTY does and get the hostname of the device.
from Python - connect through Proxy Server using Password
0 komentar:
Posting Komentar