导读 第一次在设备机房对交换机进行了初次配置后,你希望以后在办公室或出差时也可以对设备进行远程管理。现要在交换机上做适当配置。
技术原理

配置交换机的管理 IP 地址(计算机的 IP 地址与交换机管理 IP 地址在同一个网段):
为 telnet 用户配置用户名和登录口令:
交换机、路由器中有很多密码,设置对这些密码可以有效的提高设备的安全性。

switch(config)# enable password ****** 设置进入特权模式的密码
switch(config-line)可以设置通过 console 端口连接设备及 Telnet 远程登录时所
需的密码;
switch(config)# line console 0
switch(config-line)# password jaking
switch(config-line)# login
switch(config)# line vty 0 4
switch(config-line)# password jaking
switch(config-line)# login
实验步骤

新建 Packet Tracer 拓扑图

配置交换机管理 ip 地址
Switch(config)# int vlan 1
Switch(config-if)# ip address **IP** **submask***

配置用户登录密码
Switch(config)# enable password ******* 设置进入特权模式的密码
Switch(config)# line vty 0 4
Switch(config-line)# password jaking
Switch(config-line)# login
实验设备

Switch_2960 1 台;PC 1 台;直连线;配置线
PC
192.168.1.2
255.255.255.0
192.168.1.1

PC 终端
en
conf t
inter vlan 1(默认交换机的所有端口都在 VLAN1 中)
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
enable password 123456
line vty 0 4 #line vty 0 4 是指进入Line 模式对vty 0~4线路进行配置
password jaking
login
end
show run

PC CMD
ping 192.168.1.1
telnet 192.168.1.1
password:jaking
enable
password:123456
show run
实战演练
S1>en
S1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#hostname Switch
Switch(config)#exit
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show vlan

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig1/1, Gig1/2
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 0 0
1003 tr 101003 1500 - - - - - 0 0
1004 fdnet 101004 1500 - - - ieee - 0 0
1005 trnet 101005 1500 - - - ibm - 0 0

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type Ports
------- --------- ----------------- ------------------------------------------
Switch#
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#inter vlan 1
Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)#no shutdown

Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up

Switch(config-if)#exit
Switch(config)#en password 123456
% Ambiguous command: "en password 123456"
Switch(config)#enable password 123456
Switch(config)#line vty 0 4
Switch(config-line)#password jaking
Switch(config-line)#login
Switch(config-line)#
Switch(config-line)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show run
Building configuration...

Current configuration : 1132 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
!
no ip domain-lookup
!
spanning-tree mode pvst
!
interface FastEthernet0/1
duplex full
speed 100
!
interface FastEthernet0/2
!

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=5ms TTL=255
Reply from 192.168.1.1: bytes=32 time=4ms TTL=255
Reply from 192.168.1.1: bytes=32 time=6ms 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 = 4ms, Maximum = 6ms, Average = 5ms

PC>ping 192.168.1.1

Pinging 192.168.1.1 with 32 bytes of data:

Reply from 192.168.1.1: bytes=32 time=7ms TTL=255
Reply from 192.168.1.1: bytes=32 time=7ms TTL=255
Reply from 192.168.1.1: bytes=32 time=6ms TTL=255
Reply from 192.168.1.1: bytes=32 time=7ms TTL=255

Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 6ms, Maximum = 7ms, Average = 6ms

PC>telnet 192.168.1.1
Trying 192.168.1.1 ...Open


User Access Verification

Password:
Switch>
Switch>
Switch>enable
Password:
Switch#show run
Building configuration...

Current configuration : 1132 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
!
no ip domain-lookup
!
spanning-tree mode pvst
!
interface FastEthernet0/1
duplex full
speed 100
!
interface FastEthernet0/2
--More--

本文原创地址://gulass.cn/telnet-configuration-switch.html编辑:public,审核员:逄增宝