本实验知识点有vlan,vlan间路由,VLAN的vtp协议,DHCP协议,热备份路由协议(HSRP协议),多vlan生成树协议(pvst),实验目的就是加入上述协议实现主机间的通信。在实际中也是应用很广泛的。PT6.2版本做的实验,6.0版本以下不支持。请大家关照
第一步:先把每个交换机上各个接口起TRUNK模式(除了接PC的接口)
SW1
Switch>
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW1
SW1(config)#int range fa 0/8-11
SW1(config-if-range)#swi
SW1(config-if-range)#switchport r
SW1(config-if-range)#switchport t
SW1(config-if-range)#switchport trunk en
SW1(config-if-range)#switchport trunk encapsulation d
SW1(config-if-range)#switchport trunk encapsulation dot1q
SW1(config-if-range)#swi
SW1(config-if-range)#switchport mode t
SW1(config-if-range)#switchport mode trunk
这种方法就是把各个接口都封装成dot1q,思科三层交换机端口对于vlan间路由默认有两种封装协议即802.1q,也就是dot1q,另一种协议就是ISL协议,为思科私有。若不封装特定协议就直接打switchport mode trunk的话,三层交换机自身将无法选择协议去封装,这样就无法把端口设为TRUNK模式。必须指定一种协议,这里我们用公用协议dot1q。
还有一种方法也可起TRUNK
SW1(config)#int range fa 0/8-11
SW1(config-if-range)#swi
SW1(config-if-range)#switchport mode ac
SW1(config-if-range)#switchport mode access
SW1(config-if-range)#switchport mode t
SW1(config-if-range)#switchport mode trunk
这种方法就是先把端口设为access接口模式,这样就默认封装了dot1q协议,也能起TRUNK。
思科二层交换机默认封装的是dot1q协议。所以可以直接TRUNK。
SW2
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW2
SW2(config)#int range fa 0/8-11
SW2(config-if-range)#swi
SW2(config-if-range)#switchport t
SW2(config-if-range)#switchport trunk e
SW2(config-if-range)#switchport trunk encapsulation d
SW2(config-if-range)#switchport trunk encapsulation dot1q
SW2(config-if-range)#swi
SW2(config-if-range)#switchport mode t
SW2(config-if-range)#switchport mode trunk
SW2(config-if-range)#
SW3
Switch>
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW3
SW3(config)#int range fa 0/10-11
SW3(config-if-range)#swi
SW3(config-if-range)#switchport mode t
SW3(config-if-range)#switchport mode trunk
SW4
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW4
SW4(config)#int range fa 0/10-11
SW4(config-if-range)#swi
SW4(config-if-range)#switchport mode t
SW4(config-if-range)#switchport mode trunk
第二步:分别把SW1和SW2的fa0/8和fa0/9端口进行端口汇聚。
SW1:
SW1(config)#
SW1(config)#
SW1(config)#int range fa 0/8-9
SW1(config-if-range)#channel-g
SW1(config-if-range)#channel-group 1 ?
mode Etherchannel Mode of the interface
SW1(config-if-range)#channel-group 1 mode ?
active Enable LACP unconditionally
auto Enable PAgP only if a PAgP device is detected
desirable Enable PAgP unconditionally
on Enable Etherchannel only
passive Enable LACP only if a LACP device is detected
SW1(config-if-range)#channel-group 1 mode on
SW1(config-if-range)#
Creating a port-channel interface Port-channel 1
%LINK-5-CHANGED: Interface Port-channel 1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/9, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/9, changed state to up
SW2:
SW2(config)#
SW2(config)#
SW2(config)#int range fa 0/8-9
SW2(config-if-range)#channel-g
SW2(config-if-range)#channel-group 1 mode on 把这两个端口加入汇聚组1
SW2(config-if-range)#
Creating a port-channel interface Port-channel 1
%LINK-5-CHANGED: Interface Port-channel 1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/9, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/9, changed state to up
咱们在特权模式下来查看一下
SW2#
SW2#show et
SW2#show etherchannel s
SW2#show etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+----------------------------------------------
1 Po1(SU) - Fa0/8(P) Fa0/9(P)
怎么样,S表示是二层汇聚,U表示已经应用,P代表已加入汇聚组1了
再来查查SW1的汇聚情况
SW1#
SW1#show et
SW1#show etherchannel s
SW1#show etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+----------------------------------------------
1 Po1(SU) - Fa0/8(P) Fa0/9(P)
OK,做汇聚是不是很简单,just so so.....呵呵
第三步:设SW1上为VTP的服务器,其他就是客户端模式咯,对吧!
SW1#
SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#vtp mode s
SW1(config)#vtp mode server 设为服务器
Device mode already VTP SERVER.
SW1(config)#vtp do
SW1(config)#vtp domain liuye 设置一个域名,就liuye,也就是我名字。刘烨.
Changing VTP domain name from QQ to liuye
SW1(config)#vtp pa
SW1(config)#vtp password 123456 设密码为123456,不设也行,这里演示下,那我就把密码删掉,不要密码。好, 删掉....
SW1(config)#no vtp pa
SW1(config)#no vtp password 123456
Clearing device VLAN database password. 显示已清除密码。
SW2
SW2>en
SW2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW2(config)#vtp mode c
SW2(config)#vtp mode client
Device mode already VTP CLIENT.
SW2(config)#vtp domain liuye
Domain name already set to liuye.
SW3
SW3>en
SW3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW3(config)#vtp mode c
SW3(config)#vtp mode client
Device mode already VTP CLIENT.
SW3(config)#vtp domain liuye
Domain name already set to liuye.
SW4
SW4>en
SW4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW4(config)#vtp mode c
SW4(config)#vtp mode client
Device mode already VTP CLIENT.
SW4(config)#vtp domain liuye
Domain name already set to liuye.
接下来在SW1上创建vlan10,vlan20,vlan30,vlan40
SW1#
SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#vlan 10
SW1(config-vlan)#ex
SW1(config)#vlan 20
SW1(config-vlan)#ex
SW1(config)#vlan 30
SW1(config-vlan)#ex
SW1(config)#vlan 40
SW1(config-vlan)#ex
查看下vlan创建了吗?
SW1(config)#do show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/1, Gig0/2
10 VLAN0010 active
20 VLAN0020 active
30 VLAN0030 active
40 VLAN0040 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
30 enet 100030 1500 - - - - - 0 0
40 enet 100040 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 0 0
1003 tr 101003 1500 - - - - - 0 0
1004 fdnet 101004 1500 - - - ieee - 0 0
1005 trnet 101005 1500 - - - ibm - 0 0
Remote SPAN VLANs
------------------------------------------------------------------------------
创建好了,查看SW2和SW3和SW4.
SW2#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/1, Gig0/2
10 VLAN0010 active
20 VLAN0020 active
30 VLAN0030 active
40 VLAN0040 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
SW2学到了
SW3#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24, Gig0/1, Gig0/2
10 VLAN0010 active
20 VLAN0020 active
30 VLAN0030 active
40 VLAN0040 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
SW3也学到了
SW4#
SW4#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24, Gig0/1, Gig0/2
10 VLAN0010 active
20 VLAN0020 active
30 VLAN0030 active
40 VLAN0040 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
SW4也学到了,OK。
第四步:在SW3和SW4把相关端口划入各个vlan
SW3
SW3#
SW3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW3(config)#int range fa 0/1-2
SW3(config-if-range)#swi
SW3(config-if-range)#switchport ac
SW3(config-if-range)#switchport access vlan 10
SW3(config-if-range)#ex
SW3(config)#int range fa 0/3-4
SW3(config-if-range)#swi
SW3(config-if-range)#switchport ac
SW3(config-if-range)#switchport access vlan 20
还是好习惯,查看下
SW3#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24, Gig0/1, Gig0/2
10 VLAN0010 active Fa0/1, Fa0/2
20 VLAN0020 active Fa0/3, Fa0/4
30 VLAN0030 active
40 VLAN0040 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
配置好了
SW4
SW4#
SW4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW4(config)#int range fa 0/1-2
SW4(config-if-range)#swi
SW4(config-if-range)#switchport ac
SW4(config-if-range)#switchport access vlan 30
SW4(config-if-range)#ex
SW4(config)#int range fa 0/3-4
SW4(config-if-range)#swi
SW4(config-if-range)#switchport ac
SW4(config-if-range)#switchport access vlan 40
查看
SW4#
SW4#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24, Gig0/1, Gig0/2
10 VLAN0010 active
20 VLAN0020 active
30 VLAN0030 active Fa0/1, Fa0/2
40 VLAN0040 active Fa0/3, Fa0/4
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
第五步:进入SW1和SW2内的各个vlan,配上ip地址,然后在SW1上创建DHCP服务器
在SW1内的各个vlan,配上IP地址。
SW1(config)#
SW1(config)#
SW1(config)#int vlan 10
SW1(config-if)#ip ad 192.168.1.254 255.255.255.0
SW1(config-if)#ex
SW1(config)#int vlan 20
SW1(config-if)#ip ad 192.168.2.254 255.255.255.0
SW1(config-if)#ex
SW1(config)#int vlan 30
SW1(config-if)#ip ad 192.168.3.254 255.255.255.0
SW1(config-if)#ex
SW1(config)#int vlan 40
SW1(config-if)#ip ad 192.168.4.254 255.255.255.0
SW1(config-if)#ex
在SW2内配置各个vlan的ip地址,不能和SW1重复
SW2#
SW2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW2(config)#int vlan 10
SW2(config-if)#ip ad 192.168.1.253 255.255.255.0
SW2(config-if)#ex
SW2(config)#int vlan 20
SW2(config-if)#ip ad 192.168.2.253 255.255.255.0
SW2(config-if)#ex
SW2(config)#int vlan 30
SW2(config-if)#ip ad 192.168.3.253 255.255.255.0
SW2(config-if)#ex
SW2(config)#int vlan 40
SW2(config-if)#ip ad 192.168.4.253 255.255.255.0
在SW1上创建DHCP服务器
SW1(config)#ip dh
SW1(config)#ip dhcp pool 1 设一个名为1的地址池
SW1(dhcp-config)#ne
SW1(dhcp-config)#network 192.168.1.0 255.255.255.0 设为vlan10内的网段
SW1(dhcp-config)#de
SW1(dhcp-config)#default-router 192.168.1.254 默认网关
SW1(dhcp-config)#ex
SW1(config)#ip dh
SW1(config)#ip dhcp pool 2 设一个名为2的地址池
SW1(dhcp-config)#ne
SW1(dhcp-config)#network 192.168.2.0 255.255.255.0 设为vlan20内的网段
SW1(dhcp-config)#de
SW1(dhcp-config)#default-router
SW1(dhcp-config)#default-router 192.168.2.254 默认网关
SW1(dhcp-config)#ex
SW1(config)#ip dh
SW1(config)#ip dhcp pool 3 设一个名为3的地址池
SW1(dhcp-config)#ne
SW1(dhcp-config)#network 192.168.3.0 255.255.255.0 设为vlan30内的网段
SW1(dhcp-config)#de
SW1(dhcp-config)#default-router 192.168.3.254 默认网关
SW1(dhcp-config)#ex
SW1(config)#ip dhcp pool 4 设一个名为4的地址池
SW1(dhcp-config)#ne
SW1(dhcp-config)#network 192.168.4.0 255.255.255.0 设为vlan40内的网段
SW1(dhcp-config)#de
SW1(dhcp-config)#default-router 192.168.4.254 默认网关
SW1(dhcp-config)#ex
当vlan10内的主机向SW1上的DHCP服务器请求ip地址时,服务器会看符合vlan10地址是什么,它一看vlan10的ip地址是192.168.1.254,所以它就会从192.168.1.0这个网段拿出地址分配给vlan10内的主机。这是我通俗的解释,详细的在这上是说不完的。 vlan20,30,40也是这样道理。
这里提一下,还要开启SW1和SW2的路由功能,很多人做实验,往往都会忽略这一点。
SW1(config)#ip routing
SW2(config)#ip routing
这个时候你在用PC自动获取ip,就能获取到了。
第六步:多vlan生成树(pvst),设SW1为vlan10和vlan20的主根,为vlan30和vlan40的备份根。
SW1#
SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#span
SW1(config)#spanning-tree vlan 10,20 root pri
SW1(config)#spanning-tree vlan 10,20 root primary
SW1(config)#span
SW1(config)#spanning-tree vlan 30,40 root se
SW1(config)#spanning-tree vlan 30,40 root secondary
查看下呗
SW1
SW1#show span
SW1#show spanning-tree vlan 10 查看基于vlan10生成树的情况
VLAN0010
Spanning tree enabled protocol ieee
Root ID主根 Priority 24586 优先级
Address 00E0.A33E.72E4
This bridge is the root 这个交换机就是vlan10的主根
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24586 (priority 24576 sys-id-ext 10)
Address 00E0.A33E.72E4
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/10 Desg FWD 19 128.10 P2p 端口转发状态
Fa0/11 Desg FWD 19 128.11 P2p 端口转发状态
Po1 Desg FWD 9 128.31 Shr 汇聚组1的链路。端口转发状态
查看vlan20的
SW1#show span
SW1#show spanning-tree vlan 20
VLAN0020
Spanning tree enabled protocol ieee
Root ID Priority 24596
Address 00E0.A33E.72E4
This bridge is the root 这个交换机就是vlan20的主根
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24596 (priority 24576 sys-id-ext 20)
Address 00E0.A33E.72E4
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/10 Desg FWD 19 128.10 P2p 端口转发状态
Fa0/11 Desg FWD 19 128.11 P2p 端口转发状态
Po1 Desg FWD 9 128.31 Shr 汇聚组1的链路。端口转发状态
查看vlan30
SW1#show sp
SW1#show spanning-tree vlan 30
VLAN0030
Spanning tree enabled protocol ieee
Root ID Priority 24606
Address 00D0.D3EB.D53E
Cost 9
Port 31(Port-channel 1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28702 (priority 28672 sys-id-ext 30)
Address 00E0.A33E.72E4
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/10 Desg FWD 19 128.10 P2p 端口转发状态
Fa0/11 Desg FWD 19 128.11 P2p 端口转发状态
Po1 Root FWD 9 128.31 Shr 端口转发状态
查看vlan40
SW1#show sp
SW1#show spanning-tree vlan 40
VLAN0040
Spanning tree enabled protocol ieee
Root ID Priority 24616
Address 00D0.D3EB.D53E
Cost 9
Port 31(Port-channel 1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28712 (priority 28672 sys-id-ext 40)
Address 00E0.A33E.72E4
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/10 Desg FWD 19 128.10 P2p 端口转发状态
Fa0/11 Desg FWD 19 128.11 P2p 端口转发状态
Po1 Root FWD 9 128.31 Shr 端口转发状态
接下来设SW2为vlan30和vlan40的主根,为vlan10和vlan20的备份根。
SW2#
SW2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW2(config)#sp
SW2(config)#spanning-tree vlan 30,40 root
SW2(config)#spanning-tree vlan 30,40 root p
SW2(config)#spanning-tree vlan 30,40 root primary
SW2(config)#span
SW2(config)#spanning-tree vlan 10,20 root s
SW2(config)#spanning-tree vlan 10,20 root secondary
再查看各个vlan生成树的情况
vlan30的情况
SW2#show sp
SW2#show spanning-tree vlan 30 基于vlan30的生成树
VLAN0030
Spanning tree enabled protocol ieee
Root ID Priority 24606
Address 00D0.D3EB.D53E
This bridge is the root 这个交换机是vlan30的主根
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24606 (priority 24576 sys-id-ext 30)
Address 00D0.D3EB.D53E
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po1 Desg FWD 9 128.31 Shr 汇聚组1的链路。端口转发状态
Fa0/10 Desg FWD 19 128.10 P2p 端口转发状态
Fa0/11 Desg FWD 19 128.11 P2p 端口转发状态
vlan40的情况
SW2#show sp
SW2#show spanning-tree vlan 40
VLAN0040
Spanning tree enabled protocol ieee
Root ID Priority 24616
Address 00D0.D3EB.D53E
This bridge is the root 这个交换机是vlan40的主根
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24616 (priority 24576 sys-id-ext 40)
Address 00D0.D3EB.D53E
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po1 Desg FWD 9 128.31 Shr 汇聚组1的链路。端口转发状态
Fa0/10 Desg FWD 19 128.10 P2p 端口转发状态
Fa0/11 Desg FWD 19 128.11 P2p
vlan10的情况
SW2#show sp
SW2#show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address 00E0.A33E.72E4
Cost 9
Port 31(Port-channel 1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28682 (priority 28672 sys-id-ext 10)
Address 00D0.D3EB.D53E
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po1 Root FWD 9 128.31 Shr
Fa0/10 Desg FWD 19 128.10 P2p
Fa0/11 Desg FWD 19 128.11 P2p
vlan20的情况
SW2#show sp
SW2#show spanning-tree vlan 20
VLAN0020
Spanning tree enabled protocol ieee
Root ID Priority 24596
Address 00E0.A33E.72E4
Cost 9
Port 31(Port-channel 1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 28692 (priority 28672 sys-id-ext 20)
Address 00D0.D3EB.D53E
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po1 Root FWD 9 128.31 Shr 汇聚组1的链路。端口转发状态
Fa0/10 Desg FWD 19 128.10 P2p 端口转发状态
Fa0/11 Desg FWD 19 128.11 P2p 端口转发状态
在SW3和SW4上查看各个vlan的生成树情况
SW3
查看vlan10生成树情况
SW3#show sp
SW3#show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address 00E0.A33E.72E4
Cost 19
Port 10(FastEthernet0/10)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 0001.4323.6C20
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p 端口转发状态
Fa0/2 Desg FWD 19 128.2 P2p 端口转发状态
Fa0/10 Root FWD 19 128.10 P2p 端口转发状态
Fa0/11 Altn BLK 19 128.11 P2p 端口阻塞状态
查看vlan20生成树情况
SW3#show sp
SW3#show spanning-tree vlan 20
VLAN0020
Spanning tree enabled protocol ieee
Root ID Priority 24596
Address 00E0.A33E.72E4
Cost 19
Port 10(FastEthernet0/10)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32788 (priority 32768 sys-id-ext 20)
Address 0001.4323.6C20
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/3 Desg FWD 19 128.3 P2p 端口转发状态
Fa0/4 Desg FWD 19 128.4 P2p 端口转发状态
Fa0/10 Root FWD 19 128.10 P2p 端口转发状态
Fa0/11 Altn BLK 19 128.11 P2p 端口阻塞状态
查看vlan30生成树情况
SW3#show sp
SW3#show spanning-tree vlan 30
VLAN0030
Spanning tree enabled protocol ieee
Root ID Priority 24606
Address 00D0.D3EB.D53E
Cost 19
Port 11(FastEthernet0/11)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32798 (priority 32768 sys-id-ext 30)
Address 0001.4323.6C20
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/10 Altn BLK 19 128.10 P2p 端口阻塞状态
Fa0/11 Root FWD 19 128.11 P2p 端口转发状态
查看vlan40生成树情况
SW3#show sp
SW3#show spanning-tree vlan 40
VLAN0040
Spanning tree enabled protocol ieee
Root ID Priority 24616
Address 00D0.D3EB.D53E
Cost 19
Port 11(FastEthernet0/11)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32808 (priority 32768 sys-id-ext 40)
Address 0001.4323.6C20
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/10 Altn BLK 19 128.10 P2p 端口阻塞状态
Fa0/11 Root FWD 19 128.11 P2p 端口转发状态
SW4就不用看了吧,自己看去。多vlan生成树这玩意你要画图去研究各个关系,脑海想很容易乱,我当年也就是慢慢在纸上画图去比较的,慢慢就懂了,也不难,就是绕人。多理理就顺了。
第七步了,曹植七步作诗。我分七步做实验,呵呵开玩笑。
第七步:热备份路由协议(HSRP),将SW1作为vlan10和vlan20的主路由,为vlan30和vlan40的备份路由。将SW2作为vlan30和vlan40的主路由,为vlan10和vlan20的备份路由
SW1配置
SW1>en
SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#int vlan 10
SW1(config-if)#st
SW1(config-if)#standby 10 ip 192.168.1.254 虚拟网关,不会和SW1上的vlan10地址冲突
SW1(config-if)#stan
SW1(config-if)#standby 10 pri 这里的standby 10的数字10和vlan10没关系。10是组号。
SW1(config-if)#standby 10 priority 200 设置优先级为200,路由器默认100,优先级 SW1(config-if)#stan 的就是活动路由
SW1(config-if)#standby 10 pree
SW1(config-if)#standby 10 preempt 设置抢占
SW1(config-if)#
SW1(config-if)#ex
SW1(config)#stan
SW1(config)#st
SW1(config)#int vlan 20
SW1(config-if)#st
SW1(config-if)#standby 20 ip 192.168.2.254虚拟网关,不会和SW1上的vlan20地址冲突
SW1(config-if)#stan
SW1(config-if)#standby 20 pri
SW1(config-if)#standby 20 priority 200
SW1(config-if)#standby 20 pre
SW1(config-if)#standby 20 preempt
SW1(config-if)#ex
SW1(config)#int vlan 30
SW1(config-if)#stan
SW1(config-if)#standby 30 ip 192.168.3.254虚拟网关,不会和SW1上的vlan30地址冲突
SW1(config-if)#stan
SW1(config-if)#standby 30 pr
SW1(config-if)#standby 30 preempt
SW1(config-if)#ex
SW1(config)#int vlan 40
SW1(config-if)#stan
SW1(config-if)#standby 40 ip 192.168.4.254虚拟网关,不会和SW1上的vlan40地址冲突
SW1(config-if)#standby 40 pre
SW1(config-if)#standby 40 preempt
查看
SW1#show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active活动路由 Standby备份路由 Virtual IP
Vl10 10 200 P Active local 本地 192.168.1.253 192.168.1.254
Vl20 20 200 P Active local 本地 192.168.2.253 192.168.2.254
Vl30 30 100 P Standby 192.168.3.253 local 本地 192.168.3.254
Vl40 40 100 P Standby 192.168.4.253 local 本地 192.168.4.254
SW2配置
SW2(config)#
SW2(config)#int vlan 10
SW2(config-if)#stan
SW2(config-if)#standby 10 ip 192.168.1.254
SW2(config-if)#sta
SW2(config-if)#standby 10 pre
SW2(config-if)#standby 10 preempt
SW2(config-if)#ex
SW2(config)#
SW2(config)#int vlan 20
SW2(config-if)#stan
SW2(config-if)#standby 20 ip 192.168.2.254
SW2(config-if)#stan
SW2(config-if)#standby 20 pre
SW2(config-if)#standby 20 preempt
SW2(config-if)#ex
SW2(config)#
SW2(config)#int vlan 20
SW2(config-if)#stan
SW2(config-if)#standby 20 ip 192.168.2.254
SW2(config-if)#stan
SW2(config-if)#standby 20 pre
SW2(config-if)#standby 20 preempt
SW2(config-if)#ex
SW2(config)#
SW2(config)#
SW2(config)#int vlan 40
SW2(config-if)#stan
SW2(config-if)#standby 40 ip 192.168.4.254
SW2(config-if)#stan
SW2(config-if)#standby 40 pri
SW2(config-if)#standby 40 priority 200
SW2(config-if)#stan
SW2(config-if)#standby 40 pre
SW2(config-if)#standby 40 preempt
查看
SW2#
SW2#show stan
SW2#show standby b
SW2#show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Vl10 10 100 P Standby 192.168.1.254 local 192.168.1.254
Vl20 20 100 P Standby 192.168.2.254 local 192.168.2.254
Vl30 30 200 P Active local 192.168.3.254 192.168.3.254
Vl40 40 200 P Active local 192.168.4.254 192.168.4.254
和SW1比较下能看出来谁是主谁是备份。
大半夜没事在网吧给大家纯手打的,累死我了,谁能犒劳我下啊?
本文出自 “帝释天” 博客,转载请与作者联系!