設備管理
一、路由器硬件概述
1、 路由器的內部組件
1.1、 處理器
與計算機一樣,運行着IOS的路由器也包含一個“中央處理器”(CPU),不同系列和型號的路由器,其CPU也不盡相同。路由器的處理器負責執行處理包所需的工作,如路由發現,路由器轉發和路由決定等。路由器處理包的速度在很大程度上取決於處理器的類型。
1.2、 存儲器
所有路由器都安裝了某種形式的存儲器,在路由器中主要有如下4中類型的存儲器:
1.2.1、 RAM:隨機訪問存儲器。相當於計算機的內存。RAM主要運行軟件是IOS映像和配置文件(running-config),還包含路由表和數據緩衝區。RAM具有易失性,一旦斷電則所有存儲的內容會丟失。
1.2.2、 ROM:只讀內存。在ROM中駐留了用於啓動和維護路由器基本功能的一些微代碼,如bootstrap和POST代碼。ROM具有非易失性,即關閉電源也不會丟失內容。
1.2.3、 Flash:閃存,相當於計算機的硬盤,主要用於存儲IOS軟件映像,維持路由器的正常工作。只要閃存容量足夠,可存放多個IOS映像。已提供多重啓動選項。閃存具有非易失性,斷電後,存儲內容也不會丟失。
1.2.4、 NVRAM:非易失性的隨機訪問存儲器,主要用於存儲啓動配置文件(starup-config)。當路由器關閉電源時,NVRAM用內置的電池來維持數據。在NVRAM中還有一個重要的內容是configuration register(配置寄存器),它用來控制路由器啓動。
2、 cisco路由器的啓動過程
2.1、 路由器的啓動過程如下:
①加電自檢(POST):是一系列的硬件自檢並裝載引導代碼;
②ROM加載運行bootstrap啓動微代碼,如查找並運行IOS軟件;
③查看NVRAM的配置寄存器;
④尋找IOS映像文件(Flash);
⑤加載IOS映像文件(RAM);
⑥尋找配置文件(NVRAM);
⑦加載配置文件(RAM);
⑧正常運行。
2.2、 交換機的啓動過程如下:
①加電自檢(POST):是一系列的硬件自檢並裝載引導代碼;
②ROM加載運行bootstrap啓動微代碼,如查找並運行IOS軟件;
③尋找IOS映像文件(Flash);
④加載IOS映像文件(RAM);
⑤尋找配置文件(NVRAM);
⑥加載配置文件(RAM);
⑦正常運行。
二、 路由器、交換機的密碼設置與恢復
路由器的密碼恢復
1、 重啓路由器,並同時按下Ctrl+Breack鍵中斷IOS的加載,路由器將進入ROM Monitor 模式。
2、 將配置寄存器的值更改爲0x2142,表示在啓動時忽略startup-config的配置。
rommom>config 0x2142
rommom>reset
3、 路由器將再次啓動,由於更改了配置寄存器的值,路由器將無法加載配置文件,因此也就不會再有登陸密碼。
4、 進入配置模式後,將配置文件手動加載進來。
Router#copy startup-config running-config
5、 通過show run 命令查看路由器配置了哪些密碼,逐一更改密碼。
6、 修改配置寄存器的值,並保存配置。
Router(config)#cibfug-register 0x2102
Router(config)#exit
Router#copy running-config startup-config
交換機的密碼恢復
1、 使交換機重新啓動。
2、 重啓時按住交換機上面的“mode”鍵,當看到配置界面顯示“switch:”命令提示。便可鬆開“mode”鍵。這表示已經進入到一個專門用來做故障恢復的簡單IOS,由於沒有密碼,正常的IOS無法進入,所以只能現在這裏做一些參數設定。
3、 使用上面提示的命令“flash_init”初始化flash
switch:flash_init
4、 將config.text文件名修改爲config.old 這樣重啓時就不會在加載配置文件,也沒有祕密。
switch: rename flash:config.text flash:config.old
5、 重啓交換機。
switch: boot
6、 把配置文件的名稱改回來。
switch# rename flash:config.old flash:config.text
7、 手工加載配置文件。
switch# copy flash:config.text system:running-config
8、 配置文件加載完成後,需要進入配置模式修改密碼,最後保存配置,完成密碼的恢復。
三、IOS的備份、恢復和升級
3、 IOS的備份和升級
備份和升級IOS的方式有兩種:TFTP和FTP。
FTP:傳輸方便快捷,配置簡單,但文件大小不能超過32MB,超過將無法完成傳輸。
FTP:cisco IOS 12.0後,開始使用FTP方式傳輸文件,傳輸效率和穩定性有很大提高。
3.1、通過TFTP升級cisco路由器的IOS
1)、運行cisco TFTP server
按照下圖操作,將升級的IOS進行名稱、目錄記住。
2)、升級路由器的IOS
Route# copy tftp flash
Address or name or remote hos [ ] ? 192.168.1.2 \\TFTP服務器地址
Source filename [ ] ? c2800nm-ipbase-mz.123-6e.bin \\複製的文件名
Destination filename [c2800nm-ipbase-mz.123-6e.bin] ? (回車)\\複製到設備上的 文件名
按enter鍵確認後,將出現一排排的感嘆號,表明新的IOS文件正傳輸到flash中,如果需要備份IOS,運行以下命令。
Route# show flash
Route# copy flash tftp
ddress or name or remote hos [ ] ? 192.168.1.2 \\TFTP服務器地址
Source filename [ ] ? c2800nm-ipbase-mz.123-6e.bin \\複製的文件名
Destination filename [c2800nm-ipbase-mz.123-6e.bin] ? (回車)\\複製到設備上的 文件名
查看flash中系統名稱
備份操作系統
TFTP服務器,完成操作系統備份任務
3.2通過FTP升級cisco路由器的IOS
1)、配置FTP服務器
制定IOS文件的存放位置(主目錄)以及登陸的用戶名和密碼,如用戶名cisco,
密碼cisco123
2)、在路由器上配置FTP的用戶名和密碼
Route(config)# ip ftp username cisco
Route(config)# ip ftp password cisco123
Route# copy ftp flash
address or name or remote hos [ ] ? 192.168.1.2 \\FTP服務器地址
Source filename [ ] ? c2800nm-ipbase-mz.123-6e.bin \\複製的文件名
Destination filename [c2800nm-ipbase-mz.123-6e.bin] ? (回車)\\複製到設備上的 文件名
3.3、恢復IOS
1)、連接交換機與主機
用console線將交換機的console口和主機的com口相連。
2)、初始化flash
由於設備的IOS文件已經損壞,所以加載IOS的過程也必然失敗,配置界面中會出現提示符“switch:”。在該提示符下輸入命令“flash_init”對flash進行初始化。
switch: flash_init
3)、通過Xmodem協議傳輸IOS文件
switch: copy Xmodem:flash: c2800nm-ipbase-mz.123-6e.bin
按回車確認後,配置界面中會不斷出現字“C”,這表明設備已經準備接收IOS文件。
4)、設置超級終端的Xmodem選項
點擊發送,便開始傳輸文件,傳輸時間可能較長,文件傳輸成功會出現如下提示:
File”Xmodem:”successfully copied to”flash: c2800nm-ipbase-mz.123-6e.bin”
5)、重啓交換機
Switch:boot
四、課後實驗
實驗拓撲:
實驗要求:
1、配置所有設備2分鐘內沒有配置,自動返回到初始界面;
2、啓用顯示同步命令,防止輸入命令時被提示信息“打斷”;
3、關閉所有設備的DNS查詢,減少命令輸錯之後的等待時間;
4、修改路由器名稱爲route1,;
5、路由器設備密文密碼,交換機設置明文密碼;
6、將交換機接口配置爲全雙工,速率爲100M;
7、PC1可以遠程連接所有設備;PC2只可以連接SW3,其他不可以連接;
8、配置靜態路由與默認路由,使全網互通。
(涉及知識點:設備的基本配置、遠程連接、靜態路由、默認路由、密碼設置)
實驗思路:
1、 首先配置所有設備的超時退出,命令同步,關閉DNS查詢,
2、 配置vty密碼及登錄,包括管理地址,
3、 配置接口IP,開啓所使用的接口,
4、 指定靜態路由和默認路由。
實驗配置:
區域1:
R1#conf t
R1(config)#no ip domain-lo \\關閉DNS查詢
R1(config)#line con 0 \\進入console口
R1(config-line)#exec-t 2 0 \\設置超時返回時間
R1(config-line)#logging sync \\同步命令
R1(config-line)#exit
R1(config)#line vty 0 4 \\進入虛擬類型終端(vty)
R1(config-line)#password cisco \\配置vty密碼
R1(config-line)#login \\允許登錄
R1(config-line)#exit
R1(config)#enable sec cisco123 \\設置加密特權密碼
R1(config)#int f0/0 \\進入接口
R1(config-if)#ip add 192.168.10.1 255.255.255.0 \\配置接口IP
R1(config-if)#no sh \\開啓接口
R1(config-if)#int f1/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.10.2 \\配置靜態路由
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.10.2
(此路由器也可配置默認路由,因爲在網絡的末梢即:
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.2)
SW1#conf t
SW1(config)#int vlan 1 \\進入VLAN1
SW1(config-if)#ip add 192.168.1.2 255.255.255.0 \\配置VLAN1的IP地址(即管理地址)
SW1(config-if)#no sh
SW1(config-if)#exit
SW1(config)#line vty 0 4
SW1(config-line)#password cisco
SW1(config-line)#login
SW1(config-line)#exit
SW1(config)#ena
SW1(config)#enable password csico123 \\設置明文特權密碼
SW1(config)#int r f0/0 – 2 \\進入f0/0 - 2 接口
SW1(config-if-range)#no sh \\開啓接口
SW1(config-if-range)#end \\返回特權模式
區域2:
R2#en
R2#conf t
R2(config)#no ip domain-lo
R2(config)#line con 0
R2(config-line)#exec-t 2 0
R2(config-line)#logging sync
R2(config-line)#exit
R2(config)#line vty 0 4
R2(config-line)#password cisco
R2(config-line)#login
R2(config-line)#exit
R2(config)#enable sec cisco123
R2(config)#int f0/0
R2(config-if)#ip add 192.168.10.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int f1/0
R2(config-if)#ip add 192.168.20.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int f2/0
R2(config-if)#ip add 192.168.2.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.10.1
R2(config)#ip route 192.168.3.0 255.255.255.0 192.168.20.2
SW2#conf t
SW2(config)#int vlan 1
SW2(config-if)#ip add 192.168.2.2 255.255.255.0
SW2(config-if)#no sh
SW2(config-if)#exit
SW2(config)#line vty 0 4
SW2(config-line)#password cisco
SW2(config-line)#login
SW2(config-line)#exit
SW2(config)#enable password cisco123
SW2(config)#int r f0/0 -1
SW2(config-if-range)#no sh
SW2(config-if-range)#end
區域3:
R3(config)#no ip domain-lo
R3(config)#line con 0
R3(config-line)#exec-t 2 0
R3(config-line)#logging sync
R3(config-line)#exit
R3(config)#line vty 0 4
R3(config-line)#password cisco
R3(config-line)#login
R3(config-line)#exit
R3(config)#enable sec cisco123
R3(config)#int f0/0
R3(config-if)#ip add 192.168.20.2 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int f1/0
R3(config-if)#ip add 192.168.3.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.20.1 \\配置默認路由
SW3#conf t
SW3(config)#int vlan 1
SW3(config-if)#ip add 192.168.3.2 255.255.255.0
SW3(config-if)#no sh
SW3(config-if)#exit
SW3(config)#line vty 0 4
SW3(config-line)#password cisco
SW3(config-line)#login
SW3(config-line)#exit
SW3(config)#enable password cisco123
SW3(config)#int f0/0 -1
SW3(config)#int r f0/0 -1
SW3(config-if-range)#no sh
SW3(config-if-range)#end