Using Aliases in Cisco Routers

Cisco has long, frequently used commands like our favorites "show ip interface brief", "show ip route" and the annoying "do show" commands while in the global configuration mode. If you want the easy way, the good news is there is an easy way. Using aliases will save you some keystrokes. Here's the way to configure aliases. We will create aliases for the commands above and also be able to use the "show" command on the global configuration mode. "show ip interface brief" will be assigned with the alias "sib", "show ip route" will be "sir" and "do show" will be "show".


Router(config)#alias exec sib show ip interface brief
Router(config)#alias exec sir show ip route
Router(config)#alias configure show do show


Let's test if the alias commands really work.


Router#sib
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down

Router#sir
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#show ip int brief
Interface IP-Address OK? Method Status Protocol

FastEthernet0/0 unassigned YES unset administratively down down

Well it did! Lets check what we will see in IOS help.


Router#s?
*s=show *sib="show ip interface brief" *sir="show ip route" sdlc
send set setup show
slip snasw squeeze ssh
start-chat systat

Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#s?
*show="do show" sap-priority-list scheduler scripting
secure security service sgbp
signaling-class sip-ua sna snasw
snmp snmp-server source-bridge srcp
standby state-machine stun su-mac
su-tag subscriber subscriber-policy subscription

Now we see the aliases we made and they have the preceeding asterisk before them. *s=show is the default alias in the router. Cool! Try other aliases in different modes, make your own aliases and just be creative!


Comments

1 Response to "Using Aliases in Cisco Routers"

Anonymous said... November 16, 2009 at 6:30 AM

Hi !

Very interresting, but I tried to do a funnier 'alias in alias' stuff, and it did'nt work.

SIR = show ip route
Try SIR vrf 111_prod for example : ok done
Now let's make an alias for "vrf 111_prod" for example, why not alias exec prd vrf 111_prod.

Let's try show ip route prd => KO, he won't take the alias "prd" as an alias, but as a hostname.

There is no "alias show xxx" command, so how simplify the usage of VRF ?

Ideas ?

Post a Comment

Certifications

Certifications

The Dreamer

A fun loving person who enjoys learning new things. Currently working as a Network Engineer supporting the global network of a Fortune 500 company. This blog serves as my notes for the labs I created for my CCIE journey. I can guarantee there are errors in my posts. If you spot them, please let me know.

Join my Facebook Page I WANT TO BE A CCIE

Donate to the Cause

My aim is to create materials for free and possibly a free lab. If you wish to help out, please send any amount. Thanks.

Join my Bandwagon

Blogs that I Read