Telnet (cisco_ios_telnet) via SOCKS5 proxy timing out
See original GitHub issueTrying to Telnet to a Cisco switch via a SOCKS5 proxy, the connection always times out.
Code used to connect:
sock_proxy_telnet = socks.socksocket()
sock_proxy_telnet.set_proxy(
proxy_type=socks.SOCKS5,
addr="192.160.1.50",
port=1080
)
sock_proxy_telnet.connect(('192.168.140.10', 23))
net_connect = ConnectHandler(
host='192.168.140.10',
device_type="cisco_ios_telnet", # Use Telnet instead.
username='my_username',
password='my_password',
fast_cli=False,
sock=sock_proxy_telnet
)
show_version = net_connect.send_command('sh ver')
It sits on the ConnectHandler and times out, error:
[WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
I’ve confirmed that the socket is connecting via sock_proxy_telnet.recv(1000)
(shows the login banner).
The above code works fine if I use port 22 on the .connect and cisco_ios on the device type. I tried to debug it, but the global logging method doesn’t generate any logs.
I can use PuTTy to connect via the SOCKS5 proxy and Telnet, so I think this is specific to how Netmiko handles the socket and Telnet.
Any help would be greatly appreciated.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
Hi Kirk, It worked like a charm! Great stuff! Best regards and Happy New Year!
Krzysztof
Probably not going to fix this. So I am closing this issue.