基于端口的VLAN典型配置指导
创始人
2024-07-22 14:41:48
0

VLAN典型配置全过程如下:

组网图

基于端口的VLAN典型配置指导

图1-1 基于端口的VLAN组网示意图

应用要求

如图1-1所示,Switch A和Switch B分别连接了不同部门使用的Host1/Host2和Server1/Server2。

为保证部门间数据的二层隔离,现要求将Host1和Server1划分到VLAN100中,Host2和Server2划分到VLAN200中。并分别为两个VLAN设置描述字符为“Dept1”和“Dept2”。

在SwitchA上配置VLAN接口,对Host1发往Server2的数据进行三层转发。

适用产品、版本

表1-1 配置适用的产品与软硬件版本关系

 配置过程和解释

配置Switch A

  1. # 创建VLAN100,并配置VLAN100的描述字符串为“Dept1”,将端口GigabitEthernet1/0/1加入到VLAN100。  
  2.  
  3.  system-view  
  4.  
  5. [SwitchA] vlan 100  
  6.  
  7. [SwitchA-vlan100] description Dept1  
  8.  
  9. [SwitchA-vlan100] port GigabitEthernet 1/0/1  
  10.  
  11. [SwitchA-vlan100] quit  
  12.  
  13. # 创建VLAN200,并配置VLAN200的描述字符串为“Dept2”。  
  14.  
  15. [SwitchA] vlan 200  
  16.  
  17. [SwitchA-vlan200] description Dept2  
  18.  
  19. [SwitchA-vlan200] quit  
  20.  
  21. # 创建VLAN100和VLAN200的接口,IP地址分别配置为192.168.1.1和192.168.2.1,用来对Host1发往Server2的报文进行三层转发。  
  22.  
  23. [SwitchA] interface Vlan-interface 100  
  24.  
  25. [SwitchA-Vlan-interface100] ip address 192.168.1.1 24  
  26.  
  27. [SwitchA-Vlan-interface100] quit  
  28.  
  29. [SwitchA] interface Vlan-interface 200  
  30.  
  31. [SwitchA-Vlan-interface200] ip address 192.168.2.1 24 

配置Switch B

  1. # 创建VLAN100,并配置VLAN100的描述字符串为“Dept1”,将端口GigabitEthernet1/0/13加入到VLAN100。  
  2.  
  3.  system-view  
  4.  
  5. [SwitchB] vlan 100  
  6.  
  7. [SwitchB-vlan100] description Dept1  
  8.  
  9. [SwitchB-vlan100] port GigabitEthernet 1/0/13  
  10.  
  11. [SwitchB-vlan100] quit  
  12.  
  13. # 创建VLAN200,并配置VLAN200的描述字符串为“Dept2”,将端口GigabitEthernet1/0/11和GigabitEthernet1/0/12加入到VLAN200。  
  14.  
  15. [SwitchB] vlan 200  
  16.  
  17. [SwitchB-vlan200] description Dept2  
  18.  
  19. [SwotchB-vlan200] port GigabitEthernet1/0/11 GigabitEthernet 1/0/12  
  20.  
  21. [SwitchB-vlan200] quit 

配置Switch A和Switch B之间的链路

由于Switch A和Switch B之间的链路需要同时传输VLAN100和VLAN200的数据,所以可以配置两端的端口为Trunk端口,且允许这两个VLAN的报文通过。

  1. # 配置Switch A的GigabitEthernet1/0/2端口。
  2.  
  3. [SwitchA] interface GigabitEthernet 1/0/2  
  4.  
  5. [SwitchA-GigabitEthernet1/0/2] port link-type trunk  
  6.  
  7. [SwitchA-GigabitEthernet1/0/2] port trunk permit vlan 100 200  
  8.  
  9. # 配置Switch B的GigabitEthernet1/0/10端口。  
  10.  
  11. [SwitchB] interface GigabitEthernet 1/0/10  
  12.  
  13. [SwitchB-GigabitEthernet1/0/10] port link-type trunk  
  14.  
  15. [SwitchB-GigabitEthernet1/0/10] port trunk permit vlan 100 200 

 完整配置

SwitchA上的配置

  1. #  
  2. vlan 100  
  3. description dept1  
  4. #  
  5. vlan 200  
  6. description dept2  
  7. #  
  8. interface Vlan-interface 100  
  9. ip address 192.168.1.1 255.255.255.0  
  10. #  
  11. interface Vlan-interface 200  
  12. ip address 192.168.2.1 255.255.255.0  
  13. #  
  14. interface GigabitEthernet1/0/1  
  15. port access vlan 100  
  16. #  
  17. interface GigabitEthernet1/0/2  
  18. port link-type trunk  
  19. port trunk permit vlan 1 100 200 

SwitchB上的配置

  1. #  
  2. vlan 100  
  3. description dept1  
  4. #  
  5. vlan 200  
  6. description dept2  
  7. #  
  8. interface GigabitEthernet1/0/10  
  9. port link-type trunk  
  10. port trunk permit vlan 1 100 200  
  11. #  
  12. interface GigabitEthernet1/0/11  
  13. port access vlan 100  
  14. #  
  15. interface GigabitEthernet1/0/12  
  16. port access vlan 200  
  17. #  
  18. interface GigabitEthernet1/0/13  
  19. port access vlan 100 

 VLAN的典型配置过程到这里就结束了,希望大家已经掌握了,我们还会在今后的文章中继续向大家介绍相关知识的。

【编辑推荐】

  1. 交换机配置基础:交换机VLAN接口静态IP地址配置
  2. 交换机配置基础:VLAN接口动态获取IP地址配置
  3. 中低端交换机典型配置之交换机基于端口VLAN应用配置

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
各种千兆交换机的数据接口类型详... 千兆交换机有很多值得学习的地方,这里我们主要介绍各种千兆交换机的数据接口类型,作为局域网的主要连接设...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
Windows恶意软件20年“... 在Windows的早期年代,病毒游走于系统之间,偶尔删除文件(但被删除的文件几乎都是可恢复的),并弹...
规避非法攻击 用好路由器远程管... 单位在市区不同位置设立了科技服务点,每一个服务点的员工都通过宽带路由器进行共享上网,和单位网络保持联...
范例解读VB.NET获取环境变... VB.NET编程语言的使用范围非常广泛,可以帮助开发人员处理各种程序中的需求,而且还能对移动设备进行...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...