3.6 交換機(jī)基本配置實驗(由于有些命令被限制,建議這個實驗不作為普通實驗內(nèi)容,只作參考)
3.6.1 實驗?zāi)康?/h3>
- 熟悉交換機(jī)開機(jī)界面
- 掌握交換機(jī)基本配置及查看統(tǒng)計信息的方法
- 掌握配置交換機(jī)的常用功能
- 配置文件的備份和擦除
3.6.2 背景描述
假設(shè)你是某公司的網(wǎng)絡(luò)管理員,現(xiàn)在需要對公司的交換機(jī)設(shè)備進(jìn)行初始配置,包括交換機(jī)的基本配置、IOS及配置文件的備份升級。配置完成后,下次就可以通過遠(yuǎn)程登錄方式來對設(shè)備進(jìn)行操作。
3.6.3 實驗設(shè)備
- 一臺RG-S2126_1G交換機(jī)
- 兩臺PC機(jī),其中一臺可以打開管理端網(wǎng)頁,進(jìn)行設(shè)備配置
- 一根直通網(wǎng)線
3.6.4 實驗拓?fù)鋱D
實驗拓?fù)淙鐖D1-3所示:
圖1-3 Telnet配置管理
3.6.5 實驗步驟
在默認(rèn)配置下,交換機(jī)的所有接口處于可用狀態(tài)并且都屬于VLAN1,這種情況下交換機(jī)就可以正常工作了。但為了方便管理和使用,首先應(yīng)對交換機(jī)做基本的配置。最基本的配置可以通過啟動時的對話框配置模式完成。也可以在交換機(jī)啟動后再進(jìn)行配置。
- 配置enable口令和主機(jī)名
Cisco交換機(jī)可以配置enable password和enable secret。一般情況下配置一個即可,當(dāng)兩者同時配置時,后者生效。兩者的區(qū)別是使能口令以明文顯示而使能密碼以密文形式顯示
但是銳捷交換機(jī)配制情況不一樣。
Switch>
Switch> (用戶執(zhí)行模式提示符)
Switch>enable ( 進(jìn)入特權(quán)模式)
Password:
Switch# (特權(quán)模式提示符)
Switch#configure terminal (進(jìn)入配置模式)
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# (配置模式提示符)
Switch(config)#enable ? (設(shè)置enable 密碼)
secret Assign the privileged level secret
services Modify use of network management services
Switch(config)#enable secret ?
0 Specifies an UNENCRYPTED password will follow
5 Specifies an ENCRYPTED secret will follow
level Set exec level password
Switch(config)#enable secret level ? (選擇enable 密碼級別)
<0-15> Level number
Switch(config)#enable secret level 13 ?
0 Specifies an UNENCRYPTED password will follow (未加密)
5 Specifies an ENCRYPTED secret will follow (加密的)
.
Switch(config)#enable secret level 13 0 ?
WORD Specifies an UNENCRYPTED password will follow
Switch(config)#enable secret level 13 0 rgs2126g (設(shè)置enable密碼為rgs2126g)
2008-07-30 14:37:22 @5-CONFIG:Configured from outband
Switch(config)#^Z (退出到特權(quán)模式)
Switch#sh run (查看當(dāng)前運行配置文件)
System software version : 1.61(2) Build Aug 31 2005 Release
Building configuration...
Current configuration : 271 bytes
!
version 1.0
!
hostname Switch
vlan 1
!
enable secret level 13 5 (rW1u_;C2q-8U0<DWr.tj9=G3v/7R:>H (默認(rèn)下,選擇0或5都加密)
enable secret level 14 5 $2,1u_;C3&-8U0<D4'.tj9=GQ+/7R:>H
enable secret level 15 5 (rW.Y*T72q,tZ[V/Wr+S(\W&3v1X)sv'
!
interface vlan 1
no shutdown
!
end
Switch#
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S2126_1
2008-07-30 17:27:46 @5-CONFIG:Configured from outband
S2126_1(config)#
- 配置交換機(jī)的端口屬性
交換機(jī)的端口屬性默認(rèn)地支持一般網(wǎng)絡(luò)環(huán)境下的正常工作,一般情況下是不需要對其端口進(jìn)行設(shè)置的。在某些情況下需要對其端口屬性進(jìn)行配置時,配置的屬性主要有速率、雙工和端口描述等信息。
S2126_1 (config)#interface fastethernet0/1 (進(jìn)入快速以太網(wǎng)接口0/1的配置模式)
S2126_1 (config-if)#speed ? (查看speed命令的子命令)
10 Force 10 Mbps operation (顯示結(jié)果)
100 Force 100 Mbps operation
auto Enable AUTO speed configuration
S2126_1(config-if)#speed 100 (設(shè)置端口速率為100Mb/s)
2008-07-30 14:58:38 @5-CONFIG:Configured from outband
S2126_1 (config-if)#duplex ? (查看duplex命令的子命令)
auto Enable AUTO duplex configuration
full Force full duplex operation
half Force half-duplex operation
S2126_1 (config-if)#duplex full (設(shè)置該端口為全雙工)
S2126_1 (config-if)#description TO_PC (設(shè)置該端口描述為TO_PC)
S2126_1 (config-if)#^Z (返回到特權(quán)模式,同end)
S2126_1 #show interface fastethernet0/1 (查看端口0/1的配置結(jié)果)
實驗結(jié)果:
S2126_1 #show intface fasterthernet0/1 status (查看端口0/1的狀態(tài))
實驗結(jié)果:
- 配置和查看MAC地址表
- 查看MAC地址表
將PC機(jī)用網(wǎng)線連接到交換機(jī)的fastethernet0/1(交換機(jī)第0個模塊的第一個接口)上,使用命令show mac-address-table來查看PC機(jī)的MAC地址。
S2126_1#show mac-address-table
實驗結(jié)果:
- 配置MAC地址
交換機(jī)的地址表有三種地址。動態(tài)地址、永久地址和限制性地址。交換機(jī)學(xué)習(xí)到的動態(tài)MAC地址的超時時間默認(rèn)為300s,可以通過命令來修改這個值。
S2126_1(config)#mac-address-table ? (查看mac-address-table的子命令)
aging-time Set MAC address table entry maximum age
filtering Configure a filtering addresses
notification Enable/Disable MAC Notification on the switch
static static keyword
S2126_1(config)#mac-address-table aging-time ?
<0-0> Enter 0 to disable aging
<300-1000000> Set MAC address table entry maximum age
S2126_1 (config)#mac-address-table aging-time 400 (設(shè)置超時時間為400s)
S2126_1 (config)#mac-address static 00E0.4C81.E110 vlan 1 interface f0/2 (加入靜態(tài)MAC地址)
S2126_1 (config)#end
S2126_1 #show mac-address-table (查看整個MAC地址表)
實驗結(jié)果:
- 配置文件的備份和擦除
交換機(jī)與計算機(jī)有相似點是,它也有內(nèi)存、操作系統(tǒng)、配置和用戶界面,Cisco網(wǎng)絡(luò)設(shè)備中,操作系統(tǒng)叫做互連網(wǎng)操作系統(tǒng)(Internetwork Operating System)或IOS。我們首先介紹下介紹交換機(jī)的存儲器。
- ROM:只讀存儲器,包含交換機(jī)正在使用的IOS的一份副本;
- RAM:IOS將隨機(jī)訪問存儲器分成共享和主存。主要用來存儲運行中的交換機(jī)配置
- 閃存(FLASH):用來存儲IOS軟件映像文件,閃存是可以擦除內(nèi)存,它能夠用IOS的新版本覆寫,IOS升級主要是閃存中的IOS映像文件進(jìn)行更換。
- NVRAM:非易失性隨機(jī)訪問存儲器,用來存儲系統(tǒng)的配置文件。
- 保存配置文件
為了使當(dāng)前對交換機(jī)配置的信息能夠在下次交換機(jī)重啟后有效,我們可以把當(dāng)前的配置信息保存在交換機(jī)的NVRAM中。
命令如下:
S2126_1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
S2126_1#
交換機(jī)重啟后會自動調(diào)用NVRAM中的配置文件加載入主存中,然后逐行執(zhí)行。
- 擦除配置文件
在做每次實驗以前,為了不使上次實驗的配置對本實驗產(chǎn)生影響,我們可以把保存在NVRAM中的配置文件擦除。
命令如下:
S2126_1#erase startup-config
Erasing the nvram filesystem will remove all files! Continue? [confirm]
[OK]
Erase of nvram: complete
S2126_1#