CISCO VTP和VLAN實驗
這是我做實驗的時候簡單架構的一個top圖。我將s1作為核心交換機,s2和s3作為接入層的交換機進行配置。
在這次實驗當中接入層的每臺交換機接入兩臺pc,分別連入交換機的fa0/1 和fa0/2。但是,兩個口分入不同的vlan,來測試trunk。
vlan2的ip是192.168.1.1/24
vlan3的ip是192.168.2.1/24
下面是三臺交換機的vlan配置:
1)首先是s1交換機
en
conf t
int gi1/1
sw mode trunk
int gi1/2
sw mode trunk
exit
2)s2的配置
en
conf t
int gi1/1
sw mode trunk
exit
vlan 2
name office
exit
int vlan 2
ip add 192.168.1.1 255.255.255.0
exit
int fa0/1
sw access vlan 2
exit
vlan 3
name network
exit
int vlan 3
ip add 192.168.2.1 255.255.255.0
exit
int fa0/2
sw access vlan 3
3)s3的配置
en
conf t
int gi1/1
sw mode trunk
exit
vlan 2
name office
exit
int vlan 2
ip add 192.168.1.1 255.255.255.0
exit
int fa0/1
sw access vlan 2
exit
vlan 3
name network
exit
int vlan 3
ip add 192.168.2.1 255.255.255.0
exit
int fa0/2
sw access vlan 3
配置完畢,將pc機的ip配置好後,我們來測試一下:
1)首先用192.168.1.2的pc機ping s3的192.168.1.5,結果如下:
Packet Tracer PC Command Line 1.0
PC>ping 192.168.1.5
Pinging 192.168.1.5 with 32 bytes of data:
Reply from 192.168.1.5: bytes=32 time=125ms TTL=128
Reply from 192.168.1.5: bytes=32 time=125ms TTL=128
Reply from 192.168.1.5: bytes=32 time=156ms TTL=128
Reply from 192.168.1.5: bytes=32 time=109ms TTL=128
Ping statistics for 192.168.1.5:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 109ms, Maximum = 156ms, Average = 128ms
經過測試是可以連通的。
2)再用192.168.1.2的pc機ping s3的192.168.2.4,結果如下:
PC>ping 192.168.2.4
Pinging 192.168.2.4 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.2.4:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
不通,說明在相同vlan下,trunk建立成功。
3)我們再ping一下同交換機的不同vlan:
首先用s2交換機的192.168.1.2 ping 192.168.2.3 結果如下:
PC>ping 192.168.2.3
Pinging 192.168.2.3 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.2.3:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
不通,說明成功。
4)下面我們來做vtp
在s1上面如下設定
en
conf t
vtp domain office
vtp mode server
s2交換機如下設定
en
conf t
vtp domain office
vtp mode client
s3如下設定
en
conf t
vtp domain office
vtp mode client
然後可以用show vtp st 來檢視一下如何。
OK,以上實驗完成!