华为交换机基本操作

时间:2022-08-15 18:54:19

创建VLAN 20

[SW-zhuanxian] vlan 20
[SW-zhuanxian-vlan20] quit

进入接口14

[SW-zhuanxian] int GigabitEthernet 0/0/14
[SW-zhuanxian-GigabitEthernet0/0/14] q

配置端口为接入模式

[SW-zhuanxian-GigabitEthernet0/0/14] port link-type access

配置端口为Trunk模式

[SW-zhuanxian-GigabitEthernet0/0/14] port link-type trunk

启动接口

[SW-zhuanxian-GigabitEthernet0/0/14] undo shutdown

将0/0/14至0/0/20接口加入vlan20

[SW-zhuanxian] vlan 20
[SW-zhuanxian-vlan20] port GigabitEthernet 0/0/14 to 0/0/20

给vlan配置IP

[SW-zhuanxian]int Vlanif 20
[SW-zhuanxian-Vlanif20]ip add 192.168.0.253 255.255.255.252
[SW-zhuanxian-Vlanif20]undo shutdown

添加静态路由

[SW-zhuanxian] ip route-static 192.168.1.1 255.255.255.252 192.168.0.254

删除静态路由

[SW-zhuanxian] undo ip route-static 192.168.1.1 255.255.255.252 192.168.0.254

默认路由

[SW-zhuanxian] ip route-static 0.0.0.0 0.0.0.0 192.168.0.254

保存配置

<Quidway> save

删除vlan

#删除vlan,先删除3层口,再删除2层vlan

[SW-zhuanxian] undo interface Vlanif 20
[SW-zhuanxian] undo vlan 20

#相关查看命令

[SW-zhuanxian] display version 显示VRP版本号
[SW-zhuanxian] display current-configuration 显示系统运行配置信息
[SW-zhuanxian] display saved-configuration 显示保存的配置信息
[SW-zhuanxian] display interfaces brief 显示接口配置信息
[SW-zhuanxian] display ip routing-table 显示路由表
[SW-zhuanxian] display systname  命令用来显示路由器的名称