Telnet with new versions of IOS-XE #3718
Replies: 2 comments 2 replies
-
@mmackay21724 I would probably try to use device_type Note, you might neeed to use |
Beta Was this translation helpful? Give feedback.
-
Got another question, this works to a certain degree, but not behaving as I would expect, all the delays are trial and error. And this is UGLY :) I have the telnet login working (the logs look weird, timing issue i think) but I get logged in and I handle failure. Where I'm having an issue is the next step. If the device is already logged in then I will get either
and if not logged in then
Therefore I need to be able to make a decision: I thought I could take the output of the commands and use them for the above tests, but I don't seem to get anything, and thats probably a misunderstanding on my side. def connect_to_ts():
device = {
'device_type': 'generic_termserver_telnet',
'host': "10.17.252.53",
'port': "2046"
}
try:
# Establish the Telnet connection
net_connect = ConnectHandler(**device)
print(net_connect)
time.sleep(5)
send_user = net_connect.send_command_timing(os.getenv("SB_USER") )
print ( f'Send USER {send_user} ')
time.sleep(5)
send_pwd = net_connect.send_command_timing(os.getenv("SB_PWD"))
print (f"Sending Password {send_pwd} ")
time.sleep(5)
print("... logging into device")
time.sleep(3)
cmd_output = net_connect.send_command_timing("\n\r")
time.sleep(3)
print(f"cmd-output --> {cmd_output}")
return (True, net_connect) the output from the script:: $python3 factory_reset.py
First connection
<netmiko.terminal_server.terminal_server.TerminalServerTelnet object at 0x1039db0e0>
Send USER
You are logging into a Terminal Server.
This login prompt is authenticating your access using Sandbox Admin Credentials to the server.
After a successful login you'll be connected to your desired device.
Username:<username>
Sending Password
You are now connected to the console of your device. Press ENTER to interact.
... logging into device
cmd-output -->
User Access Verification Log File::
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
The latest versions of IOS console port login forces a real login v. just the older enable.
Probably because it's a cut and paste of code the device login looks a LOT like the telnet server login. (Username, Password)
In our env the login to terminal server is managed by our AD/TACACS. But the login to device is local, so different.
What I'm seeing is the the initial connection to the TS works fine using the user/password from the connector.
Then the device sends out Username. netmiko see's this, thinks the login did not work so resends the username/password for the terminal server, which gets rejected by the device... And eventually tries out and fails.
You can see this in the logs (some noise deleted for brevity)
Any suggestion would be greatly appreciated.
e.g. Connection flow
In my script if the terminal-server telnet login fails then it logs into the ts and clears the line, then tries telnet again..
In an ideal world netmiko would understand the new interaction or I could handle the second login manually.
LOGS::
Thanks
Mike
Beta Was this translation helpful? Give feedback.
All reactions