h3c常用命令及用法备忘(不定期更新)

目前接触得最多的是H3C的网络设备,单位从核心到接入全是。虽然都是自己配置的,但因为设备工作很稳定,业务变化也不大,所以不需要经常用,时间稍常就忘记了。有需要的时候又不得不再去查手册,这里为了帮助记忆,把常用的一些命令和用法写下来,方便再用到时查询。

先记下,今天用到的。以后再用到其它命令,再添加。


1、查MAC地址(常用场景:当遇到地址冲突后,不明设备时使用)

已知MAC查端口   dis mac-address | in

例如:我知道对方mac地址是b0-83-fe-70-0a-5b

用法:dis mac-address | in 0a5b  来获取到端口号

已知端口查MAC  disp mac-address interface

例如:想查核心交换2号板9号端口的MAC

用法:disp mac-address interface GigabitEthernet 2/0/9

2、H3C的光电复用端口切换(应用场景为:原厂默认的光电复用都是电口,现在需要用光模块做上连)

解决办法:对应端口输入命令combo enable fiber ,如果要切回电口为combo enable copper    by 2017-08-31

3、H3C路由器的策略路由配置

例:

配置静态路由,保证三条路径都可达,并且缺省下一跳为 10.4.1.2。
[Device] ip route-static 192.168.1.0 24 10.3.1.2
[Device] ip route-static 192.168.1.0 24 10.4.1.2 preference 40
[Device] ip route-static 192.168.1.0 24 10.5.1.2
定义访问控制列表 ACL 3005,用于匹配源 IP 地址为 10.2.1.1 的报文。
[Device] acl number 3005
[Device-acl-adv-3005] rule 0 permit ip source 10.2.1.1 0
[Device-acl-adv-3005] quit
定义访问控制列表 ACL 3006,用于匹配 HTTP 报文。
[Device] acl number 3006
[Device-acl-adv-3006] rule 0 permit tcp destination-port eq www
[Device-acl-adv-3006] quit
创建策略路由 pbr1 的 0 号节点,将匹配 ACL 3005 的报文下一跳重定向到 10.5.1.2。
[Device] policy-based-route pbr1 permit node 0
[Device-pbr-pbr1-0] if-match acl 3005
[Device-pbr-pbr1-0] apply next-hop 10.5.1.2
[Device-pbr-pbr1-0] quit
创建策略路由 pbr1 的 1 号节点,将匹配 ACL 3006 的报文下一跳重定向到 10.3.1.2。
[Device] policy-based-route pbr1 permit node 1
[Device-pbr-pbr1-1] if-match acl 3006

[Device-pbr-pbr1-1] apply next-hop 10.3.1.2
[Device-pbr-pbr1-1] quit
在 Device 的接口 GigabitEthernet 2/0/0 上应用策略。
[Device] interface gigabitethernet 2/0/0
[Device-GigabitEthernet2/0/0] ip policy-based-route pbr1

by 2021-11-13

4、H3C批量加VLAN

[H3C]vlan 88
[H3C-vlan88]port GigabitEthernet 1/0/1 to GigabitEthernet 1/0/10
[H3C-vlan88]save
by 2022-06-21

未经允许不得转载:生于七零年代 » h3c常用命令及用法备忘(不定期更新)

赞 (0) 打赏

评论

3+3=

觉得文章有用就打赏一下文章作者

微信扫一扫打赏