A-A+

思科三层交换划分VLAN及与其它分部互连

2015年11月25日 站长资讯 暂无评论

我们的目的为右边的网络通过划分VLAN后,再通过专线与左边的网络能互相通讯。但均为同一公司的两个点,故没有做访问控制ACL。

左边KF公司的IP段为10.10.0.0/22,因公司规模及成本控制,故没有划分VLAN。它通过专线与右边的HZ分公司通讯。网关为10.10.0.82

右边的HZ公司,考虑到其规模及以后发展的需要,我们暂时划分三个VLAN,其中VLAN1 10.8.0.0/22做为服务器群网络。VLAN2和VLAN3分配给不同的事业部。

为了考虑CPU及节省带宽,同时考虑到路由器数,我们在路由器之间采用静态路由。

详细的配置文件如下:

route KF的配置如下:

  1. Current configuration : 697 bytes  
  2. !  
  3. version 12.4  
  4. no service timestamps log datetime msec  
  5. no service timestamps debug datetime msec  
  6. no service password-encryption  
  7. !  
  8. hostname KF  
  9. !  
  10. !  
  11. !  
  12. interface FastEthernet0/0  
  13.  ip address 10.10.0.82 255.255.252.0  
  14.  duplex auto  
  15.  speed auto  
  16. !  
  17. interface FastEthernet0/1  
  18.  description connect to HZ  
  19.  ip address 192.168.10.1 255.255.255.252  
  20.   
  21.   
  22.  duplex auto  
  23.  speed auto  
  24. !  
  25. interface Vlan1  
  26.  no ip address  
  27.  shutdown  
  28. !  
  29. ip classless  
  30. ip route 192.168.10.4 255.255.255.252 192.168.10.2  
  31. ip route 10.8.0.0 255.255.252.0 192.168.10.2  
  32. ip route 192.168.1.0 255.255.255.0 192.168.10.2  
  33. ip route 192.168.2.0 255.255.255.0 192.168.10.2  
  34. !  
  35. !  
  36. !  
  37. line con 0  
  38. line vty 0 4  
  39.  login  
  40. !  
  41. !  
  42. !  
  43. end  

route HZ的配置如下:

  1. Current configuration : 696 bytes  
  2. !  
  3. version 12.4  
  4. no service timestamps log datetime msec  
  5. no service timestamps debug datetime msec  
  6. no service password-encryption  
  7. !  
  8. hostname HZ  
  9. !  
  10. !  
  11. interface FastEthernet0/0  
  12.  description connect to KF  
  13.  ip address 192.168.10.2 255.255.255.252  
  14.  duplex auto  
  15.  speed auto  
  16. !  
  17. interface FastEthernet0/1  
  18.  ip address 192.168.10.5 255.255.255.252   
  19. http://www.xiaoxiongboke.com   
  20.  duplex auto  
  21.  speed auto  
  22. !  
  23. interface Vlan1  
  24.  no ip address  
  25.  shutdown  
  26. !  
  27. ip classless  
  28. ip route 10.10.0.0 255.255.252.0 192.168.10.1  
  29. ip route 10.8.0.0 255.255.252.0 192.168.10.6  
  30. ip route 192.168.1.0 255.255.255.0 192.168.10.6  
  31. ip route 192.168.2.0 255.255.255.0 192.168.10.6  
  32. !  
  33. !  
  34. line con 0  
  35. line vty 0 4  
  36.  login  
  37. !  
  38. !  
  39. !  
  40. end  

switch core的配置如下:

  1. Current configuration : 1992 bytes  
  2. !  
  3. version 12.2  
  4. no service timestamps log datetime msec  
  5. no service timestamps debug datetime msec  
  6. no service password-encryption  
  7. !  
  8. hostname HZcore  
  9. !  
  10. !  
  11. !  
  12. !  
  13. interface FastEthernet0/1  
  14.  switchport mode access  
  15. !  
  16. interface FastEthernet0/2  
  17.  switchport mode access   
  18. !  
  19. interface FastEthernet0/3  
  20.  switchport mode access  
  21. !  
  22. interface FastEthernet0/4  
  23.  switchport mode access  
  24. !  
  25. interface FastEthernet0/5  
  26.  switchport access vlan 2  
  27.  switchport mode access  
  28. !  
  29. interface FastEthernet0/6  
  30.  switchport access vlan 2  
  31.  switchport mode access  
  32. !  
  33. interface FastEthernet0/7  
  34.  switchport access vlan 2  
  35.  switchport mode access  
  36. !  
  37. interface FastEthernet0/8  
  38.  switchport access vlan 2  
  39.  switchport mode access  
  40. !  
  41. interface FastEthernet0/9  
  42.  switchport access vlan 2  
  43.  switchport mode access  
  44. !  
  45. interface FastEthernet0/10  
  46.  switchport access vlan 3  
  47.  switchport mode access  
  48. !  
  49. interface FastEthernet0/11  
  50.  switchport access vlan 3  
  51.  switchport mode access  
  52. !  
  53. interface FastEthernet0/12  
  54.  switchport access vlan 3   
  55.  switchport mode access  
  56. !  
  57. interface FastEthernet0/13  
  58.  switchport access vlan 3  
  59.  switchport mode access  
  60. !  
  61. interface FastEthernet0/14  
  62.  switchport access vlan 3  
  63.  switchport mode access  
  64. !  
  65. interface FastEthernet0/15  
  66.  switchport access vlan 3  
  67.  switchport mode access  
  68. !  
  69. interface FastEthernet0/16  
  70. !  
  71. interface FastEthernet0/17  
  72. !  
  73. interface FastEthernet0/18  
  74. !  
  75. interface FastEthernet0/19  
  76. !  
  77. interface FastEthernet0/20  
  78. !  
  79. interface FastEthernet0/21  
  80. !  
  81. interface FastEthernet0/22  
  82. !  
  83. interface FastEthernet0/23  
  84. !  
  85. interface FastEthernet0/24  
  86. !  
  87. interface GigabitEthernet0/1  
  88.  no switchport  
  89.  ip address 192.168.10.6 255.255.255.252  
  90.  duplex auto  
  91.  speed auto  
  92. !  
  93. interface GigabitEthernet0/2  
  94. !  
  95. interface Vlan1   
  96.  ip address 10.8.0.62 255.255.252.0  
  97. !  
  98. interface Vlan2  
  99.  ip address 192.168.1.1 255.255.255.0  
  100. !  
  101. interface Vlan3  
  102.  ip address 192.168.2.1 255.255.255.0  
  103. !  
  104. ip classless  
  105. ip route 192.168.10.0 255.255.255.252 192.168.10.5  
  106. ip route 10.10.0.0 255.255.252.0 192.168.10.5  
  107. !  
  108. !  
  109. line con 0  
  110. line vty 0 4  
  111.  login  
  112. !  
  113. !  
  114. !  
  115. end  

经过以上配置,就HZ公司的VLAN之间可以正常通讯,并且可以通过路由器正常与KF进行通讯了。

VLAN2的主机ping VLAN3的主机:

PC>ping 192.168.2.8

Pinging 192.168.2.8 with 32 bytes of data:

Reply from 192.168.2.8: bytes=32 time=125ms TTL=127

Reply from 192.168.2.8: bytes=32 time=110ms TTL=127

Reply from 192.168.2.8: bytes=32 time=94ms TTL=127

Reply from 192.168.2.8: bytes=32 time=125ms TTL=127

VLAN2的主机ping VLAN1的主机:

PC>ping 10.8.0.18

Pinging 10.8.0.18 with 32 bytes of data:

Reply from 10.8.0.18: bytes=32 time=94ms TTL=127

Reply from 10.8.0.18: bytes=32 time=110ms TTL=127

Reply from 10.8.0.18: bytes=32 time=125ms TTL=127

Reply from 10.8.0.18: bytes=32 time=108ms TTL=127

VLAN2的主机ping KF的主机:

PC>ping 10.10.0.13

Pinging 10.10.0.13 with 32 bytes of data:

Reply from 10.10.0.13: bytes=32 time=125ms TTL=125

Reply from 10.10.0.13: bytes=32 time=172ms TTL=125

Reply from 10.10.0.13: bytes=32 time=156ms TTL=125

Reply from 10.10.0.13: bytes=32 time=157ms TTL=125

及tracert:

PC>tracert 10.10.0.13

Tracing route to 10.10.0.13 over a maximum of 30 hops:

1 47 ms 63 ms 63 ms 192.168.1.1

2 94 ms 94 ms 94 ms 192.168.10.5

3 125 ms 109 ms 109 ms 192.168.10.1

4 188 ms 172 ms 156 ms 10.10.0.13

Trace complete.

至此,思科三层交换机和划分vlan就大功告成。

标签:

给我留言