一台24口思科交换机2950,连接一台PC,PC的IP地址192.168.1.2/24,交换机默认vlan1的IP地址192.168.1.1/24,请你完成交换机的初始配置,特权密码和远程登录密码均为123456。
提交分3部分:
1、IP地址设置
2、交换机配置
3、远程登录验证测试
首先进入交换机的全局配置模式:
Switch> enable
Switch# configure terminal
然后为VLAN 1分配一个IP地址:
Switch(config)# interface vlan1
Switch(config-if)# ip address 192.168.1.1 255.255.255.0
Switch(config-if)# no shutdown
接下来,我们需要配置PC的默认网关,以便它可以与交换机通信。我们将使用刚刚分配给VLAN 1的IP地址作为默认网关:
Switch(config)# ip default-gateway 192.168.1.1
最后,我们需要确认PC的IP地址正确地配置,并且可以ping通交换机的IP地址。
为了简化配置操作,我们将使用以下命令将所有未使用的端口禁用:
Switch(config)# interface range fa0/2-24
Switch(config-if-range)# shutdown
此命令将关闭从fa0/2到fa0/24的所有端口。我们还需要启用交换机上的MDIX自动检测功能:
Switch(config)# service internal
Switch(config)# interface range fa0/1-24
Switch(config-if-range)# media-type rj45
最后,我们会将交换机的特权密码和远程登录密码设置为“123456”:
Switch(config)# enable secret 123456
Switch(config)# line vty 0 4
Switch(config-line)# password 123456
Switch(config-line)# login
Switch(config-line)# exit
3. 远程登录验证测试
我们可以使用Telnet或SSH从远程计算机连接到交换机。例如,为了测试SSH连接,我们可以在PC上打开一个命令行窗口,并使用以下命令连接到交换机:
ssh -l username 192.168.1.1
其中,“username”是你的用户名,如果你没有设置过,则默认为“admin”。输入密码“123456”后,你应该能够成功登录并访问交换机。
1、IP地址设置:
在交换机的命令行界面下,输入以下命令:
enable
configure terminal
interface vlan1
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
2、交换机配置:
在交换机的命令行界面下,输入以下命令:
enable
configure terminal
hostname Switch2950
enable secret 123456
line vty 0 4
password 123456
login
exit
3、远程登录验证测试:
使用远程登录软件(如SecureCRT、Putty等),输入交换机的IP地址192.168.1.1,端口号为默认的22,选择SSH协议,输入用户名为admin,密码为123456,即可远程登录交换机进行配置和管理。