! 设置主机名
hostname SW1
! 禁用IP域名查找,加快命令执行速度
no ip domain-lookup
! 配置密码和登录设置
enable secret <your_enable_password>
username <your_username> secret <your_user_password>
line vty 0 15
login local
transport input ssh
line console 0
logging synchronous
login local
exec-timeout 10 0
! 生成SSH密钥,启用SSH
crypto key generate rsa general-keys modulus 2048
ip ssh version 2
! 配置SNMP
snmp-server community <your_snmp_community> RO
snmp-server location <your_location>
snmp-server contact <your_contact_info>
! 配置管理VLAN
vlan 99
name Management_VLAN
interface Vlan99
ip address <your_management_ip> <your_management_subnet_mask>
no shutdown
! 配置交换机端口
interface range GigabitEthernet0/1-48
switchport mode access
switchport access vlan <your_access_vlan>
spanning-tree portfast
spanning-tree bpduguard enable
! 配置上行链路端口
interface range GigabitEthernet0/49-52
switchport mode trunk
switchport trunk allowed vlan <your_allowed_vlans>
! 配置NTP
ntp server <your_ntp_server_address>
! 保存配置
wr