# 进入全局配置模式
enable
configure terminal
# 设置设备主机名
hostname YourSwitchName
# 配置管理接口
interface GigabitEthernet0
ip address 192.168.1.1 255.255.255.0
no shutdown
# 配置SSH访问
ip ssh version 2
ip ssh time-out 60
ip ssh authentication-retries 3
# 配置本地用户名和密码
username admin privilege 15 secret YourPassword
# 配置启用本地登录
line vty 0 15
login local
transport input ssh
# 配置NTP服务器
ntp server 0.pool.ntp.org
ntp server 1.pool.ntp.org
# 配置时区
clock timezone YourTimeZone offset YourOffset
# 配置管理VLAN(示例为VLAN management 10)
vlan 10
name Management
!
# 配置管理接口所属VLAN
interface GigabitEthernet0
switchport mode access
switchport access vlan 10
# 配置基本SNMP设置
snmp-server community YourSNMPCommunity RO
snmp-server contact YourContactInfo
snmp-server location YourLocation
# 配置日志记录
logging buffered 10000
logging console debugging
logging monitor notifications
logging trap debugging
# 配置登录提示信息
banner login ^ Welcome to YourSwitchName! ^
# 保存配置
end
write memory