Fork me on GitHub

Huawei® ENSP & VRP CheatSheet

####################  系统命令  ####################
system-view
sysname
display current-configuration
undo info-center enable
description TO-R1-E0/0/1


####################  PC的IP  ####################
## 首先配PC机的IP,使用图形界面


####################  保存  ####################
return
save
y


####################  配置access口VLAN  ####################
vlan 10
#或者
vlan batch 10 20
quit

##修改描述信息
interface Ethernet 0/0/1
description TO-R1-E0/0/1 
port link-type access
port default vlan 10
quit

##注意修改描述信息
interface Ethernet 0/0/2
description TO-R1-E0/0/1
port link-type access
port default vlan 10
quit


####################  配置trunk口VLAN  ####################
port link-type trunk
port trunk allow-pass vlan 10
quit


####################  端口聚合  ####################
interface Eth-Trunk1
quit

interface GigabitEthernet 0/0/2
description TO-R1-E0/0/1
Eth-Trunk1
quit

interface GigabitEthernet 0/0/3
description TO-R1-E0/0/1
Eth-Trunk1
quit

interface Eth-Trunk1
port link-type trunk
port trunk pvid vlan 30
port trunk allow-pass vlan 2 to 4094


####################  交换机 下挂 路由器  ####################
##路由器上 VLAN20:
interface GigabitEthernet 0/0/0.1
description TO-R1-E0/0/1

vlan-type dot1q 20
ip address 10.1.1.1 30

##交换机上
vlan 20
quit
interface GigabitEthernet 0/0/2
description TO-R1-E0/0/1
port link-type trunk
port trunk allow-pass vlan 20
quit

## 交换机的上游(路由器一端)
interface Vlanif20
ip address 10.2.2.2 30

## 交换机的下游(PC一端)
vlan 10
interface GigabitEthernet 0/0/1
description TO-R1-E0/0/1
port link-type access
port default vlan 10
quit

##与VLAN绑定的三层接口,网关地址
interface Vlanif10
ip address 10.10.3.3 30


####################  静态路由  ####################
##路由器上
system-view
ip routing-table 192.168.1.2 32 192.168.2.1
display ip routing-table


####################  动态路由OSPF  ####################
## 总体步骤:
## 先配Router-ID
## 创建OSPF进程(注意进程号)
## 将接口宣告到某个area中

## 一、先配PC机的IP

## 二、配路由器各个接口上的IP(注意loopback0):
interface GigabitEthernet 0/0/0
description TO-R1-E0/0/1
ip address 172.16.1.1 24
quit

interface loopback 0
ip address 1.1.1.1 32

## 三、配置OSPF
## 先创建OSPF进程号,再进入一个area,在此area中宣告网络
## network 用反掩码,每一位用255减
router id 1.1.1.1
ospf 1

area 1
network 172.16.1.0 0.0.0.255
network 1.1.1.1 0.0.0.0
quit
display this

##重复此过程:
router id 2.2.2.2
ospf 1

area 1
network 172.16.2.4 0.0.0.3
network 172.16.2.4 0.0.0.3
network 172.16.2.4 0.0.0.3
quit

area 2
network 172.16.2.4 0.0.0.3
network 172.16.2.4 0.0.0.3
network 172.16.2.4 0.0.0.3
quit

##检查:
display ospf peer brief


####################  将非OSPF的端口注入OSPF  ####################
ospf
import-route direct


####################  Stub和nssa  ####################
# stub:不向外发送路由信息
# nssa:可以向外发送路由信息
# 配置方法:
ospf 1
area 1
stub


####################  静态路由的路由备份  ####################
## 在路由器B上配置到达路由器A的10.1.1.1网段的备份路由
ip route-static 10.1.1.1 255.255.255.255 2.2.2.1 preference 100
# preference越小,越优先 

  

posted @ 2019-04-27 23:47  stardsd  阅读(635)  评论(0编辑  收藏  举报