實驗 11.5.2:管理設備設定 拓樸圖
學習目標
設定網路連通性。
使用 TFTP 儲存和恢復 Cisco IOS 設定。背景
硬體 數量 說明
Cisco 路由器 1 CCNA 實驗室套裝的一部分。
電腦(主機) 1 實驗室電腦。
主控台(反轉)纜線 1 用於將電腦主機 1 連接至路由器的主控台連接埠。
交叉纜線 1 用於將主機 1 的網卡連接至路由器 1 的 Fa0/1 連接 埠
表 1. 此實驗所需的設備和硬體。
收集齊必要的設備和纜線。要設定實驗,請確保提供有表 1 中所列的設備。
主機電腦將當作 TFTP 伺服器。本實驗需要使用 SolarWinds TFTP 伺服器軟體。SolarWinds 是 Windows 平臺下的一款免費 TFTP 應用程式。
場景
在本實驗中,學生將設定 Cisco 路由器的常見設定,將設定儲存到 TFTP 伺服器上,並從 TFTP 伺服器恢 復設定。
給定 IP 位址為 10.250.250.0/24,且 6 位用於子網。使用最後一個子網。主機 1 應該使用第一個有效 的主機位址,路由器 1 應該使用最後一個有效的主機位址:
IP 位址:10.250.250.0 子網路遮罩:
子網 第一個主機位址 最後一個主機位址 廣播
任務 1:設定網路連通性。
步驟 1:實際連接設備。
請參閱拓樸圖。將主控台纜線(即反轉線)的一端連接至路由器的主控台連接埠,另一端透過 DB-9 或 DB-25 配接卡連接到主機電腦的 COM 1 連接埠。確保主機電腦和路由器均已通電。
步驟 2:從邏輯上連接設備。
使用場景中的 IP 位址資訊設定主機 1 電腦。
步驟 3:透過超級終端將主機電腦連接到路由器。
從 Widows 的工作列中按一下“開始”|“程式”|“附件”|“通訊”|“超級終端”啟動超級終端程式。
當超級終端會談視窗出現後,按 Enter 鍵直到路由器發出響應。
步驟 4:設定路由器 1。
設定路由器 1。路由器 1 的設定任務包括:
任務 — 請參閱附錄 1 獲取命令幫助 指定路由器名稱 — Router1
指定加密的特權執行密碼 — cisco 指定主控台存取密碼 — class 指定 telnet 存取密碼 — class 設定 MOTD 標語。
設定路由器 1 的介面 Fa0/0 — 設定描述 設定第 3 層位址
發出 no shutdown 命令 注意 **切勿將設定儲存到 NVRAM。
步驟 5:驗證連通性。
驗證主機 1 和路由器 1 之間的連通性:
Router1# ping 10.250.250.253 Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.250.250.253, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms Router1#
任務 2:使用 TFTP 儲存和恢復 Cisco IOS 設定。
步驟 1:安裝 SolarWinds TFTP 應用程式。
按兩下 SolarWinds TFTP 應用程式開始安裝。選擇 Next(下一步)。同意授權合約,並接受預設設定。完 成 SolarWinds 安裝後,按一下 Finish(完成)。
步驟 2:啟動 TFTP 伺服器。
圖 2. TFTP 伺服器窗口。
透過選擇“開始”|“程式”| SolarWinds Free Tools(SolarWinds 免費工具)| TFTP Server(TFTP 伺服 器)啟動 TFTP 伺服器。圖 2 所示為一個活動的 TFTP 伺服器視窗。
步驟 3:設定 TFTP 伺服器。
圖 3. TFTP 伺服器窗口。
要設定 TFTP 伺服器,請選擇功能表選項 File(檔案)| configure(設定)。請參閱圖 3,驗證下列設定:
設定 值
TFTP Root Directory
(TFTP 根目錄):
TFTP-Root
Security(安全性) Transmit and Receive Files(傳送和接收檔案)
Advanced Security
(高級安全性)
10.250.250.254 To 10.250.250.254(10.250.250.254 到 10.250.250.254)
Auto-Close(自動關閉) Never(從不)
Log(日誌) Enable Log Requests to the Following File.(為下列檔案啟 用日誌請求。)Leave the default file.(保持預設檔案。)
完成後,選擇確定。
步驟 4. 將路由器 1 的設定儲存到 TFTP 伺服器。
從超級終端中啟動 TFTP 上傳過程以上傳到 TFTP 伺服器:
Router1#copy running-config tftp:
Address or name of remote host []? 10.250.250.253 Destination filename [router1-confg]? <ENTER>
!!
1081 bytes copied in 2.008 secs (538 bytes/sec) Router1#
驗證上傳傳輸是否成功。打開日誌檔案 c:\Program Files\SolarWinds\Free Tools\TFTP-Server.txt,其內容 應該類似下列:
3/25/2007 12:29 :Receiving router1-confg from (10.250.250.254)
3/25/2007 12:29 :Received router1-confg from (10.250.250.254), 1081 bytes 驗證傳輸的檔案。使用 Microsoft Word 或寫字板檢查檔案 c:\TFTP-Root\router1-confg 的內容。內容應該 類似下列設定:
!
version 12.4
service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption
!
hostname Router1
!
boot-start-marker boot-end-marker
!
enable secret 5 $1$D02B$AuX05n0HPT239yYRoQ0oE.
!
no aaa new-model ip cef
!
interface FastEthernet0/0
description connection to host1
ip address 10.250.250.254 255.255.255.252 duplex auto
speed auto
!
interface FastEthernet0/1 no ip address
shutdown duplex auto speed auto
!
interface Serial0/1/0 no ip address
shutdown no fair-queue
!
interface Serial0/1/1 no ip address
shutdown
clock rate 2000000
!
ip http server
no ip http secure-server
!
control-plane
!
banner motd
*** ABC COMPANY NETWORK DEVICE ****
*** Authorized access only *****
*** Logging is enabled ****
!
line con 0 password class login
line aux 0 line vty 0 4 password class login
!
scheduler allocate 20000 1000 End
步驟 5:從 TFTP 伺服器恢復路由器 1 的設定。
確認 NVRAM 中無內容,然後重新啟動路由器 1:
Router1# show startup-config startup-config is not present Router1# reload
Proceed with reload? [confirm] <ENTER>
必須與 TFTP 伺服器建立連接。必須為路由器 1 的 fa0/0 介面設定 IP 位址並將其啟用:
Router> enable Router# conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)# interface fa0/0
Router(config-if)# ip address 10.250.250.254 255.255.255.252 Router(config-if)# no shutdown
Router(config-if)# exit
*Mar 25 16:43:03.095: %SYS-5-CONFIG_I: Configured from console by console
*Mar 25 16:43:04.967: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
將路由器的主機名稱設定為 TEST Router(config-if)#exit
Router(config)#hostname TEST Router(config-if)#end
TEST#
使用 ping 命令驗證連通性:
Router# ping 10.250.250.253 Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.250.250.253, timeout is 2 seconds:
.!!!!
Success rate is 80 percent(4/5), round-trip min/avg/max = 1/1/1ms Router#
從 TFTP 伺服器下載路由器 1 的設定檔:
Router# copy tftp startup-config
Address or name of remote host []? 10.250.250.253 Source filename []? router1-confg
Destination filename [startup-config]? <ENTER>
Accessing tftp://10.250.250.253/router1-confg...
Loading router1-confg from 10.250.250.253 (via FastEthernet0/0): ! [OK - 1081 bytes]
1081 bytes copied in 9.364 secs (115 bytes/sec) Router1#
*Mar 25 16:55:26.375: %SYS-5-CONFIG_I: Configured from tftp://10.250.250.253/router1-confg by console
Router1#
查看 NVRAM 中的設定以驗證傳輸是否準確。該設定應該與任務 1 步驟 4 中的設定相同。
重載路由器,當出現“Configuration has been modified”的提示時選擇“no”。
應該恢復之前的設定,現在,路由器的主機名稱應該是 Router1。
任務 3:思考
TFTP 是用於儲存和載入 Cisco IOS 設定檔的快速有效的方法。
任務 4:練習
與上傳設定檔相似,還可離線儲存 IOS 以供日後使用。要尋找 IOS 檔案名,發出 Cisco IOS 命令 show
version。檔案名反白顯示如下:
R Router1# show version
Cisco IOS Software, 1841 Software (C1841-ADVIPSERVICESK9-M), Version 12.4(10b),
RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Fri 19-Jan-07 15:15 by prod_rel_team
ROM: System Bootstrap, Version 12.4(13r)T, RELEASE SOFTWARE (fc1) Router1 uptime is 17 minutes
System returned to ROM by reload at 16:47:54 UTC Sun Mar 25 2007 System image file is "flash:c1841-advipservicesk9-mz.124-10b.bin"
This product contains cryptographic features and is subject to United States and local country laws governing import, export, transfer and use. Delivery of Cisco cryptographic products does not imply third-party authority to import, export, distribute or use encryption. Importers, exporters,
distributors and users are responsible for compliance with U.S. and local country laws. By using this product you agree to comply with applicable laws and regulations. If you are unable to comply with U.S. and local laws, return this product immediately.
A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
If you require further assistance please contact us by sending email to [email protected].
Cisco 1841 (revision 6.0) with 174080K/22528K bytes of memory.
Processor board ID FHK110918KJ 2 Serial(sync/async) interfaces
DRAM configuration is 64 bits wide with parity disabled.
191K bytes of NVRAM.
62720K bytes of ATA CompactFlash (Read/Write) Configuration register is 0x2102
Router1#
用於上傳 IOS 的命令與用於上傳設定檔的命令相似:
Router1# copy flash tftp
Source filename []? c1841-advipservicesk9-mz.124-10b.bin Address or name of remote host []? 10.250.250.253
Destination filename [c1841-advipservicesk9-mz.124-10b.bin]?
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!
22063220 bytes copied in 59.564 secs (370412 bytes/sec) Router1#
任務 5:課後清理
在關閉路由器電源之前,如果已載入 NVRAM 設定檔,請將其刪除。使用特權執行命令 erase
startup-config。
從主機電腦上刪除 SolarWinds TFTP 伺服器。選擇“開始”|“主控台”。打開“增加或刪除程式”。選擇 SolarWinds,然後選擇“刪除”。接受預設選項。
刪除主機電腦上儲存的所有設定檔。
除非教師另有指示,否則請恢復主機電腦的網路連通性,然後關閉其電源。帶上您帶進實驗室的所有物品 離開,將實驗室留給下一班同學。
附錄 1
用途 命令
進入全域設定模式。
configure terminal
範例:Router>enable
Router#configure terminal Router(config)#
為路由器指定名稱。
hostname name
範例:
Router(config)# hostname Router1 Router(config)#
指定加密密碼以防止未經授權的人員 存取特權執行模式。
enable secret password
範例:Router(config)# enable secret cisco Router(config)#
指定密碼以防止未經授權的人員存取 主控台。
password password login
範例:
Router(config)# line con 0
Router(config-line)# password class Router(config-line)# login
Router(config)#
指定密碼以防止未經授權的人員透過 telnet 存取。
路由器 vty 線路:0 4 交換器 vty 線路:0 15
password password login
範例:
Router(config)# line vty 0 4
Router(config-line)# password class Router(config-line)# login
Router(config-line)#
設定 MOTD 標語。
Banner motd %
範例:Router(config)# banner motd % Router(config)#
設定介面。
路由器介面預設關閉 交換器介面預設打開
範例:
Router(config)# interface fa0/0
Router(config-if)# description description Router(config-if)# ip address address mask Router(config-if)# no shutdown
Router(config-if)#
將設定儲存到 NVRAM。
copy running-config startup-config
範例:Router# copy running-config startup-config Router#