华为网络设备 VRP
思科网络设备 IOS
console
通过console线连接pc机com口,通过超级终端等软件登录设备。
telnet
远程连接方式
web方式
远程,并设备支持远程web管理
配置文件
运行配置:current-configuration
(华为)
启动配置:saved-configuration
(华为)
保存配置:save
(华为)
华为以视图代表各个配置模式,早年华为设备的命令跟思科基本上是一样的,因为版权问题,华为在后面更改了命令,但配置模式跟配置习惯并没有大改,此视图可以理解为思科的配置模式(用户配置模式,全局配置模式,接口配置模式等)。
用户视图
输入system-view进入系统视图
系统视图
[Name]
输入vlan 名 进入vlan视图
输入interface ethernet 接口名进入以太网端口视图
VLAN视图
[Name-VLAN1]
以太网端口视图
[Name-Ethernet 0/1]
输入quit退出当前视图,退至上一层视图
<HUAWEI>display current-configuration //显示当前配置
<HUAWEI>system-view //进入系统视图
[HUAWEI]sysname R1 //命名
[R1]interface gigabitethernet 0/0/1 //进入接口视图
[R1-GigabitEthernet0/0/1]negotiation auto //接口自动协商
[R1-Gigabitethernet0/0/1]quit //退出当前模式
[R1]vlan 5 //创建vlan5
[R1-vlan5]management-vlan //vlan5为交换机管理vlan
[R1]interface Vlanif5 //创建管理vlan的vlanif接口
[R1-Vlanif5]ip address 192.168.2.1 24 //配置vlanif接口的ip
启用telnet并配置vty线路登录的验证方式
[HUAWEI]telnet server enable //开启telnet服务
[HUAWEI]user-interface vty 0 4 //开启vty线路模式
[HUAWEI-ui-vty0-4]protocol inbound telnet //配置vty支持telnet协议
[HUAWEI-ui-vty0-4]authentication-mode aaa|password|none //设置认证模式为口令或aaa认证
[HUAWEI-ui-vty0-4]quit
[HUAWEI]aaa //进入aaa视图
[HUAWEI-aaa]local-user user1 password irreversible-cipher youpasswd
[HUAWEI-aaa]local-user user1 privilege level 3 //配置账户权限为3
[HUAWEI-aaa]return
<HUAWEI>save
配置端口隔离,交换机内同一vlan隔离,三层之间互通
<Switch1>system-view
[Switch1]port-isolate mode l2 //全局端口隔离模式为二层隔离
[Switch1]interface gigabitethernet 1/0/1
[Switch1-Gigabitethernet1/0/1]port-isolate enable group 1 //端口隔离功能,并将端口加入隔离组 group1
[Switch1-Gigabitethernet1/0/1]port-isolate enable group1
[Switch1-Gigabitethernet1/0/1]quit
[Switch1]
配置静态mac地址表
[Switch1]mac-address static 0001-0002-0003-0004 Gigabitethernet1/0/3 vlan5
GARP是一种通用属性注册协议,包括GVRP和GMRP两种应用,其中GVRP类似思科的VTP协议
祖册模式
<HUAWEI>system-view
[HUAWEI]sysname SwitchA
[SwitchA]vlan batch 2 3 //批量创建vlan 2 3
[SwitchA]gvrp //全局使能GVRP
[SwitchA]interface gigabitehernet 0/0/1
[SwitchA-Gigabitethernet0/0/1]port link-type trunk //配置trunk口
[SwitchA-Gigabitethernet0/0/1]port trunk allow-pass vlan //允许所有注册vlan通过
[SwitchA-Gigabitethernet0/0/1]gvrp //使能此接口的GVRP功能
[SwitchA-Gigabitethernet0/0/1]gvrp registration normal //GVRP注册为normal模式
STP生成树协议
[HUAWEI]stp enable //开启stp功能
[HUAWEI]stp mode stp|rstp //运行生成树协议stp|rstp模式
[HUAWEI]stp root {primary|secondary} //设置为根桥或备份根桥
[HUAWEI]stp priority priority //设置网桥优先级
[HUAWEI-Gigabitethernet0/0/1]stp cost cost //设置端口开销
[HUAWEI-Gigabitethernet0/0/1]stp port priority priority //设置端口优先级
[HUAWEI-Gigabitethernet0/0/1]stp edged-port enable //配置端口为边缘端口
[HUAWEI-Gigabitethernet0/0/1]stp bpdu-filter enable //启用端口为bpdu报文过滤功能
创建vlan
[Switch][undo] vlan vlan-id //删除,创建vlan
[Switch]vlan batch [vlan-id1 to vlan-id2] //批量创建
配置接口类型
access:接入接口
trunk:中继接口
hybrid:混合接口
如果配置接口为 hybrid 口 ,需要配置hybrid口的模式
如果配置接口为 trunk 口 , 需要配置 trunk 允许那些vlan通信
如果配置 access 口,需要配置 access 加入哪一个vlan
[Switch-Ethernet0/1]port link-type{access|trunk|hybrid}
把端口加入到一个指定vlan
[Switch-Ethernet0/1]port default vlan vlan-id
配置trunk中允许通过的vlan
[Switch-Ethernet0/1]port trunk allow-pass vlan [vlan-id1 to vlan-id2 | all]
指定hybrid端口以tagged/untagged
方式加入vlan
[Switch-Ethernet0/1]port hybrid tagged | ubtagged vlan-id
配置管理ip地址和子网掩码
[Switch]interface vlanif 1
[Switch-vlanif 1] ip address 192.168.1.1 255.255.255.0
华为路由器搭建 dhcp服务
[HUAWEI]dhcp enable //全局开启dhcp服务
[HUAWEI]ip pool pool1 //创建全局地址池 pool1
[HUAWEI-ip-pool-pool1]network 192.168.3.0 mask 255.255.255.0 //配置全局地址池中可用的ip地址范围
[HUAWEI-ip-pool-pool1]gateway-list 192.168.3.1 //配置自动分配的网关ip
[HUAWEI-ip-pool-pool1]lease day 1 hour 10 //租约时间信息 1天 10 小时
[HUAWEI-Gigabitethernet0/0/1]dhcp select global //此接口采用全局地址池中的dhcp服务功能
dhcp 中继相关配置
[HUAWEI-Gigabitethernet0/0/1]dhcp select relay
[HUAWEI-Gigabitethernet0/0/1]dhcp relay server-ip ip-address //配置dhcp中继所连接的dhcp服务器ip地址
静态路由
到 129.1.0.0 这个子网的所有ip的下一条地址 给 10.0.0.2
[RA]ip route-static 129.1.0.0 255.255.0.0 10.0.0.2
[RA]ip route-static 129.1.0.0 16 10.0.0.2
[RA]ip route-static 129.1.0.0 16 s0
默认路由
所有ip吓一跳地址 给 10.0.0.1
[RB]ip route-static 0.0.0.0 0.0.0.0 10.0.0.1
华为路由协议优先级(越小越优先)
RIP配置
<R1>system-view
[R1]rip //进入rip视图
[R1-rip-1]version 2 //配置rip版本为2
[R1-rip-1]undo summary //取消路由聚合功能(取消自动汇总)
[R1-rip-1]network 192.168.1.0 //宣告直连网络192.168.1.0
[R1-rip-1]network 192.168.10.0 //宣告直连网络192.168.10.0
[R1-rip-1]network 192.168.12.0 //宣告直连网络192.168.12.0
[R1-rip-1]quit
OSPF配置
<R1>system-viem
[R1]route-id 1.1.1.1 //指定R1的route id 为 1.1.1.1
[R1]ospf
[R1-OSPF-1]area 0 //划分区域 0 骨干区一定有
[R1-ospf-1area-0.0.0.0]network 172.16.10.0 0.0.0.255
[R1-ospf-1area-0.0.0.0]network 172.16.11.0 0.0.0.255 //宣告邻接网络
[R1-ospf-1area-0.0.0.0]quit
[R1-ospf-1]area 1 //区域 1
[R1-ospf-1area-0.0.0.1]network 192.168.2.0 0.0.0.255 //区域1 的邻接网络