链路聚合:手工负载分担模式
[S 1]interface Eth-Trunk 1 //创建链路聚合组Eth-Trunk接口(1-63)
[S 1-Eth-Trunk1]mode manual load-balance //配置为手工负载分担模式(缺省)
[S 1-Eth-Trunk1]trunkport e 0/0/A to 0/0/B //将以太网接口A到B加入Eth-Trunk接口
[S 1-Eth-Trunk1]least active-linknumber 2 //设置活动接口下限,缺省下限=1
[S 1-Eth-Trunk1]max bandwidth-affected-linknumber 3 //设置活动接口下限,缺省上限=8
普通负载分担方式(6种)
[S 1-Eth-Trunk1]load-balance src-ip dst-ip src-mac dst-mac dst-dst-mac src-dst-ip(缺省)
[S 1-Eth-Trunk1]disply Eth-Trunk 1 //查看聚合组信息

链路聚合:LACP模式
[S 1-Eth-Trunk1]mode lacp-static //配置为LACP模式
[S 1-Eth-Trunk1]trunkport e 0/0/A to 0/0/B //将以太网接口A到B加入Eth-Trunk接口
[S 1-Eth-Trunk1]max active-linknumber X //设置活动接口上限
[S 1-Eth-Trunk1]least active-linknumber X //设置活动接口下限
[S 1]lacp priority 300 //设置系统优先级(缺省32768)
[S 1-Ethernet0/0/11]lacp priority 11 //设置端口优先级 (缺省32768)
[S 1-Eth-Trunk1]lacp preempt enable //激活抢占功能(缺省disable)
[S 1-Eth-Trunk1]lacp preempt delay 40 //设置抢占延时(缺省30)

STP:
[SW]stp enable //交换机上使能STP功能
[SW]stp mode stp //选择STP模式,默认情况下是MSTP
[SW]stp root primary 0//配置交换机桥ID为0,默认 32768 越小越优先,必须是4096的整数倍
[SW]display stp //查看STP信息
[SW]display stp brief //查看STP摘要信息
[SW]display stp interface e0/0/1 //查看接口的STP状态

RSTP:
[sw]stp mode rstp //选择RSTP模式
[sw]stp priority 4096 //配置交换机优先级为4096,默认 是32768
[SW-Ethernet0/0/X]stp cost [1-200000000] //配置端口开销值
[SW-Ethernet0/0/X]stp edged-port enable //配置边缘端口
[SW-Ethernet0/0/X]stp root-protection //配置根保护
[SW]stp bpdu-protection //配置BPDU保护:
[SW-Ethernet0/0/X]stp loop-protection // 环路保护

MSTP:
[SW]stp mode mstp //选择MSTP模式
[SW]stp region mstp //进入mstp配置视图
[SW-mst-region]region name rg1 //设置mstp域名为rg1
[SW-mst-region]instance 1 vlan 1 to 10 //vlan1-10跟instance1做映射
[SW-mst-region]instance 2 vlan 11 to 20 //vlan11-20跟instance2做映射
[SW-mst-region]active region-configuration //启用配置(不配置则上面几条不生效)
[SW]stp instance 1 primary //配置instance1优先级(0)
[SW]stp instance 2 second //配置instance2优先级(4096)
[SW-Ethernet0/0/X]stp instance 1 cost 2000000 //配置接口Ethernet0/0/X instance1的开销
[SW]display stp brief //查看STP摘要信息

MAC地址:
[SW]display mac-address //查看MAC地址转发表
[SW]display mac-address aging-time //查看动态MAC地址老化时间
[SW]mac-address static vlan <1-4094> //配置静态MAC地址条目
[SW]mac-address blackhole vlan <1-4094> //配置静态黑洞MAC地址
[SW]mac-address aging-time <0,10-1000000> //配置动态MAC地址老化时间
[SW-Ethernet0/0/1]mac-address learning disable //配置关闭当前端口动态学习MAC地址
[SW-Ethernet0/0/1]mac-address learning disable action <discard/forward> //配置关闭当前端口动态学习功能并禁止/开启转发数据(默认)
[SW-vlan1]mac-address learning disable //配置关闭当前vlan动态学习MAC地址功能
[SW-Ethernet0/0/1]mac-limit maximum <0-4096> //配置当前端口MAC学习数量上限
[SW-Ethernet0/0/1]mac-limit alarm <enable/disable> //配置当前端口超过MAC学习数量上限时 警告(默认)/不警告

安全动态MAC地址 和Sticky MAC地址
[SW-Ethernet0/0/1]port-security enable //配置端口学习到的MAC地址类型为security
[SW-Ethernet0/0/1]port-security max-mac-num <1-4096> //配置端口可学习到的安全动态MAC地址数量(缺省1)
[SW-Ethernet0/0/1]port-security protect-action <protect/restrict> //配置端口学到超过指定数量安全动态MAC地址后操作为丢弃/丢弃警告
[SW-Ethernet0/0/1]port-security mac-address sticky vlan <1-4094> //配置security地址为sticky MAC地址

防漂移:高优先级 和 同优先级 信任端口
[SW-Ethernet0/0/1]mac-learning priority 3 // 配置端口的优先级(范围0-3 ,缺省0,值越大越优先)
[SW]undo mac-learning priority 3 allow-flapping //SW上设置相同优先级防漂移

DHCP
1.全局DHCP:
[SW]dhcp enable //启用DHCP功能
[SW]ip pool pool_1 //配置地址池的名字为 pool_1
[SW-ip-pool-pool_1]network x.x.x.x mask X //IP地址池的范围
[SW-ip-pool-pool_1]gateway-list x.x.x.x //配置网关地址
[SW-ip-pool-pool_1]dns-list x.x.x.x(more) //配置DNS池(可多个)
[SW-ip-pool-pool_1]lease day 0 hour 0 minute 2 //配置租期
[SW-Vlanif10]dhcp select global //在VALNIF10接口选用全局地址池分配ip地址
[SW-ip-pool-pool_1]static-bind ip-address x.x.x.x mac-address H-H-H //地址保留
[SW-ip-pool-pool_1]excluded-ip-address x.x.x.x //地址排除
[SW]display current-configuration、display ip pool name pool_1 used //查看地址池使用情况
2.端口DHCP:
[SW]dhcp enable //启用DHCP功能
[SW-Vlanif10]dhcp select interface //启用vlanif10接口采用接口地址池的DHCP服务功能
[SW-Vlanif10]dhcp server dns-list x.x.x.x (MORE) //配置DNS池,可多个
[SW-Vlanif10]dhcp server lease day 0 hour 8 //配置租期
[SW-Vlanif10]dhcp server static-bind ip x.x.x.x mac-address H-H-H //地址保留
[SW-Vlanif20]excluded-ip-address x.x.x.x //地址排除
[SW]display current-configuration/ip pool interface vlanif20 used //查看地址池使用情况

3.DHCP中继
配置前提全网互通
中继上(路由器)配置:
[SW-Ethernet0/0/0]dhcp select relay //配置接口成为中继
[SW-Ethernet0/0/0]dhcp relay server-ip x.x.x.x //配置DHCP服务器IP地址

静态路由、缺省路由、黑洞路由:
[Huawei]ip route-static ip地址 子网掩码 下一跳ip地址 //配置静态路由
[Huawei]ip route-static 0.0.0.0 0 1下一条ip地址 //配置缺省路由
[Huawei]ip route-static ip地址 子网掩码 NULL 0 //配置黑洞路由
[Huawei]display ip routing-table //查看IP路由表
[Huawei]display fib //查看FIB表

RIP:
[Huawei]rip [1~65535] //全局启动RIP
[Huawei-rip-X]network 直连网段ip //指定网段使能RIP
[Huawei-rip-X]version [1~2] //全局指定RIP版本
[Huawei- Ethernet0/0/X]rip version [1~2] //接口指定RIP版本
[Huawei-rip-X]import-route rip 20 //引入RIP进程
[Huawei-rip-X]preference [1~255] //配置RIP优先级
[Huawei- Ethernet0/0/X]rip metricout/metricin [1~15] //发送/接收度量值
[Huawei- Ethernet0/0/X]rip authenticat mode simple/MD5 //rip简单认证/MD5报文认证
[Huawei- Ethernet0/0/X]rip authenticat mode MD5 nonstandard/usual //MD5非标准/标准通用报文认证
[Huawei- Ethernet0/0/X]rip split-horizon //激活水平分割(缺省)
[Huawei- Ethernet0/0/X]rip poison-reverse //激活毒性反转
[Huawei- Ethernet0/0/X]rip summary-address ip地址 子网掩码 //手动路由汇总
[Huawei–rip-X]summary always //自动路由汇总
[Huawei]display rip 1 interface Ethernet0/0/X verbose //查看接口RIP配置信息
[Huawei] display rip 1 route   //查看rip路由表