# 进入系统视图
system-view
# 配置设备名称
sysname Ruijie-Switch
# 配置管理IP地址(VLAN1作为管理VLAN示例)
interface Vlan-interface 1
ip address 192.168.1.1 255.255.255.0
undo shutdown
quit
# 设置默认网关
ip route-static 0.0.0.0 0.0.0.0 192.168.1.254
# 配置登录认证
user-interface vty 0 4
authentication-mode scheme
protocol inbound telnet ssh
quit
# 创建AAA认证方案
aaa
local-user admin password cipher Ruijie@12345
local-user admin service-type telnet ssh http
local-user admin level 3
quit
# 配置时间同步
ntp-service enable
ntp-service unicast-server 192.168.1.100
# 配置SSH服务
public-key local create rsa
ssh server enable
ssh user admin service-type all authentication-type password
# 创建VLAN并命名
vlan batch 10 20 30
vlan 10
name IT-Department
quit
vlan 20
name HR-Department
quit
vlan 30
name Marketing-Department
quit
# 配置接口为Access模式并划分VLAN
interface GigabitEthernet 0/1
port link-type access
port access vlan 10
description IT-Workstation-01
quit
# 配置接口为Trunk模式
interface GigabitEthernet 0/24
port link-type trunk
port trunk permit vlan all
description To-Core-Switch
quit
# 配置端口安全
interface GigabitEthernet 0/1
port-security enable
port-security max-mac-count 2
port-security violation protect
quit
# 配置DHCP Snooping
dhcp snooping enable
interface GigabitEthernet 0/24
dhcp snooping trust
quit
# 配置生成树协议
stp mode rstp
stp priority 4096
# 保存配置
save