ROS软路由论坛 ROSABC.com 网络方案网络工程交流

 找回密码
 会员注册

QQ登录

只需一步,快速开始

查看: 6803|回复: 4

[海蜘蛛虚拟局域网(VLAN)配置]

[复制链接]
发表于 2013-4-24 11:33:05 | 显示全部楼层 |阅读模式

马上注册成为ROSABC会员,随时发帖回复。

您需要 登录 才可以下载或查看,没有账号?会员注册

x
本帖最后由 huixinkeji 于 2013-4-24 11:38 编辑

虚拟局域网(VLAN)
虚拟局域网简介
  • 虚拟局域网概念
    VLAN(Virtual Local Area Network)即虚拟局域网, 是一种通过将局域网内的设备逻辑地而不是物理地划分成一个个网段从而实现虚拟工作组的新兴技术。
  • 虚拟局域网的优点
    • 限制广播域。广播域被限制在一个VLAN内,节省了带宽,提高了网络处理能力。
    • 增强局域网的安全性。不同VLAN内的报文在传输时是相互隔离的,即一个VLAN内的用户不能和其它VLAN内的用户直接通信,如果不同VLAN要进行通信,则需要通过路由器或三层交换机等网络设备。
    • 灵活构建虚拟工作组。用VLAN可以划分不同的用户到不同的工作组,同一工作组的用户也不必局限于某一固定的物理范围,网络构建和维护更方便灵活。
    • 可启用DHCP服务给不同的VLAN网段分配各自的IP地址池,对网络客户机自动分配IP地址,有效地防止网络上计算机配置地址的冲突。
    • 局域网内所有客户机都可采用PPPoE 拨号到网关通过网关的实现共享上网,用户只需设置拨号账户即可方便入网。




路由上划分VLAN

有如下网络拓扑图:
router_vlan_tuopu.png

图 :某公司的网络拓扑图


中继接口使用 802.11q 封装,允许所有VLAN访问,在这种情况下,交换机上不需要设置默认路由。
海蜘蛛路由的LAN口主IP地址为192.168.0.254,并建立了4个逻辑VLAN,和交换机上的VLAN相对应。
DHCP服务器对VLAN-1/2/3/4 提供IP分配,每个VLAN获取对应网段的地址,即:

  • VLAN-1 下的机器获得 192.168.1.0/255.255.255.0 段的IP
  • VLAN-2 下的机器获得 192.168.2.0/255.255.255.0 段的IP
  • VLAN-3 下的机器获得 192.168.3.0/255.255.255.0 段的IP
  • VLAN-4 下的机器获得 192.168.4.0/255.255.255.0 段的IP


4.6.2.1.1. 路由器设置
  • 划分vlan
    “网络设置”->“VLAN 虚拟局域网”,新增VLAN网段,配置如下图所示:
    route_vlan_con_1.png

    图 :VLAN网段配置


    note.png
    提示
    这里VLAN_ID号必须大于1小于4096 。VLAN_ID与交换机上划分的VLAN_ID号需一一对应。在这种方法下不需要在海蜘蛛上添加静态路由和VLAN网络地址。



交换机设置
  1. 此为H3C S3600交换机的设置
  2. DIS current-configuration
  3. #
  4. sysname SystemTest
  5. #
  6. radius scheme system
  7. #
  8. domain system
  9. #
  10. local-user admin
  11. password simple admin
  12. service-type telnet
  13. level 3
  14. local-user sxy
  15. password simple sxy
  16. service-type telnet
  17. #
  18. vlan 1
  19. #
  20. vlan 100
  21. description Test1
  22. #
  23. vlan 200
  24. description Test2
  25. #
  26. vlan 300
  27. description Test3
  28. #
  29. vlan 400
  30. description Test4
  31. #
  32. interface Vlan-interface1
  33. ip address 192.168.0.1 255.255.255.0
  34. #
  35. interface Vlan-interface100
  36. ip address 192.168.1.1 255.255.255.0
  37. #
  38. interface Vlan-interface200
  39. ip address 192.168.2.1 255.255.255.0
  40. #
  41. interface Vlan-interface300
  42. ip address 192.168.3.1 255.255.255.0
  43. #
  44. interface Vlan-interface400
  45. ip address 192.168.4.1 255.255.255.0
  46. #
  47. interface Aux1/0/0
  48. #
  49. interface Ethernet1/0/1
  50. port access vlan 100
  51. #
  52. interface Ethernet1/0/2
  53. port access vlan 100
  54. #
  55. interface Ethernet1/0/3
  56. port access vlan 100
  57. #
  58. interface Ethernet1/0/4
  59. port access vlan 100
  60. #
  61. interface Ethernet1/0/5
  62. port access vlan 100
  63. #
  64. interface Ethernet1/0/6
  65. port access vlan 100
  66. #
  67. interface Ethernet1/0/7
  68. port access vlan 200
  69. #
  70. interface Ethernet1/0/8
  71. port access vlan 200
  72. #
  73. interface Ethernet1/0/9
  74. port access vlan 200
  75. #
  76. interface Ethernet1/0/10
  77. port access vlan 200
  78. #
  79. interface Ethernet1/0/11
  80. port access vlan 200
  81. #
  82. interface Ethernet1/0/12
  83. port access vlan 200
  84. #
  85. interface Ethernet1/0/13
  86. port access vlan 300
  87. #
  88. interface Ethernet1/0/14
  89. port access vlan 300
  90. #
  91. interface Ethernet1/0/15
  92. port access vlan 300
  93. #
  94. interface Ethernet1/0/16
  95. port access vlan 300
  96. #
  97. interface Ethernet1/0/17
  98. port access vlan 300
  99. #
  100. interface Ethernet1/0/18
  101. port access vlan 300
  102. #
  103. interface Ethernet1/0/19
  104. port access vlan 400
  105. #
  106. interface Ethernet1/0/20
  107. port access vlan 400
  108. #
  109. interface Ethernet1/0/21
  110. port access vlan 400
  111. #
  112. interface Ethernet1/0/22
  113. port access vlan 400
  114. #
  115. interface Ethernet1/0/23
  116. port access vlan 400
  117. #
  118. interface Ethernet1/0/24
  119. port link-type trunk
  120. port trunk permit vlan 1 100 200 300 400
  121. #
  122. interface GigabitEthernet1/1/1
  123. #
  124. interface GigabitEthernet1/1/2
  125. #
  126. interface GigabitEthernet1/1/3
  127. #
  128. interface GigabitEthernet1/1/4
  129. #
  130. undo irf-fabric authentication-mode
  131. #
  132. interface NULL0
  133. ##
  134. voice vlan mac-address 0001-e300-0000 mask ffff-ff00-0000
  135. #
  136. user-interface aux 0 7
  137. user-interface vty 0
  138. authentication-mode none
  139. user privilege level 3
  140. history-command max-size 20
  141. idle-timeout 6 0
  142. screen-length 30
  143. protocol inbound telnet
  144. user-interface vty 1 4
  145. #
  146. return
复制代码
测试
使用ping测试工具来测试VLAN划分后网络连接是否正常,这里以192.168.2.0网段为例
  • 检查客户机IP地址设置是否正确
    route_vlan_test_1.jpg

    图 : 客户机IP地址实例
  • 客户机是否可以ping通网关
    route_vlan_test_2.png

    图 :客户机ping网关


    若ping的通,则VLAN配置成功;若ping不通网关,测试客户机是否可以ping通交换机VLAN接口IP地址
    route_vlan_test_3.png

    图 :客户机ping交换机vlan接口IP地址


    这里一般都可以ping通,若ping不通,检查物理线路连接;若ping的通,测试是否可以ping通中继接口IP
    route_vlan_test_4.png

    图 :客户机ping中继接口IP地址


    若ping不通,通过以下方法检测:
    1.检查是否在交换机上配置了中继口以及中继口是否设置了允许所有VLAN通过
    2.物理网络连接是否正确,路由与三层交换机之间不能存在其它硬件设配(集线器、网桥、交换机、路由器等等)
  • 默认情况下,路由允许各VLAN之间访问,下面以访问VLAN3网段为例
    route_vlan_test_5.png

    图 :客户机ping 交换机 VLAN3 接口的IP地址


    route_vlan_test_6.png

    图 :客户机ping VLAN3 网段中某一个客户机的IP地址


    若不通,检测客户机是否开启了防火墙。







发表于 2014-10-30 16:33:22 | 显示全部楼层
新手学习,请多赐教。
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

不良信息举报Q:2000617

软路由

不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流

GMT+8, 2025-8-5 05:05 , Processed in 0.279546 second(s), 25 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表