enable
configure terminal
# 配置主机名
hostname Switch9500
# 配置管理VLAN接口
interface Vlan1
ip address 192.168.1.2 255.255.255.0
no shutdown
# 配置SSH访问
username admin privilege 15 secret YourStrongPassword
ip domain-name yourdomain.com
crypto key generate rsa general-keys modulus 2048
line vty 0 15
transport input ssh
login local
exit
# 配置管理接口
interface GigabitEthernet0
description Management Interface
ip address 192.168.1.1 255.255.255.0
no shutdown
# 配置NTP服务器
ntp server pool.ntp.org
# 配置时间区域
clock timezone PST -8
# 配置默认路由
ip route 0.0.0.0 0.0.0.0 192.168.1.254
# 配置SNMP
snmp-server community YourSNMPCommunity RO
snmp-server host 192.168.1.10 YourSNMPCommunity
# 配置日志
logging host 192.168.1.20
logging trap informational
# 配置VLANs
vlan 10
name Data_VLAN
vlan 20
name Voice_VLAN
# 配置接口
interface range GigabitEthernet1/0/1 – 24
switchport mode access
switchport access vlan 10
spanning-tree portfast
spanning-tree bpduguard enable
# 配置Trunk接口
interface GigabitEthernet1/0/25
switchport mode trunk
switchport trunk allowed vlan all
# 保存配置
end
write memory