萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 網路安全 >  >> 路由器知識 >> 路由器設定 >> Cisco 思科路由器

Cisco 路由器常用命令速查手冊:模式切換、顯示、拷貝、網絡、基礎配置六大類

熟練掌握 Cisco IOS 命令模式與核心指令是網管必備基本功。本文將命令分為六大類,提供任務導向速查表,涵蓋模式切換、顯示、拷貝/備份、網絡測試、基礎配置,適合列印作為桌邊手冊。

一、命令模式層級

提示符模式名稱進入指令主要功能
Router>User EXEC預設登入基本檢視、連通性測試,不可改配置
Router#Privileged EXECenable完整檢視、Debug、檔案操作、進入配置模式
Router(config)#Global Configconfigure terminal全域參數:hostname、routing、ACL、user、NAT
Router(config-if)#Interface Configinterface type num介面 IP、封裝、帶寬、NAT inside/outside
Router(config-line)#Line Configline vty 0 4Console/AUX/VTY 密碼、傳輸協議、逾時
Router(config-router)#Routing Configrouter ospf 1動態路由協議參數

退出層級:exit (上一層) / end / Ctrl+Z (直回 #)。

二、幫助系統

  • ?:任何模式、任何位置皆可用,顯示可用命令/關鍵字/參數。
  • command ?:顯示該命令下一步可用參數。
  • command keyword:自動補全。

三、模式切換指令

enable                    ! User -> Privileged
disable                   ! Privileged -> User
configure terminal        ! Privileged -> Global Config
end / ^Z                  ! 任意配置模式 -> Privileged
interface Gig0/0          ! Global -> Interface Config
line vty 0 4              ! Global -> Line Config
router ospf 1             ! Global -> Router Config
exit                      ! 退出當前配置子模式

四、顯示指令

show version              ! 硬體/軟體版本、Config Register、Uptime
show running-config       ! 當前運行配置 (RAM)
show startup-config       ! 啟動配置 (NVRAM)
show interface [type num] ! 介面詳細統計、錯誤計數
show ip route             ! 完整路由表
show ip interface brief   ! 介面 IP/狀態一覽
show ip nat translations  ! NAT 表項
show cdp neighbors detail ! CDP 鄰居詳細資訊

五、拷貝/備份/升級指令

copy running-config startup-config   ! 存檔 (RAM->NVRAM)
copy startup-config running-config   ! 合併啟動配置到運行
copy running-config tftp             ! 備份配置到 TFTP
copy startup-config tftp             ! 備份啟動配置到 TFTP
copy tftp running-config             ! 從 TFTP 還原配置到運行
copy tftp flash                      ! 從 TFTP 升級 IOS 到 Flash
copy flash tftp                      ! 備份 IOS 到 TFTP
erase startup-config                 ! 清除 NVRAM 配置 (慎用)
reload                               ! 重啟裝置

六、網絡測試指令

ping ip|hostname          ! ICMP 連通性
ping ip repeat 100 size 1500 df-bit  ! 壓力測試、MTU 測試
traceroute ip|hostname    ! 路徑追蹤 (TTL 遞增)
telnet ip|hostname [port] ! 遠端登入/測試 TCP 埠
ssh -l user ip            ! SSH 登入 (Client 端)

七、基礎配置指令

hostname R1
enable secret StrongPass
username admin privilege 15 secret AdminPass
ip domain-name corp.local
crypto key generate rsa modulus 2048
ip ssh version 2
interface Gig0/0
 ip address 192.168.1.1 255.255.255.0
 no shutdown
ip route 0.0.0.0 0.0.0.0 192.168.1.254
line vty 0 4
 login local
 transport input ssh
access-list 23 permit 192.168.100.0 0.0.0.255
line vty 0 4
 access-class 23 in
copyright © 萬盛學電腦網 all rights reserved