一、實驗目標
掌握采用telnet方式配置交換機的方法
二、技術原理
- 配置交換機的管理IP地址(計算機的IP地址與交換機管理IP地址在同一網段);
- 為telnet用戶配置用戶名和登錄口令:
Switch(config)#enble password xxxx //設置進入特權模式的密碼;
Switch(config-line)#password xxxx //可以設置通過console端口連接設備及telnet遠程登錄時所需要的密碼。
Switch(config)#line console 0
Switch(config-line)#password xxxx //設置通過console端口連接設備的密碼
Switch(config-line)#login
Switch(config)#line vty 0 4
Switch(config-line)#password xxxx //設置telnet遠程登錄密碼
Switch(config-line)#login
三、實驗步驟
實驗拓撲
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
1、配置交換機的管理IP地址
Switch(config)#interface vlan 1 //默認情況下交換機所有端口都處於 vlan 1 當中
Switch(config-if)#ip address 192.168.1.1 255.255.255.0 //配置交換機管理IP地址
Switch(config-if)#no shutdown //開啟Interface Vlan1
%LINK-5-CHANGED: Interface Vlan1, changed state to up
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
Switch(config-if)#exit
2、設置進入特權模式的密碼
Switch(config)#enable password 123456 //設置進入特權模式的密碼
Switch(config)#line console ?
<0-0> First Line number
3、設置通過console端口連接設備的密碼
Switch(config)#line console 0
Switch(config-line)#password asdf //設置通過console端口連接設備的密碼
Switch(config-line)#login
Switch(config-line)#exit
Switch(config)#line vty ?
<0-15> First Line number
4、設置telnet遠程登錄密碼
Switch(config)#line vty 0 4
Switch(config-line)#password abc123 //設置telnet遠程登錄密碼
Switch(config-line)#login
Switch(config-line)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console
5、查看配置情況
Switch#show running-config
Building configuration...
Current configuration : 1064 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
enable password 123456
!
!
!
interface FastEthernet0/1
!
......
!
interface FastEthernet0/24
!
interface GigabitEthernet1/1
!
interface GigabitEthernet1/2
!
interface Vlan1
ip address 192.168.1.1 255.255.255.0
!
!
line con 0
password asdf
login
!
line vty 0 4
password abc123
login
line vty 5 15
login
!
!
end
Switch#
四、驗證
1、驗證通過console端口連接設備的密碼
Press RETURN to get started.
User Access Verification
Password: //這里輸入asdf
Switch>
2、驗證進入特權模式的密碼
Switch>en
Password: //這里輸入123456
Switch#
3、驗證telnet遠程登錄密碼
a. 給PC機設置IP地址
b. 打開Command Prompt
Packet Tracer PC Command Line 1.0
PC>ipconfig
IP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1
PC>ping 192.168.1.1
Pinging 192.168.1.1 with 32 bytes of data:
Request timed out.
Reply from 192.168.1.1: bytes=32 time=32ms TTL=255
Reply from 192.168.1.1: bytes=32 time=32ms TTL=255
Reply from 192.168.1.1: bytes=32 time=31ms TTL=255
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 31ms, Maximum = 32ms, Average = 31ms
PC>telnet 192.168.1.1 //遠程登錄
Trying 192.168.1.1 ...Open
User Access Verification
Password: //vty密碼
Switch>en
Password: //enable密碼
Switch#show running-config
Building configuration...
Current configuration : 1063 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
enable password 123456
!
!
!
interface FastEthernet0/1
!
......
interface FastEthernet0/24
!
interface GigabitEthernet1/1
!
interface GigabitEthernet1/2
!
interface Vlan1
ip address 192.168.1.1 255.255.255.0
!
!
line con 0
password asdf
login
!
line vty 0 4
password abc123
login
line vty 5 15
login
!
!
end
Switch#