锐捷交换机常用命令

发布于:2024-09-18 ⋅ 阅读:(13) ⋅ 点赞:(0)

1. 基本操作命令

进入特权模式:enable
进入全局配置模式:configure terminal
保存配置:write memory 或者 copy running-config startup-config
查看当前配置:show running-config
查看启动配置:show startup-config
重启交换机:reload
删除配置文件(交换机及1700系列路由器): del flash:config.text 
删除配置文件(2500系列路由器):erase startup-config 

2. 接口配置

进入接口配置模式:interface [接口名]
例如:interface GigabitEthernet0/1
配置接口IP地址:ip address [IP地址] [子网掩码]
例如:ip address 192.168.1.1 255.255.255.0
启用接口:no shutdown
禁用接口:shutdown

3. VLAN配置

创建VLAN:vlan [VLAN ID]
例如:vlan 10
为接口分配VLAN:interface [接口名]
switchport mode access
switchport access vlan [VLAN ID]

例如:interface GigabitEthernet0/1
switchport mode access
switchport access vlan 10

配置Trunk接口:interface [接口名]
switchport mode trunk
switchport trunk allowed vlan [VLAN列表]

例如:interface GigabitEthernet0/1
switchport mode trunk
switchport trunk allowed vlan 10,20,30

4. 链路聚合

创建链路聚合组:interface port-channel [组号]
例如:interface port-channel 1

将接口加入链路聚合组:interface [接口名]
channel-group [组号] mode [模式]

例如:interface GigabitEthernet0/1
channel-group 1 mode active

5. 生成树协议

启用生成树协议:spanning-tree
查看生成树状态:show spanning-tree

6. 端口安全

启用端口安全:interface [接口名]
switchport port-security
例如:interface GigabitEthernet0/1
switchport port-security

配置最大MAC地址数量:switchport port-security maximum [数量]
例如:switchport port-security maximum 1

配置静态MAC地址:switchport port-security mac-address [MAC地址]
例如:switchport port-security mac-address 00E0.4C68.0001

查看端口安全状态:show port-security interface [接口名]
例如:show port-security interface GigabitEthernet0/1

7. 常用查看命令

查看接口状态:show interface [接口名]
例如:show interface GigabitEthernet0/1
查看ARP表:show arp
查看MAC地址表:show mac address-table

在这里插入图片描述

8. 系统管理

配置交换机名称:hostname [名称]
例如:hostname Switch1

配置登录密码:enable secret [密码]
例如:enable secret mypassword

9. 配置端口镜像

monitor session [会话号] destination interface [镜像端口号]
monitor session [会话号] source interface [被镜像端口号] both

10. 配置生成树协议

spanning-tree [模式]
spanning-tree priority [优先级]