實驗 在交換機上配置 Telnet
【實驗名稱】
在交換機上配置 Telnet
【實驗目的】
學習如何在交換機上啓用 Telent,實現通過 Telnet 遠程訪問交換機。
【背景描述】
企業園區網覆蓋範圍較大時,交換機會分別放置在不同的地點,如果每次配置交換機
都需要在交換機所在地點現場配置,管理員的工作量會很大。此時可以在交換機上進行
Telnet 配置,這樣再需要配置交換機時,管理員可以遠程以 Telnet 方式登錄配置。
【需求分析】
需要掌握如何配置交換機的密碼,以及如何配置 Telnet,掌握以 Telnet 的方式遠程訪
問交換機的方法。
【實驗拓撲】
圖 2-2 實驗拓撲圖
【實驗設備】
二層交換機 1 臺
三層交換機 1 臺
【預備知識】
交換機的基本配置方法
【實驗原理】
在兩臺交換機上配置VLAN 1的 IP 地址, 用雙絞線將兩臺交換機的F0/1端口連接起來,
分別配置 Telnet,然後就可以實現在每臺交換機以 Telnet 的方式登錄另一臺交換機。
【實驗步驟】
第一步:在兩臺交換機上配置主機名、管理 IP 地址
S3760(config)#hostname L3-SW
!配置 3 層交換機的主機名
L3-SW(config)#interface vlan 1
!配置 3 層交換機的管理 IP 地址
L3-SW(config-if)#ip address 192.168.1.1 255.255.255.0
L3-SW(config-if)#no shutdown
L3-SW(config-if)#end
S2126G (config)#hostname L2-SW
!配置 2 層交換機的主機名
L2-SW(config)#interface vlan 1
!配置 2 層交換機的管理 IP 地址
L2-SW(config-if)#ip address 192.168.1.2 255.255.255.0
L2-SW(config-if)#no shutdown
L2-SW(config-if)#end
第二步:在三層交換機上配置 Telnet
L3-SW(config)#enable password 0 star
!配置 enable 的密碼
L3-SW(config)#line vty 0 4
!進入線程配置模式
L3-SW(config-line)#password 0 star
!配置 Telnet 的密碼
L3-SW(config-line)#login
!啓用 Telnet 的用戶名密碼驗證
L3-SW(config-line)#exit
第三步:在二層交換機上配置 Telnet
L2-SW(config)#enable secret level 1 0 star
!配置 Telnet 的密碼,即 level 1 的密碼
L2-SW(config)#enable secret 0 star
!配置 enable 密碼,默認是 level 15 的密碼
第四步:使用 Telnet 遠程登錄
可以在 3 層交換機 L3-SW 上以 Telnet 的方式登錄 2 層交換機 L2-SW,進行驗證:
L3-SW#telnet 192.168.1.2
Trying 192.168.1.2, 23...
User Access Verification
Password:
!提示輸入 Telnet 密碼,輸入設置的密碼 star
L2-SW>enable
Password:
!提示輸入 enable 密碼,輸入設置的密碼 star
L2-SW#
!現在已經進入了二層交換機 L2-SW,可以正常的進行配置
L2-SW#
L2-SW#exit
!使用 exit 命令退出 Telnet 登錄
L3-SW#
可以在 2 層交換機 L2-SW 上以 Telnet 的方式登錄 3 層交換機 L3-SW,進行驗證:
L2-SW#telnet 192.168.1.1
Trying 192.168.1.1 ... Open
User Access Verification
Password:
!提示輸入 Telnet 密碼,輸入設置的密碼 star
L3-SW>en
Password:
!提示輸入 enable 密碼,輸入設置的密碼 star
L3-SW#
L3-SW#exit
[Connection to 192.168.1.1 closed by foreign host]
!使用 exit 命令退出 Telnet 登錄
L2-SW#
【備註事項】
如果沒有配置 enable 的密碼,將不能登錄到交換機進行配置,可以進入用戶模式,但
無法進入特權模式,二層交換機此時的提示信息爲“% No password set” ,三層交換
機此時的提示信息爲“Password required, but none set” 。
【參考配置】
L3-SW#show running-config
Building configuration...
Current configuration : 1359 bytes
!
version RGNOS 10.2.00(2), Release(27932)(Thu Dec 13 10:31:41 CST 2007
-ngcf32)
hostname L3-SW
!
vlan 1
!
no service password-encryption
!
enable password star
!
!
interface FastEthernet 0/1
!
interface FastEthernet 0/2
!
interface FastEthernet 0/3
!
interface FastEthernet 0/4
!
interface FastEthernet 0/5
!
interface FastEthernet 0/6
!
interface FastEthernet 0/7
!
interface FastEthernet 0/8
!
interface FastEthernet 0/9
!
interface FastEthernet 0/10
!
interface FastEthernet 0/11
!
interface FastEthernet 0/12
!
interface FastEthernet 0/13
!
interface FastEthernet 0/14
!
interface FastEthernet 0/15
!
interface FastEthernet 0/16
!
interface FastEthernet 0/17
!
interface FastEthernet 0/18
!
interface FastEthernet 0/19
!
interface FastEthernet 0/20
!
interface FastEthernet 0/21
!
interface FastEthernet 0/22
!
interface FastEthernet 0/23
!
interface FastEthernet 0/24
!
interface GigabitEthernet 0/25
!
interface GigabitEthernet 0/26
!
interface GigabitEthernet 0/27
!
interface GigabitEthernet 0/28
!
interface VLAN 1
ip address 192.168.1.1 255.255.255.0
!
!
line con 0
line vty 0 4
login
password star
!
!
end
L2-SW#show running-config
System software version : 1.66(8) Build Dec 22 2006 Rel
Building configuration...
Current configuration : 380 bytes
!
version 1.0
!
hostname L2-SW
vlan 1
!
!
enable secret level 1 5 $2H.Y*T73C,tZ[V/4D+S(\W&QG1X)sv'
enable secret level 15 5 $2,1u_;C3&-8U0<D4'.tj9=GQ+/7R:>H
!
interface fastEthernet 0/1
!
interface vlan 1
no shutdown
ip address 192.168.1.2 255.255.255.0
!
!
end