操作模式:
- 用戶模式。提示符:">",進入命令:初始模式。
- 特權模式。提示符:"#",進入命令:enable 退出命令:disable
- 全局配置模式。提示符:"(config)#",進入命令:configure terminal 退出命令:exit
- 其他配置模式。如接口模式:提示符:"(config-if)#",進入:interface type number 退出:exit
設置系統日曆:R1#clock set 8:43:00 12 june 2008
R1(config)#clock timezone GMT +8 (設置時區爲北京時間東八區)
命令行幫助:任何情況輸入“?”獲取幫助。
測試網絡連通性:ping ip地址
測試中間經過設備:traceroute ip地址
查看硬件軟件信息:R1>show version
查看運行配置文件:R1# show run
查看保存的配置文件:R1# show startup-config
查看接口狀態: R1# show interface
查看接口與IP相關的信息:R1# show ip interface
R1# show ip interface brief
查看路由表:R1# show ip route
查看路由協議:R1# show ip protocols
配置保存:
保存運行配置文件:R1# copy running-config startup
或者R1# write(用運行配置文件覆蓋啓動配置文件)
刪除啓動配置文件:R1#erase startup-config
配置路由器密碼:
(1)配置Console端口密碼:
R1(config)# line console 0
R1(config-line)# password cisco
R1(config-line)# login
(2)配置從用戶模式切換到特權模式的使能密碼:
R1(config)# enable password cisco
R1(config)# enable secret cisco123 (另外可以配置祕密使能密碼)
(3)配置遠程登錄密碼(VTY,虛擬終端類型)默認不允許遠程訪問
R1(config)#line vty 0 4
R1(config-line)#password cisco
R1(config-line)#login
配置路由器接口IP:
R1(config)# interface s1/1
R1(config-if)# ip address 12.1.1.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
配置路由器接口secondary地址:
R1(config)# interface s1/1
R1(config-if)# ip address 12.1.1.1 255.255.255.0
R1(config-if)# ip address 13.1.1.1 255.255.255.0 secondary
R1(config-if)# no shutdown
R1(config-if)# exit
取消接口的多個IP地址:R1(config-if)# no ip address [ip] [子網掩碼]
刪除接口下的所有IP:R1(config-if)# no ip address
配置主機名列表:
R1(config)#ip host abc 12.1.1.2 (配置完後遠程登錄可以用telnet abc代替主機IP)
查看路由器上配置的主機名列表: show host
配置DNS服務器:ip name-server dns 服務器的IP地址
配置靜態路由
R1(config)#ip route 目標網絡 掩碼 下一跳路由器直連接口的IP或本路由器外出接口 管理距離 [permanent]
使用permanent參數,不管發生什麼意外情況,該靜態路由不會從路由表消失。
前面加no刪除該靜態路由。
默認路由:用來轉發不在路由列表中列出的遠端目的網絡的數據包
R1(config)#ip route 0.0.0.0 0.0.0.0 下一跳路由地址
動態路由
- RIPv1協議配置
R1(config)# router rip 啓動路由選擇進程
R1(config-router)#network 11.0.0.0 宣告各接口的直連網絡
R1(config-router)#network 12.0.0.0
配置默認路由(默認網關):R1(config)# ip route 0.0.0.0 0.0.0.0 23.1.1.3
R1(config)# ip default-network 23.0.0.0 默認網絡,僅支持有類網絡後面要寫網絡的主類地址
負載均衡:R1(config-router)#maximum-paths 6
關閉快速交換使用進程交換:R1(config)#no ip cef
禁用水平分割:R1(config-if)# no ip split-horizon
- RIPv2協議配置
R1(config)# router rip
R1(config-router)# version 2
R1(config-router)#network 主類網絡號 - OSPF協議配置
R1(config)#router ospf 1
R1(config-router)#network IP子網 反掩碼 area 0
交換機基本配置
配置默認網關:SW1(config)# ip default-gateway 1.1.1.1
開啓http服務:SW1(config)# ip http server
關閉http服務:SW1(config)#no ip http server
查看ARP表:show arp
查看MAC地址表:show mac-address-table
vlan配置:參考思科交換機VLAN配置
查看vlan:show vlan
訪問控制列表ACL:參考思科交換機ACL配置