Where to find info about this on the Cisco Website:
www.cisco.com -> Support -> IOS and NX-OS Software -> Cisco IOS -> 12.4 Family -> 12.4T -> Configuration Guides -> Configuration Fundamentals Configuration GuidePart 4: Managing Connections, Menus, and System Banners has what we want (by the way if you decide to go to the Network Management Configuration Guide - there is a different framework called Embedded Menu Manager which relies on XML based configs and is not what you want at all)
Task:
When user NetDiag (password NetDiag) logs into the router immediately provide them a diagnostics menu to be able to quickly ping and traceroute other routers.
This task is actually two parts - the menu and the setting the account for the user to automatically start the menu.
Subtask 1 - the Menu:
Multiple Menus can exist and call other menus, so they each need a name to identify them, in this example I'm just going to use "diag". Defining a menu title is required - just like setting a banner, as it is a free-form string, you need to select a character that lets the router know that this is the end of input (we're using the ^ character here)
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#menu diag title ^
Enter TEXT message. End with the character '^'
####################
# Diagnostics Menu #
####################^
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#menu diag title ^
Enter TEXT message. End with the character '^'
####################
# Diagnostics Menu #
####################^
After the menu, we'll show the list of options and the descriptions of each option
R1(config)#menu diag text 1 Ping R2
R1(config)#menu diag text 2 Ping R3
R1(config)#menu diag text 3 Traceroute R2
R1(config)#menu diag text 4 Traceroute R3
R1(config)#menu diag text x Exit
Now we enter the actual commands we want to execute for each option
R1(config)#menu diag command 1 ping 200.0.0.2 repeat 2 source loopback0
R1(config)#menu diag command 2 ping 200.0.0.3 repeat 2 source loopback0
R1(config)#menu diag command 3 trace 200.0.0.2 source loopback0
R1(config)#menu diag command 4 trace 200.0.0.3 source loopback0
R1(config)#menu diag command x menu-exit
If you like, you can also specify the message prompt when requesting a menu selection
R1(config)#menu diag prompt $
Enter TEXT message. End with the character '$'
What is thy wish Master? $
Optionally, we can pause the display after each command before presenting the menu again - this would only be worth using if we cleared the screen before displaying the menu
R1(config)#menu diag clear-screen
R1(config)#menu diag option 1 pause
R1(config)#menu diag option 1 pause
R1(config)#menu diag option 2 pause
R1(config)#menu diag option 3 pause
R1(config)#menu diag option 4 pauseTo Test:
R1(config)#do menu diag
####################
# Diagnostics Menu #
####################
1 Ping R2
2 Ping R3
3 Traceroute R2
4 Traceroute R3
x Exit
What is thy wish Master? 1####################
# Diagnostics Menu #
####################
1 Ping R2
2 Ping R3
3 Traceroute R2
4 Traceroute R3
x Exit
Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 200.0.0.2, timeout is 2 seconds:
Packet sent with a source address of 200.0.0.1
!!
Success rate is 100 percent (2/2), round-trip min/avg/max = 4/6/8 ms
--More--
Subtask 2 - Autocommand:
With the menu is sorted - time to create the user and enable them to only have access to the menu. This will be achieved with the autocommand which gets run as soon as the user connects.
R1(config)#username NetDiag password NetDiag
R1(config)#username NetDiag autocommand menu diag
If you noticed in the menu commands, extended ping commands are used which require enable mode.
R1(config)#username NetDiag privilege 15
Make sure we are allowing users to telnet in to us
R1(config)#line vty 0 4
R1(config-line)#login local
Let's test it from R6.
R6#telnet 200.0.0.1
Trying 200.0.0.1 ... Open
User Access Verification
Username: NetDiag
Password:
Trying 200.0.0.1 ... Open
User Access Verification
Username: NetDiag
Password:
####################
# Diagnostics Menu #
####################
1 Ping R2
2 Ping R3
3 Traceroute R2
4 Traceroute R3
x Exit
What is thy wish Master? x
R1## Diagnostics Menu #
####################
1 Ping R2
2 Ping R3
3 Traceroute R2
4 Traceroute R3
x Exit
What is thy wish Master? x
The only possible problem here is when we exit the menu, we are at the CLI prompt with a user in enable mode. If you wanted to disconnect the user when they exit the menu, change it so that they are logged out instead:
R1(config)#menu diag command x logout
No comments:
Post a Comment