实验拓扑:
一、综合实验地址分配方案
子网名称 |
环回接口占用 |
R1局域网 |
R3局域网 |
R1-R2网间网 |
||
地址空间范围 |
1-31/29 |
32-63/27 |
64-95/27 |
112-115/30 |
||
子网名称 |
R2-R3网间网 |
Vlan1 |
VlanX1 |
VlanX2 |
||
地址空间范围 |
116-119/30 |
96-111/28 |
128-191/26 |
192-255/26 |
||
设备名称 |
接口名称 |
分配地址以及子网掩码 |
||||
R1 |
S0/0 |
192.168.1.113/30 252 |
||||
F0/0 |
192.168.1.33/27 224 |
|||||
Loopback0 |
192.168.1.10/29 248 |
|||||
R2 |
S0/0 |
192.168.1.114/30 252 |
||||
S0/1 |
192.168.1.117/30 252 |
|||||
Loopback0 |
192.168.1.20/29 248 |
|||||
F0/0.1 |
192.168.1.97/28 240 |
|||||
F0/0.X1 |
192.168.1.129/26 192 |
|||||
F0/0.X2 |
192.168.1.193/26 192 |
|||||
R3 |
S0/0 |
192.168.1.118/30 252 |
||||
F0/0 |
192.168.1.65/27 224 |
|||||
Loopback0 |
192.168.1.30/29 248 |
|||||
SW1 |
Vlan1 |
192.168.1.98/28 240 |
||||
SW2 |
Vlan1 |
192.168.1.99/28 240 |
||||
SW3 |
Vlan1 |
192.168.1.100/28 240 |
||||
二、可以使用Cisco Packet Tracer 或者GNS模拟器,若使用GNS3需要使用路由器来模拟交换机,使用VPCS来模拟主机可以查看这篇文章
使用GNS3模拟交换机和PC
来自 <http://shenghao.blog.51cto.com/5890026/1194815>
这里使用Cisco Packet Tracer 6.0完全可以完成
三、实验操作
STP要求:SW2为VLAN X1的跟桥,SW3为VLAN X2的跟桥,注意观察接口的状态,哪个接口是阻塞状态?
STP特性:与PC直连的接口设置Portfast .
VLAN:VLAN 1为管理VLAN ,要求给三个交换机都配置管理地址,并且远程可以进行telnet登录;创建VLAN X1和VLAN X2名称分别为NetServer 、TFTPServer
注意:三台交换机不能直接两两相连成环状,由于还未配置生成树协议,会导致环路生成。
SW1(config)#vtp domain ccna
Changing VTP domain name from NULL to ccna
SW1(config)#vtp mode server
Device mode already VTP SERVER.
SW1(config)#vtp version 2
SW1(config)#vtp password cisco
Setting device VLAN database password to cisco
SW1(config)#
SW2(config)#vtp domain ccna
Changing VTP domain name from NULL to ccna
SW2(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW2(config)#vtp pass
SW2(config)#vtp password cisco
Setting device VLAN database password to cisco
SW2(config)#
SW3(config)#vtp domain ccna
Changing VTP domain name from NULL to ccna
SW3(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW3(config)#vtp pass
SW3(config)#vtp password cisco
Setting device VLAN database password to cisco
SW3(config)#
SW1(config)#int vlan 1
SW1(config-if)#ip add 192.168.1.98 255.255.255.240
SW1(config-if)#no shut
SW1(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
SW2(config)#int vlan 1
SW2(config-if)#ip add 192.168.1.99 255.255.255.240
SW2(config-if)#no shut
SW2(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
SW3(config)#int vlan 1
SW3(config-if)#ip add 192.168.1.100 255.255.255.240
SW3(config-if)#no shut
SW3(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SW1(config)#int f0/2
SW1(config-if)#sw
SW1(config-if)#switchport mode trunk
SW1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
SW1(config-if)#
SW1(config-if)#int f0/3
SW1(config-if)#sw
SW1(config-if)#switchport mode trunk
SW1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
SW1(config-if)#
SW2(config)#int range f0/1-2
SW2(config-if-range)#sw
SW2(config-if-range)#switchport mode trunk
SW2(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
SW2(config-if-range)#
SW3(config)#int range f0/1-2
SW3(config-if-range)#sw
SW3(config-if-range)#switchport mode trunk
SW3(config-if-range)#
SW1(vlan)#vlan 11 name NetServer
VLAN 11 added:
Name: NetServer
SW1(vlan)#vlan 12 name TFTPServer
VLAN 12 added:
Name: TFTPServer
SW1(vlan)#
SW1(config)#int range f0/4-12
SW1(config-if-range)#sw mode access
SW1(config-if-range)#sw access vlan 11
SW1(config-if-range)#int range f0/13-24
SW1(config-if-range)#sw mode access
SW1(config-if-range)#sw access vlan 12
SW1(config-if-range)#
SW2(config)#int range f0/4-12
SW2(config-if-range)#sw mode acc
SW2(config-if-range)#sw acc vlan 11
SW2(config-if-range)#int range f0/13-24
SW2(config-if-range)#sw mode acc
SW2(config-if-range)#sw acc vlan 12
SW2(config-if-range)#
SW3(config)#int range f0/4-24
SW3(config-if-range)#sw mode acc
SW3(config-if-range)#sw acc vlan 12
SW3(config-if-range)#
SW2(config)#spanning-tree vlan 11 root primary
SW3(config)#spanning-tree vlan 12 root primary
查看配置结果
SW2#sh spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0006.2A02.8C96
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0006.2A02.8C96
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2 Desg FWD 19 128.2 P2p
Fa0/1 Desg FWD 19 128.1 P2p
VLAN0011
Spanning tree enabled protocol ieee
Root ID Priority 24587
Address 0006.2A02.8C96
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24587 (priority 24576 sys-id-ext 11)
Address 0006.2A02.8C96
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/4 Desg FWD 19 128.4 P2p
Fa0/5 Desg FWD 19 128.5 P2p
Fa0/2 Desg FWD 19 128.2 P2p
Fa0/1 Desg FWD 19 128.1 P2p
VLAN0012
Spanning tree enabled protocol ieee
Root ID Priority 24588
Address 00E0.A3BD.343C
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32780 (priority 32768 sys-id-ext 12)
Address 0006.2A02.8C96
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/2 Root FWD 19 128.2 P2p
Fa0/1 Desg FWD 19 128.1 P2p
R2(config)#int f0/0
R2(config-if)#no ip add
R2(config-if)#no shut
R2(config-if)#int f0/0.1
R2(config-subif)#enca
R2(config-subif)#encapsulation dot1q 1
R2(config-subif)#ip add 192.168.1.97 255.255.255.240
R2(config-subif)#no shut
R2(config-subif)#int f0/0.11
R2(config-subif)#enca
R2(config-subif)#encapsulation dot1q 11
R2(config-subif)#ip add 192.168.1.129 255.255.255.192
R2(config-subif)#no sh
R2(config-subif)#int f0/0.12
R2(config-subif)#enca
R2(config-subif)#encapsulation dot1q 12
R2(config-subif)#ip add 192.168.1.193 255.255.255.192
R2(config-subif)#no shut
R2(config-subif)#
SW1(config)#int f0/1
SW1(config-if)#switchport mode trunk
SW1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
测试vlan间通信
VLAN 11 中的PC2 ping VLAN 12 中的PC5
PC>ping 192.168.1.195
Pinging 192.168.1.195 with 32 bytes of data:
Request timed out.
Reply from 192.168.1.195: bytes=32 time=11ms TTL=127
Reply from 192.168.1.195: bytes=32 time=1ms TTL=127
Reply from 192.168.1.195: bytes=32 time=11ms TTL=127
Ping statistics for 192.168.1.195:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 11ms, Average = 7ms
未完,接下一篇,超过8万字符。。。