华三交换机基本配置命令
华三交换机
欧阳娜娜基本配置
⼀、⽤户配置
三、VLAN配置
四、交换机IP配置<H3C > //⽤户直⾏模式提⽰符,⽤户视图 <H3C >system-view //进⼊配置视图 [H3C ] sysname xxx //设置主机名成为xxx 这⾥使⽤修改特权⽤户密码
1
2
3
4
5
6<H3C >system-view [H3C ]super passwordH3C //设置⽤户分级密码[H3C ]undo superpassword //删除⽤户分级密码[H3C ]localuser bigheap 1234561 //Web ⽹管⽤户设置,1(缺省)为管理级⽤户,缺省admin,admin [H3C ]undo localuserbigheap //删除Web ⽹管⽤户[H3C ]user-interface aux0 //只⽀持0[H3C-Aux ]idle-timeout 250 //设置超时为2分50秒,若为0则表⽰不超时,默认为5分钟[H3C-Aux ]undoidle-timeout //恢复默认值[H3C ]user-interface vty0 //只⽀持0和1[H3C-vty ]idle-timeout 250 //设置超时为2分50秒,若为0则表⽰不超时,默认为5分钟[H3C-vty ]undoidle-timeout //恢复默认值[H3C-vty ]set authentication password123456 //设置telnet 密码,必须设置[H3C-vty ]undo set authenticationpassword //取消密码[H3C ]displayusers //显⽰⽤户[H3C ]displayuser-interface //⽤户界⾯状态
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1718[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-isolateenable //打开VLAN 内端⼝隔离特性,不能⼆层转发,默认不启⽤该功能[H3C-Ethernet0/4]port-isolate uplink-portvlan 2 //设置4为VLAN2的隔离上⾏端⼝,⽤于转发⼆层数据,只能配置⼀个上⾏端⼝,若为trunk,则建议允许所有VLA
[H3C ]display vlanall //显⽰所有VLAN 的详细信息 S1550E ⽀持基于端⼝的VLAN,通过创建不同的user-group 来实现,⼀个端⼝可以属于多个user-group,不属于同⼀个user-group 的端⼝不能互相通信[H3C ]user-group20 //创建user-group 20,默认只存在user-group 1[H3C-UserGroup20]port Ethernet 0/4 toEthernet 0/7 //将4到7号端⼝加⼊到VLAN20中,初始时都属于user-group 1中[H3C ]display user-group20 //显⽰user-group 20的相关信息1
2
3
4
5
6
7
8
9
10
11
12
13
14
五、DHCP客户端配置
六、端⼝配置[H3C ]vlan 20 //创建vlan [H3C ]management-vlan 20 //管理vlan [H3C ]in
terface vlan-interface20 //进⼊并管理vlan20[H3C ]undo interface vlan-interface20 //删除管理VLAN 接⼝[H3C-Vlan-interface20]ip address192.168.1.2 255.255.255.0 //配置管理VLAN 接⼝静态IP 地址(缺省为192.168.0.234)[H3C-Vlan-interface20]undo ipaddress //删除IP 地址[H3C-Vlan-interface20]ip gateway192.168.1.1 //指定缺省⽹关(默认⽆⽹关地址)[H3C-Vlan-interface20]undo ip gateway [H3C-Vlan-interface20]shutdown //关闭接⼝[H3C-Vlan-interface20]undoshutdown //开启[H3C ]display ip //显⽰管理VLAN 接⼝IP 的相关信息[H3C ]display interface vlan-interface20 //查看管理VLAN 的接⼝信息<H3C >debuggingip //开启IP 调试功能<H3C >undo debugging ip
1
2
3
4
5
6
7
8
9
杨丽萍无缘春晚10
11
12
13
14
15
16
17
18
19[H3C-Vlan-interface20]ip addressdhcp-alloc // 管理VLAN 接⼝通过DHCP ⽅式获取IP 地址[H3C-Vlan-interface20]undo ip addressdhcp-alloc // 取消[H3C ]display dhcp //显⽰DHCP 客户信息<H3C >debuggingdhcp-alloc //开启DHCP 调试功能<H3C >undo debugging dhcp-alloc
1
2
3
4
5
七、集配置
⼋、QOS优先级配置
周雨彤个人资料九、系统管理[H3C ]interface Ethernet0/3 //进⼊端⼝[H3C-Ethernet0/3]shutdown //关闭
端⼝[H3C-Ethernet0/3]speed100 //速率可为10,100,1000和auto (缺省)[H3C-Ethernet0/3]duplexfull //双⼯,可为half,full 和auto (缺省) 光⼝和汇聚后不能配置[H3C-Ethernet0/3]flow-control //开启流控,默认为关闭[H3C-Ethernet0/3]broadcast-suppression20 //设置抑制⼴播百分⽐为20%,可取5,10,20,100,缺省为100,同时组播和未知单播也受此影响[H3C-Ethernet0/3]loopbackinternal //内环测试[H3C-Ethernet0/3]loopbackexternal //外环测试,需插接⾃环头,必须为全双⼯或者⾃协商模式[H3C-Ethernet0/3]port link-typetrunk //设置链路的类型为trunk,可为access (缺省),trunk [H3C-Ethernet0/3]port trunk pvid vlan20 //设置20为该trunk 的缺省VLAN,默认为1(trunk 线路两端的PVID 必须⼀致)[H3C-Ethernet0/3]port access vlan20 //将当前access 端⼝加⼊指定的VLAN [H3C-Ethernet0/3]port trunk permit vlanall //允许所有的VLAN 通过当前的trunk 端⼝,可多次使⽤该命令[H3C-Ethernet0/3]mdiauto //设置以太端⼝为⾃动监测,normal (缺省)为直通线,across 为交叉线 [H3C ]link-aggregation Ethernet 0/1 toEthernet 0/4 //将1-4⼝加⼊汇聚组,1为主端⼝,两端需要同时配置,设置了端⼝镜像以及端⼝隔离的端⼝⽆法汇聚[H3C ]undo link-aggregation Ethernet0/1 //删除该汇聚组[H3C ]link-aggregation modeegress //配置端⼝汇聚模式为根据⽬的MAC 地址进⾏负荷分担,可选为 ingress,egress 和both,缺省为both [H3C ]monitor-port Ethernet0/2 //将该端⼝设置为镜像端⼝,必须先设置镜像端⼝,删除时必须先删除被镜像端⼝,⽽且它们不能同在⼀个端⼝,该端⼝不能在汇聚组中,设置新镜像端⼝时,新取代旧,被[H3C ]mirroring-port Ethernet 0/3 toEthernet 0/4 both //将端⼝3和4设置为被镜像端⼝,both 为同时监控接收和发送的报⽂,inbound 表⽰仅监控接收的报⽂,o
[H3C ]display mirror [H3C ]display interface Ethernet 0/3<H3C >resetcounters //清除所有端⼝的统计信息[H3C ]display link-aggregation Ethernet0/3 //显⽰端⼝汇聚信息[H3C-Ethernet0/3]virtual-cable-test //诊断该端⼝的电路状况1
2
3
4
5
6
7
8
9
10
热干面的做法11
12
13
14
15
16
17
18
19
20
21
22
搬家公司推荐23
24
25
26
27
28
29
30
31
32
33
34
35 S2100只能作为成员交换机加⼊集中,加⼊后系统名改为"集名_成员编号.原系统名"的格式. 即插即⽤功能通过两个功能实现: 集管理协议MAC 组播地址协商和管理VLAN 协商[H3C ]cluster enable //启⽤集功能,缺省为启⽤[H3C ]cluster //进⼊集视图[H3C-cluster ]administrator-address H-H-Hname switch H-H-H 为命令交换机的MAC ,加⼊switch 集[switch_1.H3C-cluster ]undoadministrator-address //退出集[H3C ]displaycluster //显⽰集信息[H3C ]management-vlan2 //集报⽂只能在管理VLAN 中转发,同⼀集需在同⼀个管理VLAN 中,需在建⽴集之前指定管理VLAN
1
2
3
4
5
6
7
8 QoS 配置步骤:设置端⼝的优先级,设置交换机信任报⽂的优先级⽅式,队列调度,端⼝限速[H3C-Ethernet0/3]priority7 //设置端⼝优先级为7,默认为0[H3C ]priority-trustcos //设置交换机信任报⽂的优先级⽅式为cos (802.1p 优先级,缺省值),还可以设为dscp ⽅式(dscp 优先级⽅式)[H3C ]queue-scheduler hq-wrr 2 4 68 //设置队列调度算法为HQ-WRR (默认为WRR ),权重为2,4,6,8[H3C-Ethernet0/3]line-rate inbound29 //将端⼝进⼝速率限制为2Mbps,取1-28时,速率为rate*8*1024/125,即64,1.792M ;29-127时,速率为[H3C ]displayqueue-scheduler //显⽰队列调度模式及参数[H3C ]displaypriority-trust //显⽰优先级信任模式
1
2
3
4
5
6
kszx.fsjy7
8
⼆、H3C交换机vlan配置案例
部门A使⽤VLAN 100,部门B使⽤VLAN 200。
部门A的终端⽤户使⽤192.168.1.0/24 IP⽹段,各终端⽤户配置的⽹关地址为192.168.1.1;
部门B的终端⽤户使⽤192.168.2.0/24 IP⽹段,各终端⽤户配置的⽹关地址为192.168.2.1;
配置步骤
1、配置Device A
创建VLAN 100,并将GigabitEthernet 1/0/1加⼊VLAN 100。
创建Vlan-interface 100,并配置其IP地址为192.168.1.1/24。
创建VLAN 200,并将GigabitEthernet 1/0/2加⼊VLAN 200。
创建Vlan-interface 200,并配置其IP地址为192.168.2.2/24。[H3C ]mac-address blackhole H-H-H vlan1 //在VLAN1中添加⿊洞MAC [H3C ]mac-address static H-H-H interfaceEthernet 0/1 vlan 1 //在VLAN1中添加端⼝⼀的⼀个mac [H3C ]mac-address timer aging500 //设置MAC 地址表的⽼化时间为500s [H3C ]display mac-address [H3C ]display arp [H3C ]mac-address port-binding H-H-Hinterface Ethernet 0/1 vlan 1 配置端⼝邦定[H3C ]display mac-address port-binding [H3C ]display saved-configuration [H3C ]display current-configuration <H3C >save [H3C ]restoredefault //恢复交换机出⼚默认配置,恢复后需重启才能⽣效[H3C ]display version <H3C >reboot [H3C ]display device [H3C ]sysname bigheap [H3C ]info-centerenable //启⽤系统⽇志功能,缺省情况下启⽤[H3C ]info-center loghost ip192.168.0.3 //向指定⽇志主机(只能为UNIX 或LINUX,不能为Windows )输出信息,需先开启⽇志功能,缺省关闭[H3C ]info-center loghost level8 //设置系统⽇志级别为8,默认为5.级别说明:1.emergencies 2.s 5.ifications 7.informati
<H3C >terminaldebugging //启⽤控制台对调试信息的显⽰,缺省控制台为禁⽤<H3C >terminallogging //启⽤控制台对⽇志信息的显⽰,缺省控制台为启⽤<H3C >terminaltrapping //启⽤控制台对告警信息的显⽰,缺省控制台为启⽤[H3C ]displayinfo-center //显⽰系统⽇志的
配置和缓冲区记录的信息[H3C ]displaylogbuffer //显⽰⽇志缓冲区最近记录的指定数⽬的⽇志信息[H3C ]displaytrapbuffer //显⽰告警缓冲区最近记录的指定数⽬的⽇志信息<H3C >resetlogbuffer //清除⽇志缓冲区的信息<H3C >resettrapbuffer //清除告警缓冲区的信息1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26<DeviceA > system-view [DeviceA ] vlan 100[DeviceA-vlan100] port gigabitethernet 1/0/1[DeviceA-vlan100] quit
1
2
3
4[DeviceA ] interface Vlan-interface 100[DeviceA-Vlan-interface100] ip address 192.168.1.1 24[DeviceA-Vlan-interface100] quit
1
2
3[DeviceA ] vlan 200[DeviceA-vlan200] port gigabitethernet 1/0/2[DeviceA-vlan200] quit
1
2
3[DeviceA ] interface Vlan-interface 200[DeviceA-Vlan-interface200] ip address 192.168.2.2 24[DeviceA-Vlan-interface200] quit
1
2
3
为了使Device A上VLAN 100和VLAN 200的报⽂能发送给Device B,将GigabitEthernet 1/0/3的链路类型配置为Trunk,并允许VLAN 100和VLAN 200的报⽂通过,取消允许VLAN 1通过。
2、配置Device B
创建VLAN 100,并将GigabitEthernet 1/0/1加⼊VLAN 100。
创建Vlan-interface 100,并配置其IP地址为192.168.1.2/24。
创建VLAN 200,并将GigabitEthernet 1/0/2加⼊VLAN 200。
创建Vlan-interface 200,并配置其IP地址为192.168.2.1/24。
为了使Device A上VLAN 100和VLAN 200的报⽂能发送给Device B,将GigabitEthernet 1/0/3的链路类型配置为Trunk,并允许VLAN 100和VLAN 200的报⽂通过,取消允许VLAN 1通过。
3、验证配置
(1)通过display vlan命令查看显⽰信息验证配置是否成功,以查看Device A上VLAN 100和VLAN 200的配置信息为例。[DeviceA ] interface gigabitethernet 1/0/3[DeviceA-GigabitEthernet1/0/3] port link-type trunk [DeviceA-GigabitEthernet1/0/3] port trunk permit vlan 100 200[DeviceA-GigabitEthernet1/0/3] undo port trunk permit vlan 1[DeviceA-GigabitEthernet1/0/3] quit
1
23
4
5<DeviceB > system-view [DeviceB ] vlan 100[DeviceB-vlan100] port gigabitethernet 1/0/1[DeviceB-vlan100] quit
1
2
3
4[DeviceB ] interface Vlan-interface 100[DeviceB-Vlan-interface100] ip address 192.168.1.2 24[DeviceB-Vlan-interface100] quit
1
2
3[DeviceB ] vlan 200[DeviceB-vlan200] port gigabitethernet 1/0/2[DeviceB-vlan200] quit
1
2
3[DeviceB ] interface Vlan-interface 200[DeviceB-Vlan-interface200] ip address 192.168.2.1 24[DeviceB-Vlan-interface200] quit
1
2
3[DeviceB ] interface gigabitethernet 1/0/3[DeviceB-GigabitEthernet1/0/3] port link-type trunk [DeviceB-GigabitEthernet1/0/3] port trunk permit vlan 100 200[DeviceB-GigabitEthernet1/0/3] undo port trunk permit vlan 1[DeviceB-GigabitEthernet1/0/3] quit
1
2
3
4
5
发布评论