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.