华为三层交换机之基本操作

Posted 江湖有缘

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了华为三层交换机之基本操作相关的知识,希望对你有一定的参考价值。

华为三层交换机之基本操作

一、华为三层交换机s5700系列

二、实验测试拓扑

三、创建管理IP

1.进入特权模式

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.

2.关闭信息中心消息提示

[Huawei]undo info-center enable
Info: Information center is disabled.

3.创建交换机管理VLAN

[Huawei]vlan 200
[Huawei-vlan200]

4.配置管理IP地址

[Huawei]vlan 200
[Huawei-vlan200]management-vlan 
[Huawei-vlan200]quit
[Huawei]interface Vlanif  200
[Huawei-Vlanif200]ip address 192.168.200.254 24
[Huawei-Vlanif200]quit
[Huawei]

5.将管理接口加入到管理VLAN

[Huawei]interface GigabitEthernet 0/0/24
[Huawei-GigabitEthernet0/0/24]port link-type trunk 	
[Huawei-GigabitEthernet0/0/24]port trunk allow-pass vlan 200
[Huawei-GigabitEthernet0/0/24]quit
[Huawei]

四、配置telnet

1.配置telnet

[Huawei]telnet server enable     #//Telnet出厂时是关闭的,需要开启
Info: The Telnet server has been enabled.
[Huawei]user-interface vty 0 4   #//Telnet常用于设备管理员登录,推荐使用AAA认证
[Huawei-ui-vty0-4]protocol inbound telnet 
[Huawei-ui-vty0-4]authentication-mode aaa    
[Huawei-ui-vty0-4]idle-timeout  15
[Huawei-ui-vty0-4]quit
[Huawei]aaa
[Huawei-aaa]local-user admin password cipher admin	   #  //配置管理员Telnet登录交换机的用户名和密码。用户名不区分大小写,密码区分大小写
[Huawei-aaa]local-user admin privilege level 15	   #//将管理员的账号权限设置为15(最高)
[Huawei-aaa]local-user admin service-type telnet 
[Huawei-aaa]

2.测试登录telnet

<Huawei>tel	
<Huawei>telnet 192.168.200.254
Trying 192.168.200.254 ...
Press CTRL+K to abort
Connected to 192.168.200.254 ...


Login authentication


Username:admin
Password:
Info: The max number of VTY users is 5, and the number
      of current VTY users on line is 1.
      The current login time is 2022-08-19 00:50:57.
<Huawei>

五、配置端口IP和vlan

1.配置VLAN及ip

配置业务vlan10、vlan20、vlan30

[Huawei]vlan batch 10 20 30
Info: This operation may take a few seconds. Please wait for a moment...done.	
[Huawei]interface Vlanif 10
[Huawei-Vlanif10]ip address 192.168.10.1 24
[Huawei-Vlanif10]quit		
[Huawei]interface Vlanif 20
[Huawei-Vlanif20]ip address 192.168.20.1 24
[Huawei-Vlanif20]quit
[Huawei]interface Vlanif 30
[Huawei-Vlanif30]ip address 192.168.30.1 24
[Huawei-Vlanif30]quit

2.将端口加入到vlan

[Huawei]port-group 1		
[Huawei-port-group-1]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/5
[Huawei-port-group-1]port link-type trunk 
[Huawei-GigabitEthernet0/0/1]port link-type trunk 
[Huawei-GigabitEthernet0/0/2]port link-type trunk 
[Huawei-GigabitEthernet0/0/3]port link-type trunk 
[Huawei-GigabitEthernet0/0/4]port link-type trunk 
[Huawei-GigabitEthernet0/0/5]port link-type trunk 
	
[Huawei-port-group-1]port trunk allow-pass vlan 10
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan 10
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan 10
[Huawei-GigabitEthernet0/0/4]port trunk allow-pass vlan 10
[Huawei-GigabitEthernet0/0/5]port trunk allow-pass vlan 10
[Huawei-port-group-1]quit
[Huawei]port-gr	
[Huawei]port-group 2		
[Huawei-port-group-2]group-member GigabitEthernet 0/0/6 to GigabitEthernet 0/0/1
0	
[Huawei-port-group-2]port link-type trunk 
[Huawei-GigabitEthernet0/0/6]port link-type trunk 
[Huawei-GigabitEthernet0/0/7]port link-type trunk 
[Huawei-GigabitEthernet0/0/8]port link-type trunk 
[Huawei-GigabitEthernet0/0/9]port link-type trunk 
[Huawei-GigabitEthernet0/0/10]port link-type trunk 
[Huawei-port-group-2]port trunk allow-pass vlan 20
[Huawei-GigabitEthernet0/0/6]port trunk allow-pass vlan 20
[Huawei-GigabitEthernet0/0/7]port trunk allow-pass vlan 20
[Huawei-GigabitEthernet0/0/8]port trunk allow-pass vlan 20
[Huawei-GigabitEthernet0/0/9]port trunk allow-pass vlan 20
[Huawei-GigabitEthernet0/0/10]port trunk allow-pass vlan 20
[Huawei-port-group-2]quit
[Huawei]port-group 3		
[Huawei-port-group-3]group-member GigabitEthernet 0/0/11 to GigabitEthernet 0/0/
15
[Huawei-port-group-3]port link-type trunk	
[Huawei-GigabitEthernet0/0/11]port link-type trunk 
[Huawei-GigabitEthernet0/0/12]port link-type trunk 
[Huawei-GigabitEthernet0/0/13]port link-type trunk 
[Huawei-GigabitEthernet0/0/14]port link-type trunk 
[Huawei-GigabitEthernet0/0/15]port link-type trunk 
[Huawei-port-group-3]port trunk allow-pass vlan 30
[Huawei-GigabitEthernet0/0/11]port trunk allow-pass vlan 30
[Huawei-GigabitEthernet0/0/12]port trunk allow-pass vlan 30
[Huawei-GigabitEthernet0/0/13]port trunk allow-pass vlan 30
[Huawei-GigabitEthernet0/0/14]port trunk allow-pass vlan 30
[Huawei-GigabitEthernet0/0/15]port trunk allow-pass vlan 30
[Huawei-port-group-3]quit
[Huawei]

3.配置两台交换机连接端口

[Huawei]interface GigabitEthernet 0/0/23
[Huawei-GigabitEthernet0/0/23]port link-type tr	
[Huawei-GigabitEthernet0/0/23]port link-type trunk 	
[Huawei-GigabitEthernet0/0/23]port trunk allow-pass vlan 10 20 30
[Huawei-GigabitEthernet0/0/23]

[Huawei]interface GigabitEthernet 0/0/22
[Huawei-GigabitEthernet0/0/22]port link-type trunk all	
[Huawei-GigabitEthernet0/0/22]port trunk allow-pass vlan 10 20 30 
[Huawei-GigabitEthernet0/0/22]

六、SW2和SW3配置

1.SW2配置

[Huawei]vlan batch 10 20 30 
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk 	
[Huawei-port-group-link-tr]port trunk allow-pass vlan 10 20 30
[Huawei-port-group-link-tr]
[Huawei]interface Ethernet0/0/2	
[Huawei-Ethernet0/0/2]port link-type access 
[Huawei-Ethernet0/0/2]port default vlan 10
[Huawei-Ethernet0/0/2]

2.SW3配置

[Huawei]vlan batch 10 20 30 
[Huawei]interface GigabitEthernet 0/0/1	
[Huawei-port-group-link-tr]port trunk allow-pass vlan 10 20 30
[Huawei-port-group-link-tr]
[Huawei]interface Ethernet0/0/2
[Huawei-Ethernet0/0/2]port link-type access 	
[Huawei-Ethernet0/0/2]port default vlan 10
[Huawei-Ethernet0/0/2]

七、测试四台IP互通

八、华为hyprid接口介绍

1.华为hyprid介绍

Hybrid特性是华为交换机的专有特性,该特性为局域网的搭建提供了更多的灵活性和安全性。

2.华为三种端口区别

1.Access类型端口:只能属于1个VLAN,一般用于连接计算机端口;
2.Trunk类型端口:可以允许多个VLAN通过,可以接收和发送多个VLAN 报文,一般用于交换机与交换机相关的接口。
3.Hybrid类型端口:可以允许多个VLAN通过,可以接收和发送多个VLAN 报文,可以用于交换机的间连接也可以用于连接用户计算机。

3.hyprid模式配置SW2

[Huawei]interface Ethernet0/0/1
[Huawei-Ethernet0/0/1]dis this
#
interface Ethernet0/0/1
#
return
[Huawei-Ethernet0/0/1]pori	
[Huawei-Ethernet0/0/1]port	
[Huawei-Ethernet0/0/1]port lin	
[Huawei-Ethernet0/0/1]port link-hy	
[Huawei-Ethernet0/0/1]port link-ty	
[Huawei-Ethernet0/0/1]port link-type h	
[Huawei-Ethernet0/0/1]port link-type hybrid 
[Huawei-Ethernet0/0/1]port h	
[Huawei-Ethernet0/0/1]port hybrid un	
[Huawei-Ethernet0/0/1]port hybrid untagged v	
[Huawei-Ethernet0/0/1]port hybrid untagged vlan 30
[Huawei-Ethernet0/0/1]port	
[Huawei-Ethernet0/0/1]port hy	
[Huawei-Ethernet0/0/1]port hybrid p	
[Huawei-Ethernet0/0/1]port hybrid pvid vlan 30
[Huawei-Ethernet0/0/1]quit

4.测试网络联通情况

九、使用hybrid配置trunk效果

1.更换trunk为hybird模式

[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20 30
#
return
[Huawei-GigabitEthernet0/0/1]undo port trunk allow-pass vlan 10 20 30 
[Huawei-GigabitEthernet0/0/1]port link-type hybrid 
[Huawei-GigabitEthernet0/0/1]port	l	
[Huawei-GigabitEthernet0/0/1]port hybrid tagged vlan 10 20 30 
[Huawei-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
 port hybrid tagged vlan 10 20 30
#
return
[Huawei-GigabitEthernet0/0/1]

2.查看网络联通情况

3.查看本征vlan

[Huawei]display port vlan
Port                    Link Type    PVID  Trunk VLAN List
-------------------------------------------------------------------------------
Ethernet0/0/1           hybrid       1     -                                   
Ethernet0/0/2           access       10    -                                   
Ethernet0/0/3           access       20    -                                   
Ethernet0/0/4           hybrid       1     -                                   
Ethernet0/0/5           hybrid       1     -                                   
Ethernet0/0/6           hybrid       1     -                                   
Ethernet0/0/7           hybrid       1     -                                   
Ethernet0/0/8           hybrid       1     -                                   
Ethernet0/0/9           hybrid       1     -                                   
Ethernet0/0/10          hybrid       1     -                                   
Ethernet0/0/11          hybrid       1     -                                   
Ethernet0/0/12          hybrid       1     -                                   
Ethernet0/0/13          hybrid       1     -                                   
Ethernet0/0/14          hybrid       1     -                                   
Ethernet0/0/15          hybrid       1     -                                   
Ethernet0/0/16          hybrid       1     -                                   
Ethernet0/0/17          hybrid       1     -                                   
Ethernet0/0/18          hybrid       1     -                                   
Ethernet0/0/19          hybrid       1     -                                   
Ethernet0/0/20          hybrid       1     -                                   
Ethernet0/0/21          hybrid       1     -                                   
Ethernet0/0/22          hybrid       1     -                                   
GigabitEthernet0/0/1    hybrid       1     10 20 30
GigabitEthernet0/0/2    trunk        1     1 10 20 30

以上是关于华为三层交换机之基本操作的主要内容,如果未能解决你的问题,请参考以下文章

华为三层交换机各vlan间如何实现上网?

华为-vlan 间路由之单臂路由

如何在华为交换机上实现链路聚合

网工必备技术-华为交换技术实战讲解

华为三层交换机配置命令

华为三层交换机VLAN间路由怎么设置