命令

进入系统视图
system-view
配置主机名
[HuaWei]sysname sw1
查看系统版本
display version
查看mac地址表
display mac-address
创建VLAN
vlan
删除VLAN
undo vlan
查看VLAN
display vlan []

access类型的配置
port link-type access ——指定类型为access
port default vlan ——指定缺省vlan

trunk类型的配置
port link-type trunk ——指定类型为trunk
port trunk pvid vlan 3 ——指定缺省vlan
port trunk allow-pass vlan 5 100 ——允许哪些vlan通过,all表示所有

hybrid类型的配置
port link-type hybrid ——指定类型为hybrid
port hybrid pvid vlan 5 ——指定缺省vlan
port hybrid tagged vlan 100 101 ——指定vlan100和101数据带标签通过
port hybrid untagged vlan 10 to 12 ——指定vlan10到12数据不带标签通过

接口组配置
[Huawei]port-group ——创建并进入接口组,并命名为aaa
[Huawei-port-group-aaa]group-member ——将1口到10口加入到组aaa
[Huawei-port-group-aaa]port link-type ——将1口到10口加入到组aaa
[Huawei-port-group-aaa]port default ——将aaa组中的接口access类型指定缺省vlan为vlan10

配置gvrp
[SWA]gvrp
[SWA]interface Gigabitethernet 0/0/1
[SWA-GigabitEthernet0/0/1]port link-type trunk
[SWA-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SWA-GigabitEthernet0/0/1]gvrp
[SWA-GigabitEthernet0/0/1]gvrp registration fixed

查看gvrp配置
dis gvrp statistics 查看详细
dis gvrp status 查看gvrp是否开启

二层链路聚合配置
[SWA]interface Eth-Trunk 1
[SWA-Eth-Trunk1]interface GigabitEthernet0/0/1
[SWA-GigabitEthernet0/0/1]eth-trunk 1
[SWA-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2
[SWA-GigabitEthernet0/0/2]eth-trunk 1

三层链路聚合配置
[RTA]interface eth-trunk 1
[RTA-Eth-Trunk1]undo portswitch
[RTA-Eth-Trunk1]ip address 100.1.1.1 24
[RTA-Eth-Trunk1]quit
[RTA]interface GigabitEthernet 0/0/1
[RTA-GigabitEthernet0/0/1]eth-trunk 1
[RTA-GigabitEthernet0/0/1]quit
[RTA]interface GigabitEthernet0/0/2
[RTA-GigabitEthernet0/0/2]eth-trunk 1
[RTA-GigabitEthernet0/0/2]quit

查看链路聚合信息
display interface eth-trunk 1

MSTP配置命令
[SWA]stp enable ——启用stp
[SWA]stp mode mstp ——选择mstp模式
[SWA]stp region-configuration ——进入域视图
[SWA-mst-region]region-name RegionA ——给域起名
[SWA-mst-region]instance 1 vlan 2 ——实例1负责vlan2
[SWA-mst-region]instance 2 vlan 3 ——实例2负责vlan3
[SWA-mst-region]active region-configuration ——激活域
[SWA-mst-region]quit
[SWA]stp instance 1 priority 4096 ——本交互在实例1中的优先级
[SWA]stp instance 2 priority 8192 ——本交互在实例2中的优先级

查看MSTP
display stp brief

配置vrrp备份组
vrrp vrid <组号> virtual-ip ——创建VRRP备份组并配置虚拟IP
vrrp vrid <组号> priority ——配置本路由vrrp优先级
vrrp vrid <组号> preempt-mode timer delay<抢占延迟时间> ——配置抢占时间,默认0秒
vrrp vrid <组号> timer advertise <值> ——配置报文间隔时间

端口跟踪配置
vrrp vrid <组号> track <接口> reduced <减低的值>

查看详细信息
display vrrp verbose

基本acl配置
acl 2000 ——创建编号为2000的acl
rule 5 permit source 192.168.1.1 0.0.0.0 ——允许源IP为192.168.1.1的数据包通过
rule 10 deny source 192.168.1.0 0.0.0.255 ——拒绝源IP为192.168.1.1的数据包通过

应用acl规则
traffic-filter acl 2000
例如:traffic-filter inbound acl 3000

高级acl配置
acl number 3102 ——创建编号为3102的acl
rule permit source <202.39.2.3 0> destination <129.38.1.1 0> ——允许运行tcp协议源IP为202.39.2.3目的IP129.38.1.1的数据包通过

静态NAT配置命令
[RTA]interface GigabitEthernet0/0/1 ——进入接口
[RTA-GigabitEthernet0/0/1]ip address 192.168.1.254 24 ——配置接口IP地址
[RTA-GigabitEthernet0/0/1]interface Serial1/0/0 ——进入连接外网接口
[RTA-Serial1/0/0]ip address 200.10.10.2 24 ——配置连接外网接口地址
[RTA-Serial1/0/0]nat static global 202.10.10.1 inside 192.168.1.1 ——绑定公网和私网IP映射

验证静态NAT
[RTA]display nat static

动态NAT配置命令
[RTA]nat address-group 1 200.10.10.1 200.10.10.200 ——创建地址池
[RTA]acl 2000 ——创建acl
[RTA-acl-basic-2000]rule 5 permit source 192.168.1.0 0.0.0.255 ——指定被转换的IP
[RTA-acl-basic-2000]quit
[RTA]interface serial1/0/0
[RTA-Serial1/0/0]nat outbound 2000 address-group 1 no-pat ——应用动态nat

验证动态NAT
[RTA]display nat address-group 1

NAPT配置命令
[RTA]nat address-group 1 200.10.10.1 200.10.10.1
[RTA]acl 2000
[RTA-acl-basic-2000]rule 5 permit source 192.168.1.0 0.0.0.255
[RTA-acl-basic-2000]quit
[RTA]interface serial1/0/0
[RTA-Serial1/0/0]nat outbound 2000 address-group 1

easy IP配置
[RTA]acl 2000
[RTA-acl-basic-2000]rule 5 permit source 192.168.1.0 0.0.0.255
[RTA-acl-basic-2000]quit
[RTA]interface serial1/0/0
[RTA-Serial1/0/0]nat outbound 2000

验证esay IP
[RTA]display nat outbound

NAT server配置
[RTA]interface GigabitEthernet0/0/1
[RTA-GigabitEthernet0/0/1]ip address 192.168.1.254 24
[RTA-GigabitEthernet0/0/1]interface Serial1/0/0
[RTA-Serial1/0/0]ip address 200.10.10.2 24
[RTA-Serial1/0/0]nat server protocol tcp global 202.10.10.1 www inside 192.168.1.1 8080
——将内部192.168.1.1的web服务器的8080端口映射为

验证NAT server
[RTA]display nat server

RIP基本配置
[RTA]rip ——启动rip进程 后面可跟进程号
[RTA-rip-1]version 2 ——选择rip版本
[RTA-rip-1]network 10.0.0.0 ——宣告连接网络

验证rip配置
display rip 1 interface GigabitEthernet0/0/0 verbose

查看路由表
dis ip routing-table

抑制接口
[RTD-rip-1]silent-interface GigabitEthernet 0/0/1

水平分割
[RTA-GigabitEthernet0/0/0]rip split-horizon

毒性反转
[RTC-GigabitEthernet0/0/0]rip poison-reverse

静态路由配置命令
ip route-static <目标网络和掩码> <下一跳地址>

默认路由配置命令
ip route-static 0.0.0.0 0.0.0.0 <下一跳地址>

OSPF配置
[RTA]ospf 1 router-id 1.1.1.1 ——启动ospf进程1,指定路由id为1.1.1.1
[RTA-ospf-1]area 0 ——进入区域0
[RTA-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255 宣告网络

验证配置
[RTA]display ospf peer

配置接口优先级
ospf dr-priority ——配置接口优先级
undo ospf dr-priority ——删除优先级

重启ospf进程
reset ospf 1 process

stub区域配置
[RTC]ospf 1 router-id 3.3.3.3
[RTC-ospf-1]area 2
[RTC-ospf-1-area-0.0.0.2]stub

totally stub区域配置
[RTC]ospf 1 router-id 3.3.3.3
[RTC-ospf-1]area 2
[RTC-ospf-1-area-0.0.0.2]stub no-summary

nssa区域配置
[RTC]ospf 1 router-id 3.3.3.3
[RTC-ospf-1]area 2
[RTC-ospf-1-area-0.0.0.2]nssa default-route-advertise

显示ospf链路状态
display ospf lsdb

引入外部路由配置命令示例
[RTA]ospf 1 router-id 1.1.1.1
[RTA-ospf-1] import-route rip type 2 cost 50

路由聚合配置命令示例
[RTB-ospf-1-area-0.0.0.1]abr-summary 192.168.0.0 255.255.252.0

虚连接配置示例
[RTC]ospf 1 router-id 2.2.2.2
[RTC-ospf-1]area 1
[RTC-ospf-1-area-0.0.0.1]vlink-peer 1.1.1.1

查看ospf虚连接
[huawei-ospf-1]display ospf vlink

配置BGP
[huawei] bgp ——启动BGP
[huawei-bgp] router-id <值> ——配置router id
[huawei-bgp] peer <对等体IP> as ——指定BGP对等体及AS号
[huawei-bgp] ipv4-family unicast ——创建BGP 地址族,并进入相应地址族视图
[Huawei-bgp-af-ipv4] network <需要宣告的网络地址> ——将本地路由发布到BGP路由表中

命令配置 import方法
sys ——进入系统视图
[Huawei] bgp 1 ——进入bgp视图
[Huawei-bgp]ipv4-family unicast ——进入ipv4地址族
[Huawei-bgp]import-route ospf 1 ——引入ospf协议
[Huawei-bgp]default-route imported ——引入默认路由

命令配置network方法
sys ——进入系统视图
[Huawei] bgp 1 ——进入bgp视图
[Huawei-bgp]ipv4-family unicast ——进入ipv4地址族
[Huawei-bgp]network 192.168.1.1 255.255.255.0 ——引入网络

对等体组配置命令
sys ——进入系统视图
[Huawei] bgp 1 ——进入bgp视图
[Huawei-bgp]group test internal ——创建组并指定为ibgp
[Huawei-bgp]peer test as-number 1 ——为组指定as
[Huawei-bgp]peer 192.168.1.1 group test ——将对等体加入组
[Huawei-bgp]peer 192.168.3.3 group test

路由反射器配置命令
[Huawei-bgp] peer { group-name | ip-address } reflect-client

流量整形(GTS)
qos gts cir committed-information-rate [ cbs committed-burst-size]

流量监管(TP)
qos car { inbound | outbound } cir committed-information-rate [cbs committed-burst-size [ pbs excess-burst-size ]]

流分类命令
[Huawei]traffic classifier tc1
[Huawei-classifier-tc1]if-match acl 2000

流行为命令
[Huawei]traffic behavior tb1
[Huawei-behavior-tb1]car cir 10000 cbs 150000 pbs 150000

流量策略命令
[Huawei]traffic policy tp1
[Huawei-trafficpolicy-tp1]classifier tc1 behavior tb1

应用流量策略命令
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]undo shutdown
[Huawei-GigabitEthernet0/0/1]traffic-policy tp2 inbound

配置示例
[AR1] interface gigabitethernet 0/0/0
[AR1-Gigabitethernet 0/0/0] trust dscp
配置丢弃模板
[AR1] drop-profile data ——创建一个丢弃模板,并进入丢弃模板视图
[AR1-drop-profile-data] wred dscp ——指定当前WRED丢弃模板基于DSCP优先级
[AR1-drop-profile-data] dscp 28 low-limit 50 high-limit 70 discard-percentage 30 ——配置基于DSCP优先级的WRED参数
[AR1-drop-profile-data] dscp 26 low-limit 40 high-limit 60 discard-percentage 40
[AR1-drop-profile-data] quit
[AR1] drop-profile video
[AR1-drop-profile-video] wred dscp
[AR1-drop-profile-video] dscp 38 low-limit 60 high-limit 80 discard-percentage 20
[AR1-drop-profile-video] quit
应用丢弃模板
[AR1] qos queue-profile queue-profile1 ——进入队列模板视图
[AR1-qos-queue-profile-queue-profile1] schedule wfq 3 to 4 ——在队列模板中为指定队列配置WFQ调度模式
[AR1-qos-queue-profile-queue-profile1] queue 4 drop-profile video ——在队列模板中为指定队列绑定丢弃模板
[AR1-qos-queue-profile-queue-profile1] queue 3 drop-profile data
[AR1-qos-queue-profile-queue-profile1] quit
[AR1] interface ethernet 0/0/1
[AR1-Ethernet0/0/1] qos queue-profile queue-profile1 ——在接口或子接口下应用队列模板

IPSec配置
[RouterA] acl number 3101 —创建高级acl
[RouterA-acl-adv-3101] rule permit ip source 192.168.1.1 1.1.1.1 destination 192.168.1.2 1.1.1.1 —允许192.168.1.1到192.168.1.2
[RouterA-acl-adv-3101] quit

[RouterA] ipsec proposal tran1 —创建IPSec安全链接,起名
[RouterA-ipsec-proposal-tran1] esp authentication-algorithm sha2-256 —验证算法
[RouterA-ipsec-proposal-tran1] esp encryption-algorithm aes-128 —加密算法
[RouterA-ipsec-proposal-tran1] quit

[RouterA]ike proposal 5 —配置对等体,跟编号
[RouterA-ike-proposal-5]encryption-algorithm aes-cbc-128 —加密算法
[RouterA-ike-proposal-5]authentication-algorithm sha1 —验证算法
[RouterA-ike-proposal-5]quit

[RouterA] ike peer spub v2 —指定对等体
[RouterA-ike-peer-spub] ike-proposal 5 —调用之前的ike安全提议
[RouterA-ike-peer-spub] pre-shared-key simple huawei —指定预共享密钥
[RouterA-ike-peer-spub] remote-address 192.168.1.2 —指定对等体地址
[RouterA-ike-peer-spub] quit

[RouterA] ipsec policy map1 10 isakmp —配置安全策略,名称,编号,类型
[RouterA-ipsec-policy-isakmp-map1-10] ike-peer spub —指定ike对等体
[RouterA-ipsec-policy-isakmp-map1-10] proposal tran1 —指定安全链接
[RouterA-ipsec-policy-isakmp-map1-10] security acl 3101 —指定acl
[RouterA-ipsec-policy-isakmp-map1-10] quit

[RouterA] interface gigabitethernet 1/0/0 —进入接口
[RouterA-GigabitEthernet1/0/0] ipsec policy map1 —接口应用
[RouterA-GigabitEthernet1/0/0] quit

查看
dis IPSec sa

单词

system:系统
view:视图
sysname:修改系统名称
display:显示
version:版本
mac:地址表
address:地址
vlan:虚拟局域网(虚拟网)
undo:撤销
port:端口
link:连接
type:类型
access:接近
default:默认
trunk:干道
pvid:默认所属vlan的id
allow:允许
pass:通过
hybrid:混合
tagged:已标记
untagged:未标记
*30*
group:组
member:成员
gvrp:
all:全部
registration:登记
fixed:固定
statistics:统计数据
status:状态
interface:接口
quit:退出

enable:启用
mode:模式
mstp:多生成树协议
region:地区
configuration :配置
instance:实例
active :活跃的
prioriry:优先级
brief:短暂的
vrrp:虚拟路由冗余协议
vrid:虚拟路由器ID
virtual:虚拟

priority:优先级
preempt:抢占
timer:计时器
delay:延迟
advertise:作广告
track:跟踪
reduced:减少
verbose:详细的
acl:访问控制列表
permit:许可证
source :源
deny:否认
traffic:交通
filter:过滤器
number:数量
destination :目的地
nat:网络地址转换
static:静态
inside:内部
rule:规则
outbound:出站
no-pat:转换