This commit is contained in:
2021-11-14 15:52:46 +08:00
parent 915c231124
commit 1e344dc204
112 changed files with 1039 additions and 1039 deletions

View File

@@ -7,77 +7,77 @@ tags: ["华为", "hcnp"]
categories: ["network"]
---
# 基本命令
## 查看操作系统
## 基本命令
### 查看操作系统
- 用户模式下执行
```
dis version
```
## 修改语言
### 修改语言
- 用户模式下执行
```
language-mode Chinese
```
## 保存配置
### 保存配置
- 用户模式下执行
```
save
```
## 修改主机名
### 修改主机名
- 系统模式下执行
```
sysname XXXX
```
## 关闭提示信息
### 关闭提示信息
- 系统模式下执行
```
undo info-center enable
```
## 显示当前模式配置
### 显示当前模式配置
- 任何模式下执行
```
dis this
```
# 接口
## 显示接口摘要信息
## 接口
### 显示接口摘要信息
- 任何模式下执行
```
dis ip int brief
```
## 显示接口类型
### 显示接口类型
- 任何模式下执行
```
dis port vlan
```
## 配置接口 IP
### 配置接口 IP
- 系统模式下执行
```
int e0/0/0
ip addr 172.16.1.1 24
```
## 配置接口描述信息
### 配置接口描述信息
- 系统模式下执行
```
int e0/0/0
description ...
```
## 配置接口组
### 配置接口组
- 系统模式下执行
```
port-group g e0/0/2 to e0/0/8
```
## 接口安全
### 接口安全
- 默认只允许一个 mac 地址通信
- 系统模式下执行
```
@@ -89,7 +89,7 @@ categories: ["network"]
port-security protect-action restrict # 触发安全操作时,交换机接口阻塞并警告
```
## 接口镜像
### 接口镜像
- 系统模式下执行
```
observe-port 1 int gi0/0/24 # 把 24 口设置为观察口
@@ -97,7 +97,7 @@ categories: ["network"]
port-mirroring to observe-port 1 both # 把 1 口流量复制到 24 口
```
# Vlan
## Vlan
- 虚拟局域网(Virtual Local Area Network)
- 交换机接口默认都在 vlan 1 中,一个接口只能从属于一个 vlan
- 系统模式下执行
@@ -120,7 +120,7 @@ categories: ["network"]
dis port vlan
```
## 基于 mac 配置 vlan
### 基于 mac 配置 vlan
- 系统模式下执行
```
vlan batch 10 20
@@ -139,7 +139,7 @@ categories: ["network"]
dis mac-address
```
## 基于 ip 配置 vlan
### 基于 ip 配置 vlan
- 系统模式下执行
```
vlan 10
@@ -157,7 +157,7 @@ categories: ["network"]
dis ip-subnet-vlan
```
## super vlan
### super vlan
- 各子 vlan 共用超级 vlan 的地址段,且各子 vlan 间网络不通
- 系统模式下执行
```
@@ -169,7 +169,7 @@ categories: ["network"]
ip addr 192.168.1.1 24 # 聚合 vlan 的接口地址作为各子 vlan 的网关
```
## 接口隔离
### 接口隔离
- 同一台交换机相同隔离组的端口不能互访trunk 接口也可以加入隔离组
- 系统模式下执行
```
@@ -183,7 +183,7 @@ categories: ["network"]
port-isolate enable group 1 # 把接口 8 加入隔离组 1
```
## Vlan 映射
### Vlan 映射
- 系统模式下执行
```
# 出口交换机
@@ -199,7 +199,7 @@ categories: ["network"]
port vlan-mapping vlan 10 to 30 map-vlan 100 # 把 vlan 10 到 30 转换成 100
```
## Hybrid 混合接口
### Hybrid 混合接口
- 华为交换机特有且默认,同时具备 access 和 trunk 功能
- 作为 access 口使用,系统模式下执行
```
@@ -214,7 +214,7 @@ categories: ["network"]
port hybrid tagged vlan 10 20
```
## Trunk
### Trunk
- 允许不同 vlan 的数据通过
- 系统模式下执行
```
@@ -237,7 +237,7 @@ categories: ["network"]
undo shutdown
```
## 链路聚合
### 链路聚合
- 多个物理接口捆绑为一个逻辑接口
- 系统模式下执行
```
@@ -258,7 +258,7 @@ categories: ["network"]
dis stp brief
```
## SVI
### SVI
- 交换机虚拟接口(Switch Virtual Interface)
- 系统模式下执行
```
@@ -268,7 +268,7 @@ categories: ["network"]
ip addr 192.168.2.1 24
```
# STP
## STP
- 生成树协议(Spanning Tree Protocol),防止交换环路
- 修改交换机优先级,系统模式下执行
```
@@ -310,19 +310,19 @@ categories: ["network"]
error-down auto-recovery cause bpdu-protection interval 30
```
## STP 算法
### STP 算法
- 选举根桥(根交换机),先比较优先级,再比较 MAC 地址,越小越优先
- 非根桥选出根端口(距离根交换机最近的端口)
- 其余链路上,优先级或 MAC 地址较大的交换机的端口被阻塞
## RSTP
### RSTP
- 快速 stpstp 升级版
- 系统模式下执行
```
stp mode rstp
```
## MSTP
### MSTP
- 多生成树协议
- 划分实例,不同实例里运行独立的 stp默认实例都是 0
- 系统模式下执行
@@ -344,7 +344,7 @@ categories: ["network"]
dis stp instance 2 brief
```
# ACL
## ACL
- 访问控制列表(Access Control List)ensp 中AR2220 支持 acl
- 基本 acl(2000-2999)只能匹配源 ip 地址,系统模式下执行
```
@@ -364,10 +364,10 @@ categories: ["network"]
- 二层 acl(4000-4999)
# 路由器
## 路由器
- 路由器的每个接口都是单独的网段
## 优先级
### 优先级
路由 | 优先级(0-255)
---- | ----
直连 | 0
@@ -375,13 +375,13 @@ categories: ["network"]
OSPF | 10
RIP | 100
## 显示路由表
### 显示路由表
- 任何模式下执行
```
dis ip routing-table
```
## 静态路由
### 静态路由
- 系统模式下执行
```
ip route-static 172.16.1.0 24 172.16.2.1 preference 60
@@ -390,7 +390,7 @@ RIP | 100
# 优先级: 默认 60, prefenence 60
```
## 缺省路由
### 缺省路由
- 系统模式下执行
```
ip route-static 0.0.0.0 0 172.16.3.1
@@ -398,7 +398,7 @@ RIP | 100
- 备份静态路由与现役静态路由优先级一样时,负载均衡传输
## 单臂路由
### 单臂路由
- 交换机 e0/0/3 与路由器 e0/0/0 连接
- 交换机系统模式下执行
```
@@ -426,7 +426,7 @@ RIP | 100
arp broadcast enable
```
# RIP
## RIP
- 只用跳数作为度量值16 跳不可达,老旧,目前一般不用
- 系统模式下执行
```
@@ -443,7 +443,7 @@ RIP | 100
silent-interface e0/0/0
```
# OSPF
## OSPF
- 开放式最短路径优先 (Open Shortest Path First)
- area 0 一般作为骨干区域area 1、2、3 一般作为常规区域常规区域__必须__与骨干区域相连
- 系统模式下执行
@@ -485,7 +485,7 @@ RIP | 100
dis ospf lsdb
```
## ospf 邻居
### ospf 邻居
- abr(area border router),区域边界路由器
- asbr(auto-system border router),自治系统边界路由器
- router id: 运行 ospf 路由器的身份 id不可重复
@@ -526,7 +526,7 @@ RIP | 100
ospf dr-priority 5
```
## ospf 虚链路
### ospf 虚链路
- 新增常规区域没有直连骨干区域,此时该新增区域默认与其他非直连区域网络不通
- 可以配置虚链路打通新增区域的网络,可以看成区域链路的延伸
- 系统模式下执行
@@ -547,21 +547,21 @@ RIP | 100
dis ospf vlink
```
## ospf 认证
### ospf 认证
- 系统模式下执行
```
int gi0/0/1 # 指定 ospf 链路接口
ospf authentication-mode simple cipher 123456
```
## 抑制接口
### 抑制接口
- 系统模式下执行
```
ospf 1
silent-interface e0/0/0
```
## 引入其他路由
### 引入其他路由
- 引入路由的协议显示为o_ASE(ospf-autosystem external),默认的路由优先级是 150
- ospf 和 rip 双向引入,系统模式下执行
```
@@ -580,7 +580,7 @@ RIP | 100
default-route-advertise always
```
## 路由汇总
### 路由汇总
- 精简路由表大小
- 在边界路由器(abr)上做路由汇总,系统模式下执行
```
@@ -595,7 +595,7 @@ RIP | 100
asbr-summary 192.168.0.0 255.255.0.0
```
## ospf las
### ospf las
- 链路状态公告(link state advertise),包含在 LSU 报文中
- 一类 LSA: router lsa
- 每个路由器都可以发送
@@ -644,7 +644,7 @@ RIP | 100
- 只能通告自己所在的 nssa 区域abr 收到时会转成 5 类继续传递
- 把与 nssa 直连的其他自治系统的路由引入 ospf
## ospf 特殊区域
### ospf 特殊区域
- stub末节区域拒绝五类 lsa生成执行 abr 的缺省路由,减少路由表大小,系统模式下执行
```
# 该区域的路由器 1
@@ -697,7 +697,7 @@ RIP | 100
nssa no-summary
```
## 路由过滤
### 路由过滤
- 过滤部分路由,在系统模式下执行
```
ospf 1
@@ -720,17 +720,17 @@ RIP | 100
rule permit source 192.168.2.0 0.0.0.255 # 允许 ospf 引入 192.168.2.0/24 的路由
```
## ospf 排错
### ospf 排错
- ospf 无法建立邻居的几个原因:
- router id 重复
- 相邻路由器中间直连的网段必须宣告到相同的区域(area)
- 认证的类型、密码不一样
- ospf 邻居间的特殊区域标识必须一致
# NAT
## NAT
- 一般先在内网接口配置缺省路由
## 静态 NAT
### 静态 NAT
- 一个私网地址映射一个公网地址
- 系统模式下执行
```
@@ -743,7 +743,7 @@ RIP | 100
dis nat session protocol icmp # 最后一个参数指定协议
```
## easy IP
### easy IP
- 多个私网地址转换成一个公网地址
- 系统模式下执行
```
@@ -753,7 +753,7 @@ RIP | 100
nat outbound 2001 # 这里的 2001 是 acl 编号
```
## NAT Server
### NAT Server
- 把外网地址的某个端口映射到内网服务器的某个端口
- 系统模式下执行
```
@@ -761,7 +761,7 @@ RIP | 100
nat server protocol tcp global 12.1.1.2 8080 inside 192.168.31.2 80
```
# VRRP
## VRRP
- 虚拟路由冗余协议
- 主从路由器必须使用相同的 vrid且建议指定优先级和密码
- 主路由器系统模式下执行
@@ -799,7 +799,7 @@ RIP | 100
stp instance 1 root secondary
```
# BFD
## BFD
- 双向转发检测,毫秒级故障检测,实现链路故障快速检查
- 探测包默认每秒发送一次
- 系统模式下执行
@@ -844,7 +844,7 @@ RIP | 100
dis bfd session all
```
# DHCP/BOOTP
## DHCP/BOOTP
- 系统模式下执行
```
dhcp enable
@@ -900,7 +900,7 @@ RIP | 100
dhcp snooping trusted
```
# Telnet
## Telnet
- 系统模式下执行
```
telnet server enable
@@ -916,7 +916,7 @@ RIP | 100
telnet 192.168.3.1
```
# FTP
## FTP
- 系统模式下执行
```
ftp server enable
@@ -925,7 +925,7 @@ RIP | 100
local-user service-type ftp
```
# SSH
## SSH
- 系统模式下执行
```
aaa
@@ -937,8 +937,8 @@ RIP | 100
stelnet server enable
```
# 广域网传输
## PPP
## 广域网传输
### PPP
- 远距离点对点串口传输(Point to Point Protocol)
- 系统模式下执行
```
@@ -947,7 +947,7 @@ RIP | 100
ip addr 12.1.1.2 255.255.255.0
```
### PAP 认证
#### PAP 认证
- 明文传输
- 服务端系统模式下执行
```
@@ -966,7 +966,7 @@ RIP | 100
undo shutdown
```
### CHAP 认证
#### CHAP 认证
- 密文传输
- 服务端系统模式下执行
```
@@ -986,7 +986,7 @@ RIP | 100
undo shutdown
```
## HDLC
### HDLC
- 系统模式下执行
```
int s4/0/1
@@ -994,7 +994,7 @@ RIP | 100
ip addr ...
```
## FR
### FR
- 系统模式下执行
```
int s4/0/1
@@ -1002,7 +1002,7 @@ RIP | 100
ip addr ...
```
# IPV6
## IPV6
- 系统模式下执行
```
ipv6
@@ -1016,7 +1016,7 @@ RIP | 100
- 以 FE80:: 开头的地址都是本地链路地址,只在本地链路有效
- EUI-64 地址: 原 mac 地址中间嵌入 FFFE第七个 bit 取反
# 园区网络
## 园区网络
- 500-1000 设备
- 路由器/防火墙: 配置缺省路由和 nat 连接外网
- 核心层交换机: 配置 vlansvi 和 dhcp作为网关