網管日常操作 Cisco 路由器時,快速找到正確指令至關重要。本文將數百條常用指令分為五大類:Exec 特權指令、Show 顯示指令、Config 進入模式、Global Configuration 指令、IP 子模式指令,並以表格呈現指令與功能對照,方便查閱與背誦。
| 指令 | 功能 |
|---|---|
enable | 進入特權模式 (#) |
disable | 返回用戶模式 (>) |
configure terminal | 進入全域配置模式 (config)# |
copy running-config startup-config | 存檔 (write memory) |
copy running-config tftp | 備份配置至 TFTP |
copy tftp running-config | 從 TFTP 還原配置 |
reload | 冷重啟路由器 |
ping / traceroute | 連通性測試 |
show running-config | 顯示執行中配置 |
show startup-config | 顯示啟動配置 |
show ip interface brief | 介面 IP 狀態一覽 |
show version | 韌體版本、硬體、記憶體、啟動時間 |
debug ... / undebug all | 開啟/關閉除錯 |
write erase | 清除啟動配置 (慎用) |
show interfaces、show controllers、show interface statusshow ip route、show ip protocols、show ip ospf neighbor、show ip bgp summaryshow vlan brief、show spanning-tree、show mac address-tableshow access-lists、show ip access-lists、show loggingshow processes cpu、show memory、show flash、show environmentshow crypto ipsec sa、show crypto isakmp sa| 指令 | 功能 |
|---|---|
hostname NAME | 設定主機名稱 |
enable secret PASS | 設定加密特權密碼 (MD5/SHA256) |
service password-encryption | 加密配置檔中明文密碼 |
ip routing | 啟用 IP 路由功能 |
ip domain-name NAME | 設定網域名稱 (SSH 需求) |
crypto key generate rsa | 產生 SSH 金鑰 |
line vty 0 4 | 進入 VTY 線路配置 |
ntp server IP | 設定 NTP 伺服器 |
logging host IP | Syslog 伺服器 |
snmp-server community STR RO/RW | SNMP 社群字串 |
Router(config)# interface GigabitEthernet0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)# speed 1000
Router(config-if)# duplex full
Router(config-if)# description UPLINK_TO_CORE
Router(config-if)# ip access-group 101 in
Router(config-if)# service-policy output QOS_OUT
ip route 0.0.0.0 0.0.0.0 NEXT_HOP:預設路由ip route 10.0.0.0 255.0.0.0 192.168.1.2:靜態路由ip dhcp pool POOL_NAME:DHCP 池設定ip access-list extended NAME:命名式擴充 ACLip nat inside source list 1 interface Gig0/0 overload:PAT/NAPTip ssh version 2:強制 SSH v2建議將此速查表列印或存為離線檔案,配合 Tab 自動完成與 ? 線上說明,大幅提升配置效率。