一:华为交换机
1、创建vlan
<Quidway>
//用户视图,也就是在Quidway模式下运行命令
<Quidway>system-view
//进入配置视图
[Quidway] vlan 10
//创建vlan 10并进入vlan10配置视图,如果vlan10存在就直接进入vlan10配置视图
[Quidway-vlan10] quit
//回到配置视图
2、将端口加入到vlan
[Quidway] interface GigabitEthernet2/0/1
//进入端口
[Quidway- GigabitEthernet2/0/1] port link-type access
//定义端口传输模式
[Quidway- GigabitEthernet2/0/1] port default vlan 100
//将端口加入vlan100
[Quidway- GigabitEthernet2/0/1] quit
//回到配置视图
3、将多个端口加入到vlan
<Quidway>system-view
[Quidway]vlan 10
[Quidway-vlan10]port GigabitEthernet 1/0/0 to 1/0/29
//将0到29号端口加入到vlan10中
[Quidway-vlan10]quit
4、交换机配置ip地址
[Quidway] interface Vlanif100
// 进入vlan100接口视图与vlan 100命令进入的地方不同
[Quidway-Vlanif100] ip address 119.167.200.90 255.255.255.252
// 定义vlan100管理IP三层交换网关路由
[Quidway-Vlanif100] quit
//返回视图
5、配置默认网关
[Quidway]ip route-static 0.0.0.0 0.0.0.0 119.167.200.89
//配置默认网关
6、交换机保存配置和重置命令
<Quidway>save
//保存配置信息
<Quidway>reset saved-configuration
//重置交换机的配置
<Quidway>reboot
//重新启动交换机
7、交换机常用的显示命令
<Quidway>display current-configuration
//显示现在交换机正在运行的配置明细
<Quidway>display device
//显示各设备状态
<Quidway>display interface ?
//显示个端口状态,用?可以查看后边跟的选项
<Quidway>display version
//查看交换机固件版本信息
<Quidway>display vlan ?
// 查看vlan的配置信息
8、恢复交换机出场设置
<Quidway>reset saved-configuration
//重置交换机的配置
二:H3C交换机
1、基本配置
<H3C>
//用户直行模式提示符,用户视图
<H3C>system-view
//进入配置视图
[H3C] sysname xxx
//设置主机名成为xxx,这里使用修改特权用户密码
2、用户配置
<H3C>system-view
//进入配置视图
[H3C]super password H3C
//设置用户分级密码
[H3C]undo superpassword
//删除用户分级密码
[H3C]localuser bigheap 1234561
//Web网管用户设置,1为管理级用户
[H3C]undo localuser bigheap
//删除Web网管用户
[H3C]user-interface aux 0
//只支持0
[H3C-Aux]idle-timeout 250
//设置超时为2分50秒,若为0则表示不超时,默认为5分钟
[H3C-Aux]undoidle-timeout
//恢复默认值
[H3C]user-interface vty 0
//只支持0和1
[H3C-vty]idle-timeout 250
//设置超时为2分50秒,若为0则表示不超时,默认为5分钟
[H3C-vty]undoidle-timeout
//恢复默认值
[H3-C-vty]set authentication password123456
//设置telnet密码,必须设置
[H3C-vty]undo set authenticationpassword
//取消密码
[H3C]displayusers
//显示用户
[H3C]displayuser-interface
//用户界面状态
3、vlan配置
[H3C]vlan 2
//创建vlan2
[H3C]undo vlanall
//删除除缺省VLAN外的所有VLAN,缺省VLAN不能被删除
[H3C-vlan2]port Ethernet 0/4 to Ethernet0/7
//将4到7号端口加入到VLAN2中,此命令只能用来加access端口,不能用来增加trunk或者hybrid端口
[H3C-vlan2]port-isolate enable
//打开VLAN内端口隔离特性,不能二层转发,默认不启用该功能
[H3C-Ethernet0/4]port-isolate uplink-portvlan 2
//设置4为VLAN2的隔离上行端口,用于转发二层数据,只能配置一个上行端口,若为trunk,则建议允许所有VLAN通过,隔离不能与汇聚同时配置
[H3C]display vlan all
//显示所有VLAN的详细信息
[H3C]user-group 20
//创建user-group 20,默认只存在user-group 1
[H3C-UserGroup20]port Ethernet 0/4 toEthernet 0/7
//将4到7号端口加入到VLAN20中,初始时都属于user-group 1中
[H3C]display user-group 20
//显示user-group 20的相关信息
4、交换机ip配置
[H3C]vlan 20
[H3C]management-vlan 20
[H3C]interface vlan-interface 20
[H3C]undo interface vlan-interface 20
[H3C-Vlan-interface20]ip address192.168.1.2 255.255.255.0
[H3C-Vlan-interface20]undo ipaddress
[H3C-Vlan-interface20]ip gateway 192.168.1.1
[H3C-Vlan-interface20]undo ip gateway
[H3C-Vlan-interface20]shutdown
[H3C-Vlan-interface20]undo shutdown
[H3C]display ip
[H3C]display interface vlan-interface20
<H3C>debugging ip
<H3C>undo debugging ip
5、dhcp客户端配置
[H3C-Vlan-interface20]ip address dhcp-alloc
[H3C-Vlan-interface20]undo ip address dhcp-alloc
[H3C]display dhcp
<H3C>debugging dhcp-alloc
<H3C>undo debugging dhcp-alloc
6、端口配置
[H3C]interface Ethernet0/3
[H3C-Ethernet0/3]shutdown
[H3C-Ethernet0/3]speed 100
[H3C-Ethernet0/3]duplexfull
[H3C-Ethernet0/3]flow-control
[H3C-Ethernet0/3]broadcast-suppression 20
[H3C-Ethernet0/3]loopback internal
[H3C-Ethernet0/3]port link-type trunk
[H3C-Ethernet0/3]port trunk pvid vlan 20
[H3C-Ethernet0/3]port access vlan 20
[H3C-Ethernet0/3]port trunk permit vlanall
[H3C-Ethernet0/3]mdiauto
[H3C]link-aggregation Ethernet 0/1 toEthernet 0/4
[H3C]undo link-aggregation Ethernet 0/1
[H3C]link-aggregation mode egress
[H3C]monitor-port Ethernet 0/2
[H3C]mirroring-port Ethernet 0/3 toEthernet 0/4 both
[H3C]display mirror
[H3C]display interface Ethernet 0/3
<H3C>resetcounters
[H3C]display link-aggregation Ethernet0/3
[H3C-Ethernet0/3]virtual-cable-test
7、qos优先级配置
[H3C-Ethernet0/3]priority 7
[H3C]priority-trustcos
[H3C]queue-scheduler hq-wrr 2 4 6 8
[H3C-Ethernet0/3]line-rate inbound 29
[H3C]displayqueue-scheduler
[H3C]displaypriority-trust