如何用三层交换机实现VLAN间通信

实现不同VLAN间通信。
使用eNSP搭建实验环境
在这里插入图片描述

实现此案例需要按照如下步骤进行。

<Huawei>system-view 
[Huawei]vlan 2
[Huawei]vlan 3
[Huawei]interface Ethernet0/0/1
[Huawei-Ethernet0/0/1]port link-type access 
[Huawei-Ethernet0/0/1]port default vlan 1
[Huawei]interface Ethernet0/0/2
[Huawei-Ethernet0/0/2]port link-type access 
[Huawei-Ethernet0/0/2]port default vlan 2
[Huawei]interface Ethernet0/0/3
[Huawei-Ethernet0/0/3]port link-type access 
[Huawei-Ethernet0/0/3]port default vlan 3
[Huawei]dis port vlan
Port                    Link Type    PVID  Trunk VLAN List
-------------------------------------------------------------------------------
Ethernet0/0/1           access       1     -                                   
Ethernet0/0/2           access       2     -                                   
Ethernet0/0/3           access       3     -                                   
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     -                                   
GigabitEthernet0/0/2    hybrid       1     -

2)配置VLAN网关

[Huawei]int Vlanif 1
[Huawei-Vlanif1]ip add 192.168.1.254 24
[Huawei]int Vlanif 2
[Huawei-Vlanif2]ip add 192.168.2.254 24
[Huawei]int Vlanif 3
[Huawei-Vlanif3]ip add 192.168.3.254 24
[Huawei]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 8        Routes : 8        
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.1.0/24  Direct  0    0           D   192.168.1.254   Vlanif1
  192.168.1.254/32  Direct  0    0           D   127.0.0.1       Vlanif1
    192.168.2.0/24  Direct  0    0           D   192.168.2.254   Vlanif2
  192.168.2.254/32  Direct  0    0           D   127.0.0.1       Vlanif2
    192.168.3.0/24  Direct  0    0           D   192.168.3.254   Vlanif3
  192.168.3.254/32  Direct  0    0           D   127.0.0.1       Vlanif3

3)测试PC间互通

发布了396 篇原创文章 · 获赞 56 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/xie_qi_chao/article/details/105147419