ESHARP.NET

Technology and life with Eyvonne Sharp

  • LinkedIn
  • RSS
  • Twitter
  • Home
  • Technical Notes
  • Industry Musings
  • Career
  • Community
  • Reading List
  • Find Me Online

How to use TCL to script commands on Cisco ISR Routers

December 21, 2016 By Eyvonne 4 Comments

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.

Locked Box

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.

Filed Under: Technical Notes Tagged With: Cisco, ISR

Search

About Eyvonne

Picture of Eyvonne
Eyvonne Sharp leads an incredible team of cloud infrastructure customer engineers as the Head of North American Customer Engineering for Infrastructure Modernization at Google Cloud. In her spare time, she reads, writes, and enjoys time with her husband and 4 kiddos. She's an occasional flutist and wannabe philosopher.

What Others Are Reading

  • The Wonderful Life Problem (TWLP): Dealing with Disappointments in our Work Lives
    The Wonderful Life Problem (TWLP): Dealing with Disappointments in our Work Lives
  • The Second Act: Thriving as an Experienced Technologist
    The Second Act: Thriving as an Experienced Technologist
  • The work we want
    The work we want
  • Work and Values: Why it matters
    Work and Values: Why it matters
  • Change - Personal, Professional, Organizational
    Change - Personal, Professional, Organizational

On Twitter

  • Just now
  • See @SharpNetwork on Twitter

Copyright © 2025