当前位置:网站首页 > 网络设备调试 正文 网络设备调试

思科交换机的基本配置2

南京泽同信息 2025-11-21 23:34:18 网络设备调试 36 ℃ 0 评论

#交换机的基本配置#

#任务二交换机的基本模式#

   

#1给交换机命名为Switch-A

switch>                         !用户模式

switch>enable               !特权模式

switch#config t              !全局配置模式

switch(config)#hostname  Switch-A   !配置主机名

#2设置系统时间应在交换机的特权模式下设置2024.8.5 16:00:00

Switch-A#clock set ?       !不清楚命令格式或参数要求时,可以输入?命令查看

hh:mm:ss   Current Time  !系统提示命令的格式及参数要求

Switch-A#Clock set 16:00:00 5 Aug 2024 !配置系统时间为当前时间

#3配置控制台密码

Switch-A>en

Switch-A#conf t

Switch-A(config)# line console 0          !进入console 0 接口线配置模式

Switch-A(config-line)#password 123    !为console 接口配置密码“123”

Switch-A(config-line)#login                  !允许通过本地登录,如果没有这条命令,则口令不生效

#4配置交换机特权密码

Switch-A>

Switch-A#conf t 

Switch-A(config)#enable password 123456    !配置交换机特权密码为“123456”

Switch-A(config)#enable secret 654321         !配置特权密码为“654321”,以密文形式保存

#5加密所有口令

Switch-A(config)# service password-encryption   !加密系统所有口令

#6配置交换机的IP地址和默认网关

Switch-A>enable    !进入特权模式

Password:             !输入上一步配置的特权密码654321

Switch-A#conf t      !进入全局配置模式

Switch-A(config)#interface vlan 1     !进入vlan 1虚拟接口

Switch-A(config-if)#ip address 192.168.1.1 255.255.255.0   !配置交换机的IP地址为192.168.1.1

Switch-A(config-if)#no shutdown      !打开交换机vlan 1接口,IP地址生效

Switch-A(config-if)#exit                   !返回到全局配置模式

Switch-A(config)#ip default-gateway 192.168.1.254   !配置交换机的默认网关,以便与不同网段主机通信   

#7配置交换机端口双工模式和速度

Switch-A(config)#int f0/1         !进入接口配置模式

Switch-A(config-if)#duplex ?    !双工模式参数查询

auto Enable AUTO duplex configuration

full Force full duplex operation    !选择此选项,强制双工模式为全双工

half Force half-duplex operation  !选择此选项,强制双工模式为半双工

Switch-A(config-if)#duplex auto   !配置双工模式为auto ,自动协商模式

Switch-A(config-if)#speed ?

10    Force 10 Mbps operation

100  Force 100 Mbps operation

auto  Enable AUTO speed configuration

Switch-A(config-if)#speed auto   !配置速度为自动

Switch-A(config-if)#end

#8验证配置

Switch-A#show run

#9保存交换机配置

Switch-A#copy run

Switch-A#copy running-config startup-config   !复制运行配置文件到开机配置文件中

Destination filename  [startup-config]?            !按回车键保留默认目标文件名 

Building configuration…

[OK]  

你可能想看:

版权说明:如非注明,本站文章均为 ZBLOG 原创,转载请注明出处和附带本文链接

请在这里放置你的在线分享代码
Copyright Your WebSite.Some Rights Reserved.
微信咨询&联系客服
QQ:2586422870
在线时间
9:00 ~ 23:00