路由器設置之菜單設置的小技巧
菜單創(chuàng)建能力是思科網(wǎng)際操作系統(tǒng)從10.0版本開始提供的。利用命令行工具建立一個菜單非常簡單,包含了四個關鍵的要點:在例子中,網(wǎng)絡運行中心(NOC)需要查看實驗室中測試路由器設置的使用界面,并運行ping和trace命令。要做到這一點的話,我將首先創(chuàng)建一個嵌套菜單上的命令選項允許進行路由器設置測試操作,并進一步創(chuàng)建一個用戶帳戶與該菜單進行關聯(lián)。我首先創(chuàng)建的是主菜單。在這個菜單上,用戶可以根據(jù)他們的需求選擇相應的二級菜單。設置好菜單的標題,并添提示信息方便用戶將來的使用:
- menu NOC title ^ Menu for NOC users ^C
- menu NOC prompt ^ Choose your selection: ^C
接著,我對用戶選項的情況進行設置。
- menu NOC text 1. Ping Menu
- menu NOC text 2. Trace Menu
- menu NOC text 3. Show Interface Menu
- menu NOC text 4. Exit
這些選項將與實際命令關聯(lián),在這種情況下,實現(xiàn)的目的是呼出嵌套菜單。
- menu NOC command 1. menu ping
- menu NOC command 2. menu trace
- menu NOC command 3. menu interface
- menu NOC command 4. exit
我希望用戶應該先確認數(shù)據(jù),再決定怎樣使用菜單,因此,我會在每個命令后面添加一個“暫停”選項。
- menu NOC options 1. pause
- menu NOC options 2. pause
- menu NOC options 3. pause
- menu NOC clear-screen
- menu ping title ^ Menu for ping ^C
- menu ping prompt ^ Choose Your Ping Destination: ^C
- menu ping text 1. SW05
- menu ping command 1. ping 192.168.80.1
- menu ping options 1. pause
- menu ping text 2. SW06
- menu ping command 2. ping 172.20.200.5
- menu ping options 2. pause
- menu ping text 3. SW07
- menu ping command 3. ping 192.168.80.214
- menu ping options 3. pause
- menu ping text 4. Back
- menu ping command 4. menu-exit
- menu ping clear-screen
- menu trace title ^ Menu for Traceroute ^C
- menu trace prompt ^ Choose Your Traceroute Destination: ^C
- menu trace text 1. SW05
- menu trace command 1. trace 192.168.80.1
- menu trace options 1. pause
- menu trace text 2. SW06
- menu trace command 2. trace 172.20.200.5
- menu trace options 2. pause
- menu trace text 3. SW07
- menu trace command 3. trace 192.168.80.214
- menu trace options 3. pause
- menu trace text 4. Back
- menu trace command 4. menu-exit
- menu trace clear-screen
- menu interface title ^ Show Interface Menu ^C
- menu interface prompt ^ Choose Your Interface Option: ^C
- menu interface text 1. Show IP Interface Brief
- menu interface command 1. sh ip int brief
- menu interface options 1. pause
- menu interface text 2. Show Interface Ethernet0/0
- menu interface command 2. sh int ethernet0/0
- menu interface options 2. pause
- menu interface text 3. Show Interface Ethernet0/1
- menu interface command 3. sh int ethernet0/1
- menu interface options 3. pause
- menu interface text 4. Back
- menu interface command 4. menu-exit
- menu interface clear-screen
***,我將在路由器設置上創(chuàng)建一個本地用戶帳戶。“自動運行(autocommand)”的選項告訴路由器設置,在網(wǎng)絡運行中心有人登陸的時間,執(zhí)行我們的菜單命令。
路由器設置中關于菜單設置的小技巧就為大家介紹完了,希望大家通過以上的介紹已經(jīng)掌握。
【編輯推薦】