1 ipconfig 查看 pc机的IP地址
2 ping 连接的IP地址
3 system-view 进入系统视图
4 [Huawei]interface GigabitEthernet 0/0/1 进入接口视图 过0/0/1
5 quit 返回上一层视图
6 ctrl+Z 快速返回用户视图
7 [sy]sysname tedu-ntd-lswl 进入系统视图改名字
8 shutdown 关闭端口
9 undo shutdown 启用端口
10 display current-configuration 查看当前配置
11 save 保存配置
12 [tedu-ntd-lsw1] user-interface console 0 //进终端配置
13 [tedu-ntd-lsw1-ui-console0] set authentication password cipher Taren1 //设置终端登录密码为 Taren1
14 [tedu-ntd-lsw1-ui-console0] authentication-mode password //启用密码认证
15 [tedu-ntd-lsw1-ui-console0] idle-timeout 2880 //将闲置超时设为2880分钟
16 reset saved-configuration
Warning: The action will delete the saved configuration in the device.
The configuration will be erased to reconfigure. Continue? [Y/N]:Y //提示是否恢复选Y
reboot
Info: The system is now comparing the configuration, please wait.
Warning: All the configuration will be saved to the configuration file for the n
ext startup:, Continue?[Y/N]:N //提示是否保存选N
Info: If want to reboot with saving diagnostic information, input 'N' and then e
xecute 'reboot save diagnostic-information'.
System will reboot! Continue?[Y/N]:Y //提示是否重启选Y
.. ..
//重启完毕后,已恢复出厂设置
17 u t m //关闭日志提醒
18 sys //进入系统视图
19 [Huawei]sys lsw1 //设置交换机名字lsw1
20 [lsw1]inter vlan 1 //进虚接口vlan1配置
21 [lsw1-Vlanif1]ip addr 192.168.1.251 24 //设置IP地址
22 [lsw1-Vlanif1]dis cu //验证操作
23 telnet 192.168.1.251 //连接指定地址的交换机
display current-configuration 收集全量配置信息
display interface brief 查看端口up、down 需要知道割接前端口状态,便于后期对比验证
display ip interface brief 查看端口状态信息
display arp all 收集arp信息 需要收集ARP信息,便于业务验证
display mac-address 收集mac地址表 便于发现有不通的主机,快速定位
display ip routing-table 查看路由表 便于后期对比路由条目
display stp 查看生成树状态 了解生成树协议状态,用的是哪种类型,防止二层端口协商失败
dispaly interface xxx 查看某个端口协商速率 要保证和原来的速率一致,否则可能割接失败
display device solt 1 查看所交换机所有的接口协商速率
display version 查看版本信息 当需要查找原来设备信息的时候,采集版本就有必要了
display patch-information 看补丁信息
1)创建vlan
[SW1]vlan 2 [2-4094] 创建vlan
[SW1]vlan batch 10 20 30 创建多个不连续的vlan
[SW1]display vlan 查看vlan信息
[SW1]vlan batch 50 to 60创建多个连续的vlan
[SW1]vlan2
[SW1-vlan2]description caiwu添加描述信息(可选)
2)删除vlan
[SW1]undo vlan 2 删除1个vlan
[SW1]undo vlan batch 10 20 30 删除多个不连续vlan
[SW1]undo vlan batch 50 to 60 删除多个连续vlan
3)添加vlan描述信息
[SW1]vlan 2
[SW1-vlan2]description caiwu(添加vlan描述信息caiwu,此配置可选)
[SW1-vlan2]display this 查看当前有效配置
4)端口加入vlan的操作命令
[SW1]interface GigabitEthernet0/0/1 //进入交换机的0/0/1端口
[SW1-GigabitEthernet0/0/1]port link-type access //0/0/1的接口模式默认为 access
[SW1-GigabitEthernet0/0/1]port default vlan 2 //将接口0/0/1的接口增加到 vlan2中去
5 [lsw1]display vlan) //查看vlan的命令
[LWS1]vlan batch 10 20 30 40
[LWS1]display vlan
[LWS1-port-group-1]group-member g0/0/1 to g0/0/8
[LWS1]port-group group-member g0/0/9 to g0/0/12
[LWS1-port-group]port link-type access
[LWS1-GigabitEthernet0/0/9]port link-type access
[LWS1-GigabitEthernet0/0/10]port link-type access
[LWS1-GigabitEthernet0/0/11]port link-type access
[LWS1-GigabitEthernet0/0/12]port link-type access
[LWS1-port-group]port default vlan 20
[LWS1-GigabitEthernet0/0/9]port default vlan 20
[LWS1-GigabitEthernet0/0/10]port default vlan 20
[LWS1-GigabitEthernet0/0/11]port default vlan 20
[LWS1-GigabitEthernet0/0/12]port default vlan 20
[LWS1-port-group]
[vlanzudeguanling]port-group 3 //创建vlan组为编号3
[vlanzudeguanling-port-group-3]group-member g0/0/3 to g0/0/14 //进入3接口将交换机的3号口到14号口增加组的编号为3这里
[vlanzudeguanling-port-group-3]port link-type access //3号口到14号口增加接口模式默认为 access
[vlanzudeguanling-port-group-3]port default vlan 20 //将3号接口到14号接口放入到vlan20中去
[vlanzudeguanling]undo vlan 20 //删除vlan复原接口
[vlanzudeguanling] display vlan) //查看vlan的命令
可以像Trunk 接口一样,发送出去的数据都携带标签
[lsw2trunk]interface GigabitEthernet 0/0/24
[lsw2trunk-GigabitEthernet0/0/24]port link-type trunk // 增加接口模式默认为 trunk
[lsw2trunk-GigabitEthernet0/0/24]port trunk allow-pass vlan 1 5 10 15 接口允许vlan1/5/10 /15通过
[lsw1trunk]display port vlan //查看命令
26 hybrid 接口的命令
[Huawei]vlan batch 10
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type hybrid // 增加接口模式默认为 hybrid
[Huawei-GigabitEthernet0/0/1]port hybrid pvid vlan 10
[Huawei-GigabitEthernet0/0/1]port hybrid untagged vlan 10 //接口发送数据帧时,允许vlan10的数据帧通过,并且剥离数据帧中的vlan10标签
[SW2-GigabitEthernet0/0/1]port hybrid tagged vlan 5 10 //接口发送数据帧时,允许vlan5 和10携带标签通过
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type hybrid
[Huawei-GigabitEthernet0/0/1]port hybrid pvid vlan 10
[Huawei-GigabitEthernet0/0/1]port hybrid tagged vlan 10
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type hybrid
[Huawei-GigabitEthernet0/0/2]port hybrid tagged vlan 10
[Huawei]int
[Huawei]interface Vlanif 10
[Huawei]interface Vlanif 10
[Huawei-Vlanif10]
[Huawei-Vlanif10]ip
[Huawei-Vlanif10]ip add
[Huawei-Vlanif10]ip address 192.168.10.254 24
[Huawei]int
[Huawei]interface Vlanif 20
[Huawei]interface Vlanif 20
[Huawei-Vlanif20]
[Huawei-Vlanif20]ip
[Huawei-Vlanif20]ip add
[Huawei-Vlanif20]ip address 192.168.20.254 24
[SW1]interface eth-trunk 1 //创建并进入 eth-trunk 1
[SW1-Eth-Trunk1]mode manual load-balance //配置手工模式
[SW1-Eth-Trunk1]trunkport g0/0/1 //加入成员端口
[SW1-Eth-Trunk1]trunkport g0/0/2 //加入成员端口
[SW1-Eth-Trunk1]port link-type trunk //配置 eth-trunk 类型为 trunk
[SW1-Eth-Trunk1]port trunk allow-pass vlan 10 20 //允许 vlan10和vlan20
[SW1]lacp priority 100 //配置lacp的系统优先级(越小越优先)
[SW1]interface eth-trunk 1 //创建链路聚合组1
[SW1-Eth-Trunk1]mode lacp-static //链路聚合的工作模式是lacp
[SW1-Eth-Trunk1]trunkport g 0/0/1 to 0/0/3 //在链路聚合组中添加成员接口
[SW1-Eth-Trunk1]port link-type trunk //设置trunk模式
[SW1-Eth-Trunk1]port trunk allow-pass vlan 10 20 //允许vlan10 20 流量通过
[SW1-Eth-Trunk1]max active-linknumber 2 //设置活动端口的上限阈值为2
[SW1-Eth-Trunk1]lacp preempt enable //开启抢占功能
1 [Huawei]vlan 10 创建vlan
2 [Huawei-vlan10]aggregate-vlan 配置valan 为聚合vlan
3 [Huawei-vlan10]access-vlan 2 3 在聚合vlan10中增加vlan2 3
4 [Huawei]interface Vlanif 10 //进入到Vlanif10的接口
5 [Huawei-Vlanif10]ip address 192.168.10.254 24 //配置ip地址
6 [Huawei-Vlanif10]arp-proxy inter-sub-vlan-proxy enable //开启vlan10下的代理功能
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.2.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.3.1 24
[R1]interface GigabitEthernet0/0/0.10 //进入路由器的子接口
[R1-G0/0/0.10]dot1q termination vid 10 //配置vlan终结
[R1-G0/0/0.10]ip address 10.10.10.254 255.255.255.0 //配置ip地址
[R1-G0/0/0.10]arp broadcast enable //开启arp 广播
1 [r1]ip route-static 192.168.2.0 24 192.168.34.2
2 [r1]ip route-static 192.168.2.0 24 192.168.45.2
3 [r1]undo ip route-static 192.168.2.0 24 192.168.45.2//删除静态路
4 [r1]ip route-static 192.168.2.0 24 192.168.45.2 preference 70
在r1中配置静态路由优先级设置为70
--------------------------------------------------------------------------------------------------
1[r2]ip route-static 192.168.1.0 24 192.168.34.1
2 [r2]ip route-static 192.168.1.0 24 192.168.45.1
3 [r2]undo ip route-static 192.168.1.0 24 192.168.45.1
4 [r2]ip route-static 192.168.1.0 24 192.168.45.1 preference 70
在r2中配置静态路由优先级设置为70
[r1]display ip routing-table protocol static //查看静态路由
PC>tracert 192.168.2.2//查看网络电路的去向
interface GigabitEthernet0/0/0 //进入接口
ip address 192.168.1.251 255.255.255.0 //配置IP地址
vrrp vrid 1 virtual-ip 192.168.1.254 //配置vrrp备份组的租号 并且配置 Ip地址
vrrp vrid 1 priority 130 //配置R1 路由器在备份组1 里面为130
上路链路追踪实验
1 配置IP地址
2 配置浮动路由
ip route-static 192.168.1.0 255.255.255.0 192.168.13.1
ip route-static 192.168.1.0 255.255.255.0 192.168.23.2 preference 70
3 上行链路追踪
vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 50
//这条配置命令表示: VRRP持续监控R1的g0/0/1口的状态,如果R1的g0/0/1接口状态为down
那么VRRP的优先级就减去50。
如果原来VRRP优先级为130,那么g0/0/1口down掉后,优先级就为130-50=80
测试
[r1]display vrrp brief
//认证模式
[R1-GigabitEthernet0/0/0]vrrp vrid 2 authentication-mode ?
md5 MD5 authentication mode
simple Simple authentication mode
[R1-GigabitEthernet0/0/0]vrrp vrid 2 authentication-mode
//负载均衡
R1
interface GigabitEthernet0/0/0
ip address 192.168.1.251 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.254
vrrp vrid 1 priority 130
vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 50
vrrp vrid 1 authentication-mode md5 %$%$PeG^VmF7S>)ptG$#R`-NN,d}%$%$
vrrp vrid 2 virtual-ip 192.168.1.253
R2
interface GigabitEthernet0/0/0
ip address 192.168.1.252 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.254
vrrp vrid 1 authentication-mode md5 %$%$0lm}FNsx'.wu&r-=gU_1N-})%$%$
vrrp vrid 2 virtual-ip 192.168.1.253
vrrp vrid 2 priority 130
vrrp vrid 2 track interface GigabitEthernet0/0/1 reduced 50