Let’s say that you have a Cisco router that you use as console server to connect to your devices in the CCIE testing rack. If you want to allow other people to access your rack for training and don’t want to mess explaining how to connect to different device from the console router, then you need a menu for easy access.
We will define a menu on your console server. We’ll start by going to configure terminal mode and hit the command menu ?:
Console-Server(config)#menu ?
WORD Name of this menu |
Console-Server(config)#menu ?
WORD Name of this menu
Looks like we need to define a name for your menu, so I’ll name it “CS” menu and hit another ? mark:
Console-Server(config)#menu CS ?
clear-screen Use termcap database to clear screen
command Set menu command
default Item number to use for RETURN
line-mode require <enter> after typing selection
options Set per-item options
prompt Set prompt string
single-space single-space menu entries on display
status-line Display user status at top of screen
text Set text of menu line
title Set menu title |
Console-Server(config)#menu CS ?
clear-screen Use termcap database to clear screen
command Set menu command
default Item number to use for RETURN
line-mode require <enter> after typing selection
options Set per-item options
prompt Set prompt string
single-space single-space menu entries on display
status-line Display user status at top of screen
text Set text of menu line
title Set menu title
This command will output your options for the menu configuration. I will start by cleaning the screen after entering the menu CS:
Console-Server(config)#menu CS clear-screen |
Console-Server(config)#menu CS clear-screen
Next, I want to know where people are connecting and what’s the purpose of this console server, so I will add a title to my menu:
Console-Server(config)#menu CS title ^
Enter TEXT message. End with the character '^'.
Welcome to FirstDigest.com CCIE Rack
^ |
Console-Server(config)#menu CS title ^
Enter TEXT message. End with the character '^'.
Welcome to FirstDigest.com CCIE Rack
^
We have now a menu with a title, but let’s tell users how to use this menu:
Console-Server(config)#menu CS prompt ^
Enter TEXT message. End with the character '^'.
Choose and option and press Enter:
^ |
Console-Server(config)#menu CS prompt ^
Enter TEXT message. End with the character '^'.
Choose and option and press Enter:
^
To really need your user to press Enter, you need to specify this option in your menu:
Console-Server(config)#menu CS line-mode |
Console-Server(config)#menu CS line-mode
If you don’t add the above option, the picked options from menu it’s automatically run without waiting for the key Enter.
We have the menu defined and the necessary information in place. Let’s add some functionality to this menu.
First I want to give user the option to see the IP address where he’s connected:
Console-Server(config)#menu CS command 1 sh ip int brief | e una
Console-Server(config)#menu CS text 1 Check the Console Server IP Address
Console-Server(config)#menu CS option 1 pause |
Console-Server(config)#menu CS command 1 sh ip int brief | e una
Console-Server(config)#menu CS text 1 Check the Console Server IP Address
Console-Server(config)#menu CS option 1 pause
What I did above? Well, I added the necessary command to check the IP Address. This command can be modified to meet your requirements. For me this is enough since I have only one interface with IP address. This command is invisible to the connected user. I mean if you press the key 1 and then Enter, you get the output. Still, we don’t want our users to guess what they have to do, so we’ll add some text.
The visibile choice for your user is added with the “text” option and my phrase is “Check the Console Sever IP Address”. Of course this can be customized as you need.
Last option is the “pause” option. If you don’t add the “pause” then your user will see no output,as the command will be run in the background and will return to prompt.
You have to notice that the item 1 (in my case) is the parameter that bound together all options for this specific part of the menu. It will be display of course for key 1 on your keyboard.
Next, we’ll give the user the option to disconnect from the console server:
Console-Server(config)#menu CS command 2 exit
Console-Server(config)#menu CS text 2 Disconnect from Console Server |
Console-Server(config)#menu CS command 2 exit
Console-Server(config)#menu CS text 2 Disconnect from Console Server
Let’s add some connections to our Cisco devices in the rack. I will add only a couple of connection, as an example. You can extended and customize this commands as you want:
Console-Server(config)#menu CS command 3 telnet 10.1.1.1 2001
Console-Server(config)#menu CS text 3 Connect to R1
Console-Server(config)#menu CS command 4 telnet 10.1.1.1 2002
Console-Server(config)#menu CS text 4 Connect to R2
Console-Server(config)#menu CS command 5 telnet 10.1.1.1 2003
Console-Server(config)#menu CS text 5 Connect to R3
.
.
.
. |
Console-Server(config)#menu CS command 3 telnet 10.1.1.1 2001
Console-Server(config)#menu CS text 3 Connect to R1
Console-Server(config)#menu CS command 4 telnet 10.1.1.1 2002
Console-Server(config)#menu CS text 4 Connect to R2
Console-Server(config)#menu CS command 5 telnet 10.1.1.1 2003
Console-Server(config)#menu CS text 5 Connect to R3
.
.
.
.
We have the menu configured now. To check what we did configure, I usually do:
Console-Server#sh run | i menu |
Console-Server#sh run | i menu
The menu section is completed, but we need to add this menu to a user and force this user to use our menu. I will create a user which will run the menu CS as soon as he or she is connected to the console router. My user has a privilege 15 level. If you are concerned with security, you can set another privilege level, but be sure to configure that level to support the commands that you have in your menu. Also I will configure another user, for my usage, or in case that something goes wrong to be able to connect remotely and fix the issue. This “Admin” user will not run automatically the menu we just create.
Console-Server(config)#username Tester privilege 15 password tester2012
Console-Server(config)#username Tester autocommand menu CS
Console-Server(config)#username Admin password cisco2012
! I will enable also telnet to test from remote host
Console-Server(config)#line vty 0 4
Console-Server(config-line)#login local |
Console-Server(config)#username Tester privilege 15 password tester2012
Console-Server(config)#username Tester autocommand menu CS
Console-Server(config)#username Admin password cisco2012
! I will enable also telnet to test from remote host
Console-Server(config)#line vty 0 4
Console-Server(config-line)#login local
I will simulate a remote connection to check if everything is working fine:
R2#telnet 10.1.1.1
Trying 10.1.1.1 ... Open
User Access Verification
Username: Tester
Password:
Welcome to FirstDigest.com CCIE Rack
1 Check the Console Server IP Address
2 Disconnect from Console Server
3 Connect to R1
4 Connect to R2
5 Connect to R3
Choose and option and press Enter: |
R2#telnet 10.1.1.1
Trying 10.1.1.1 ... Open
User Access Verification
Username: Tester
Password:
Welcome to FirstDigest.com CCIE Rack
1 Check the Console Server IP Address
2 Disconnect from Console Server
3 Connect to R1
4 Connect to R2
5 Connect to R3
Choose and option and press Enter:
The menu is there. I will try some options to see if it’s working properly:
Choose and option and press Enter:
1
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 10.1.1.1 YES manual up up |
Choose and option and press Enter:
1
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 10.1.1.1 YES manual up up
Choose and option and press Enter:
2
[Connection to 10.1.1.1 closed by foreign host] |
Choose and option and press Enter:
2
[Connection to 10.1.1.1 closed by foreign host]
I recommend that you verify the menu functionality before you go “live”. You can check the menu directly on the Console Server:
I hope this short tutorial will help you. If you have questions or something is not clear from my explanation please use the comments and I will try to help you.