CISCO VTP和VLAN实验

0D783A6D-A508-4348-A6EA-8DCAFB4B11B1

这是我做实验的时候简单架构的一个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,以上实验完成!

转载请注明:运维派 » CISCO VTP和VLAN实验

0
2.8k
0