多个交换机的vlan划分
一.实现目标
1.                 单个交换机的vlan划分
2.               保证vlan之间的通信
3.              多个交换机的vlan的划分
4.               保证单个vlan之间的通信
5.               路由的设置
6.               不同vlan的路由通信
二.拓扑结构图
 
 
多个交换机的vlan划分_职场
 
Pc的配置
 Pc0 ip add 192.168.1.2 gw 192.168.1.1
 Pc1 ip add 192.168.1.3 gw 192.168.1.1
 Pc2 ip add 192.168.2.2 gw 192.168.2.1
 Pc3 ip add 192.168.2.3 gw 192.168.2.1
 Pc4 ip add 192.168.2.3 gw 192.168.3.1
 Pc5 ip add 192.168.2.3 gw 192.168.3.1
一.实验过程
1.      交换机的是switch0的配置
Switch#conf t
Switch<config> # hostname switcha
Switch <config> #end
Switch # vlan data
Switch<vlan>#vtp server
Switch <vlan>#vtp domain ddd
Switch <vlan>#vlan 2 name vlan2
Switch <vlan>#vlan 3 name vlan3
Switch <vlan>#vlan 4 name vlan4
Switch <vlan>#exit
Switch#conf t
Switch<config> #int fa0/1
Switch <config-if>#switchport mode trunk
Switch<config-if>#end
Switch#conf t
Switch<config> #int fa0/10
Switch<config-if>#switchport access vlan 2
Switch#conf t
Switch<config> #int fa0/11
Switch<config-if>#switchport access vlan 3
Switch#conf t
Switch<config> #int fa0/12
Switch<config-if>#switchport access vlan 4
2.交换机switch3的配置
Switch#vlan data
Switch<vlan>#vtp client
Switch <vlan>#vtp domain ddd
Switch <vlan>#exit
Switch#conf t
Switch <config>#int fa0/1
Switch <config-ig># switchport mode trunk
Switch <config-if>#end
3.路由的配置
Router # config t
Router <config>#hostname vlan
Router <config>#int fa0/0
Router <config-if>#no shut
Router <config-if>#no ip address
Router <config-if>#end
Router # config t
 
Router <config>#int fa0/0.7
Router <config-subif>#enca dot1q 2
Router <config-subif># ip add 192.168.1.1 255.255.255.0
Router <config-subif>#no shut
Router <config-subif># end
Router # config t
 
Router <config>#int fa0/0.8
Router <config-subif>#enca dot1q 3
Router <config-subif># ip add 192.168.2.1 255.255.255.0
Router <config-subif>#no shut
Router <config-subif># end
Router # config t
 
Router <config>#int fa0/0.9
Router <config-subif>#enca dot1q 4
Router <config-subif># ip add 192.168.3.1 255.255.255.0
Router <config-subif>#no shut
Router <config-subif># end
3. 检查各个vlan之间是否可以通信
  A:没有加路由的情况下vlan之间的通信
Vlan2vlan3 之间的通信
  PC>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.2.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
              Vlan2vlan4之间的通信
PC>ping 192.168.3.2
Pinging 192.168.3.2 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.3.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
 
Vlan2vlan3的通信
Packet Tracer PC Command Line 1.0
PC>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.2: bytes=32 time=156ms TTL=127
Reply from 192.168.2.2: bytes=32 time=188ms TTL=127
Reply from 192.168.2.2: bytes=32 time=202ms TTL=127
Reply from 192.168.2.2: bytes=32 time=182ms TTL=127
Ping statistics for 192.168.2.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 156ms, Maximum = 202ms, Average = 182ms
Vlan2vlan4的通信
PC>ping 192.168.3.2
 
Pinging 192.168.3.2 with 32 bytes of data:
 
Reply from 192.168.3.2: bytes=32 time=172ms TTL=127
Reply from 192.168.3.2: bytes=32 time=171ms TTL=127
Reply from 192.168.3.2: bytes=32 time=187ms TTL=127
Reply from 192.168.3.2: bytes=32 time=174ms TTL=127
 
Ping statistics for 192.168.3.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 171ms, Maximum = 187ms, Average = 176ms
Vlan3vlan4 的通信
Packet Tracer PC Command Line 1.0
PC>ping 192.168.3.2
Pinging 192.168.3.2 with 32 bytes of data:
Reply from 192.168.3.2: bytes=32 time=156ms TTL=127
Reply from 192.168.3.2: bytes=32 time=171ms TTL=127
Reply from 192.168.3.2: bytes=32 time=168ms TTL=127
Reply from 192.168.3.2: bytes=32 time=160ms TTL=127
Ping statistics for 192.168.3.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 156ms, Maximum = 171ms, Average = 163ms
 
PC>ping 192.168.3.3
Pinging 192.168.3.3 with 32 bytes of data:
Request timed out.
Reply from 192.168.3.3: bytes=32 time=142ms TTL=127
Reply from 192.168.3.3: bytes=32 time=141ms TTL=127
Reply from 192.168.3.3: bytes=32 time=140ms TTL=127
Ping statistics for 192.168.3.3:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 140ms, Maximum = 142ms, Average = 141ms
 
 
二.总结
1.      在没有路由的情况下vlan之间是不能通信的。
2.   通过路由可以解决不同vlan之间的信
3.  不同交换机的vlan的划分可以更加的有利于不同网络的安全。