Network engineers often find themselves in a scenario where the key needed to solve a problem is locked inside the box containing the solution. Scripting tools within Cisco’s IOS can help resolve these issues predictably with minimal interruption.
Recently, I had an issue with Cisco ISR routers that connect to carrier equipment. Our carrier hard codes ethernet ports to 100/full and will not support auto negotiation. When a Cisco router, configured by default to auto negotiate, connects to the carrier equipment the network port comes up half-duplex.
Users call. The network is slow. Utilization graphs do not indicate circuit saturation. It’s a lose-lose situation.
On several router models, including Cisco ISR 4000 series, the CLI interface makes this simple problem difficult to solve. You cannot configure the interface for full-duplex without removing the auto negotiate command. However, when you remove auto negotiate, the interface drops and will not reconnect. On a singly connected router, you lose access before you can complete the configuration change.
To work around this problem, use the integrated TCL shell to batch a set of CLI commands. As always, save your config and then issue the reload in command to reboot the router if you lose access. If required by your organization, coordinate a maintenance window. Even if the change works perfectly, you’ll bounce the port when you change the negotiation settings.
reload in 0:05 tclsh set fixinterface { ios_config "interface gi0/0/2" "no negot auto" "speed 100" "duplex full" } eval $fixinterface
If all goes well, after you run the script, the interface will drop and renegotiate at 100/full. Log back into your router, reload cancel, and save your config.
You can use these straight-forward commands to automate much more powerful configurations or to fix equally minor, but difficult to resolve, problems.
Anil says
I was facing the same issue and this solution is a life saver for me. Thank you so much. 🙂
Gary says
My OS requires the media-type to be set before the speed and duplex commands are even an option. Ci$co really made this much more difficult than it used to be…
set fixint {ios_config “int g0/0/0” “media rj45” “no nego auto” “speed 100” “duplex full”}
Patty says
I am dabbling within a similar but different framework. I need to log into a 5k, and then log into as many as 15 FEX, that may be running different version of ASIC’s and pull taildrop stats and present the results to a text file. I think I can make a solarwinds NCM job handle the presenting the results to the text file, but getting the FEX commands entered in order, is the issue. I have 50ish FEX to pull these stats from.
And to eventually get cute, to integrate this into, when the taildrops look like they are the result of oversubscription, to then get ServiceNow to produce a ticket to view nodes that may need links added, or have overly bursty servers attached.
I’m assuming I’ll end up in python, doing this, as the most efficient route.
Brent R says
Wow,
This was the EXACT issue I was having. Thanks for this. I just changed he interface portion of the script and it worked like a charm!