思科三层交换划分VLAN及与其它分部互连
我们的目的为右边的网络通过划分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的配置如下:
- Current configuration : 697 bytes
- !
- version 12.4
- no service timestamps log datetime msec
- no service timestamps debug datetime msec
- no service password-encryption
- !
- hostname KF
- !
- !
- !
- interface FastEthernet0/0
- ip address 10.10.0.82 255.255.252.0
- duplex auto
- speed auto
- !
- interface FastEthernet0/1
- description connect to HZ
- ip address 192.168.10.1 255.255.255.252
- duplex auto
- speed auto
- !
- interface Vlan1
- no ip address
- shutdown
- !
- ip classless
- ip route 192.168.10.4 255.255.255.252 192.168.10.2
- ip route 10.8.0.0 255.255.252.0 192.168.10.2
- ip route 192.168.1.0 255.255.255.0 192.168.10.2
- ip route 192.168.2.0 255.255.255.0 192.168.10.2
- !
- !
- !
- line con 0
- line vty 0 4
- login
- !
- !
- !
- end
route HZ的配置如下:
- Current configuration : 696 bytes
- !
- version 12.4
- no service timestamps log datetime msec
- no service timestamps debug datetime msec
- no service password-encryption
- !
- hostname HZ
- !
- !
- interface FastEthernet0/0
- description connect to KF
- ip address 192.168.10.2 255.255.255.252
- duplex auto
- speed auto
- !
- interface FastEthernet0/1
- ip address 192.168.10.5 255.255.255.252
- http://www.xiaoxiongboke.com
- duplex auto
- speed auto
- !
- interface Vlan1
- no ip address
- shutdown
- !
- ip classless
- ip route 10.10.0.0 255.255.252.0 192.168.10.1
- ip route 10.8.0.0 255.255.252.0 192.168.10.6
- ip route 192.168.1.0 255.255.255.0 192.168.10.6
- ip route 192.168.2.0 255.255.255.0 192.168.10.6
- !
- !
- line con 0
- line vty 0 4
- login
- !
- !
- !
- end
switch core的配置如下:
- Current configuration : 1992 bytes
- !
- version 12.2
- no service timestamps log datetime msec
- no service timestamps debug datetime msec
- no service password-encryption
- !
- hostname HZcore
- !
- !
- !
- !
- interface FastEthernet0/1
- switchport mode access
- !
- interface FastEthernet0/2
- switchport mode access
- !
- interface FastEthernet0/3
- switchport mode access
- !
- interface FastEthernet0/4
- switchport mode access
- !
- interface FastEthernet0/5
- switchport access vlan 2
- switchport mode access
- !
- interface FastEthernet0/6
- switchport access vlan 2
- switchport mode access
- !
- interface FastEthernet0/7
- switchport access vlan 2
- switchport mode access
- !
- interface FastEthernet0/8
- switchport access vlan 2
- switchport mode access
- !
- interface FastEthernet0/9
- switchport access vlan 2
- switchport mode access
- !
- interface FastEthernet0/10
- switchport access vlan 3
- switchport mode access
- !
- interface FastEthernet0/11
- switchport access vlan 3
- switchport mode access
- !
- interface FastEthernet0/12
- switchport access vlan 3
- switchport mode access
- !
- interface FastEthernet0/13
- switchport access vlan 3
- switchport mode access
- !
- interface FastEthernet0/14
- switchport access vlan 3
- switchport mode access
- !
- interface FastEthernet0/15
- switchport access vlan 3
- switchport mode access
- !
- interface FastEthernet0/16
- !
- interface FastEthernet0/17
- !
- interface FastEthernet0/18
- !
- interface FastEthernet0/19
- !
- interface FastEthernet0/20
- !
- interface FastEthernet0/21
- !
- interface FastEthernet0/22
- !
- interface FastEthernet0/23
- !
- interface FastEthernet0/24
- !
- interface GigabitEthernet0/1
- no switchport
- ip address 192.168.10.6 255.255.255.252
- duplex auto
- speed auto
- !
- interface GigabitEthernet0/2
- !
- interface Vlan1
- ip address 10.8.0.62 255.255.252.0
- !
- interface Vlan2
- ip address 192.168.1.1 255.255.255.0
- !
- interface Vlan3
- ip address 192.168.2.1 255.255.255.0
- !
- ip classless
- ip route 192.168.10.0 255.255.255.252 192.168.10.5
- ip route 10.10.0.0 255.255.252.0 192.168.10.5
- !
- !
- line con 0
- line vty 0 4
- login
- !
- !
- !
- 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就大功告成。