I came across an interesting idea, what if you could color code your devices in command line? So such as if you were operating routers at a core level you could color code the CLI to the color red, and the branch routers green and etc. I wasn’t sure if this would possible but doing some searching through the internet I found a guy Ivan Pepelnjak who wrote how to do this a couple years ago and wrote a couple books as well, check out his blog/website at http://www.ipspace.net there is tons of helpful information along with his original guide here.
Being able to color the text output when connecting to a device, and having each different color have a different meaning to it makes it easier to understand which devices are part of the critical network. So now core devices can have a red text to them , branch devices can have a green color and redundant devices blue etc. This makes it easier to know what you are connecting to and anybody else that is authorized to do so. To make this process happen there has to be escape sequences somewhere in the router to change the color of the text. There is not a command on the router itself to change the color the text, so how would you change the color? What Ivan pointed out was the MOTD banner (Message-of-the-day) therefore when you connect to the device either with console, telnet, or SSH the color of the text will change to the color you specified right when you log into the device.
To change the color of the CLI text output in a router go into global configuration mode and type banner motd and then your delimiting character. (For this example I used “*”)
Router#config t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#banner motd *
The next step is to press CTRL+V, release then the ESC key. This is the escape sequence and looks like this in CLI ^[ . The next setup is to add another left bracket [ then the number 3 followed by the number that represents the color:
So if I wanted to change the color to a green color the output would look something like this:
Although we are close we need to add the letters “1m” which is an ASCI code sequence, after the number and then the text of banner. So the output would look something like this below:
^[[32;1mThis is a test only, don't panic!*
That’s it! You can test this by logging off the router and your text output should be the color you specified in the login banner and the same color below the login banner.
I am still a trying to figure out a way to change the color of just the banner only and not the device text, but I’m a novice with the escape sequences and control codes. Feel free to post below with ideas. I have tested this with a Cisco IOS router but not a switch, I would take a guess in saying it is the same commands to change the color. Like always I hope this information is helpful and if you have an idea that deals with either ICND1 or ICND2 comment below, also feel free to ask questions.
- The Codes of ICMP (ciscoskills.net)
- CLI Editor Features (therouters.wordpress.com)
- How do you recover the password for a cisco 2501 router (wiki.answers.com)
- Changing A Router’s Configuration (arthurmehamat.wordpress.com)