萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 網路安全 >  >> 網路應用技術 >> 應用程式教學

Cisco 交換機與路由器基礎配置命令大全

常用模式速查

提示符模式進入命令
Router>用戶模式默認
Router#特權模式enable
Router(config)#全局配置模式configure terminal
Router(config-if)#接口配置模式interface <類型/編號>
Router(config-line)#線路配置模式line console 0 / vty 0 4
Router(config-router)#路由進程模式router rip / ospf 1

交換機初始化配置範例

! 主機名
hostname SW-Core

! 特權密碼(加密)
enable secret cisco123

! Console 密碼
line console 0
 password cisco
 login

! VTY 遠程密碼
line vty 0 15
 password cisco
 login

! 管理 VLAN IP
interface vlan 1
 ip address 192.168.1.5 255.255.255.0
 no shutdown

! 默認網關(二層交換機需配置)
ip default-gateway 192.168.1.1

路由器初始化配置範例

hostname R1
enable secret cisco123
line console 0
 password cisco
 login
line vty 0 4
 password cisco
 login

interface f0/0
 ip address 192.168.1.1 255.255.255.0
 no shutdown

interface f0/1
 ip address 192.168.10.1 255.255.255.0
 no shutdown

! 靜態路由
ip route 192.168.100.0 255.255.255.0 192.168.10.2

! RIP 動態路由
router rip
 network 192.168.1.0
 network 192.168.10.0

! DHCP 服務器
ip dhcp excluded-address 192.168.1.1
ip dhcp pool LAN_POOL
 network 192.168.1.0 255.255.255.0
 default-router 192.168.1.1
 dns-server 8.8.8.8

常用驗證命令

show running-config      ! 當前運行配置
show startup-config      ! 啟動配置
show ip route            ! 路由表
show ip interface brief  ! 接口 IP 狀態
show ip nat translations ! NAT 轉換表
copyright © 萬盛學電腦網 all rights reserved