Packet Tracer 60实验交换机的基本配置与管理
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
一、实验目标
掌握交换机基本信息的配置与管理
二、技术原理
交换机的管理方式基本分为两种:带内管理和带外管理。
•通过交换机的Console端口管理交换机属于带外管理:这种管理方式不占用交换机的网络端口,第一次配置交换机必须利用Console端口进行配置。
•通过远程Telnet、拨号等方式属于带内管理。
三、交换机的命令行操作模式
主要包括:
用户模式Switch>
特权模式Switch#
全局配置模式Switch(config)#
端口模式Switch(config-if)#
四、实验步骤
1、实验拓扑
2、交换机基本配置命令
a. 进入特权模式
Switch>enable //en=enable
Switch#
b. 进入全局配置模式
Switch#configure terminal //conf t=configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
c. 进入交换机端口视图模式
Switch(config)#interface fastEthernet 0/1 //int f0/1=interface fastEthernet 0/1
Switch(config-if)#
d. 配置交换机端口速度
Switch(config-if)#speed ?
10 Force 10 Mbps operation
100 Force 100 Mbps operation
auto Enable AUTO speed configuration
Switch(config-if)#speed 100
e. 配置交换机端口双工模式
Switch(config-if)#duplex ?
auto Enable AUTO duplex configuration
full Force full duplex operation
half Force half-duplex operation
Switch(config-if)#duplex full
f. 退回到上一级模式
Switch(config-if)#exit
Switch(config)#
g. 直接退回到特权模式
Switch(config-if)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console
Switch#
h. 查看交换机版本信息
Switch#show version
Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2(25)FX, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2005 by Cisco Systems, Inc.
Compiled Wed 12-Oct-0522:05 by pt_team
ROM: C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(25r)FX, RELEASE SOFTWARE (fc4)
System returned to ROM by power-on
Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory.
24 FastEthernet/IEEE 802.3interface(s)
2 Gigabit Ethernet/IEEE 802.3interface(s)
63488K bytes of flash-simulated non-volatile configuration memory. Base ethernet MAC Address : 0040.0B69.8831
Motherboard assembly number : 73-9832-06
Power supply part number : 341-0097-02
Motherboard serial number : FOC103248MJ
Power supply serial number : DCA102133JA
Model revision number : B0
Motherboard revision number : C0
Model number : WS-C2960-24TT
System serial number : FOC1033Z1EY
--More--
...
Configuration register is0xF
i. 查看当前生效的配置信息
Switch#show running-config
Building configuration...
Current configuration : 1033 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
!
interface FastEthernet0/1
duplex full
speed 100
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
--More--
...
!
!
end
j. 帮助信息
①Switch#?
Exec commands:
<1-99> Session number to resume
clear Reset functions
clock Manage the system clock
configure Enter configuration mode
connect Open a terminal connection
copy Copy from one file to another
debug Debugging functions (see also 'undebug')
delete Delete a file
dir List files on a filesystem
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
erase Erase a filesystem
exit Exit from the EXEC
logout Exit from the EXEC
more Display the contents of a file
no Disable debugging informations
ping Send echo messages
reload Halt and perform a cold restart
resume Resume an active network connection
setup Run the SETUP command facility
--More--
②Switch#co?
configure connect copy
③Switch#copy ?
flash: Copy from flash: file system
ftp: Copy from ftp: file system
running-config Copy from current system configuration
startup-config Copy from startup configuration
tftp: Copy from tftp: file system 、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、Packet Tracer 5.0实验(二) 交换机的Telnet远程登录设置
一、实验目标
掌握采用telnet方式配置交换机的方法
二、技术原理
•配置交换机的管理IP地址(计算机的IP地址与交换机管理IP地址在同一网段);
•为telnet用户配置用户名和登录口令:
Switch(config)#enble password xxxx //设置进入特权模式的密码;
Switch(config-line)#password xxxx //可以设置通过console端口连接设备及telnet远程登录时所需要的密码。
Switch(config)#line console 0
Switch(config-line)#password xxxx //设置通过console端口连接设备的密码
Switch(config-line)#login
Switch(config)#line vty 0 4
Switch(config-line)#password xxxx //设置telnet远程登录密码
Switch(config-line)#login
三、实验步骤
实验拓扑
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
1、配置交换机的管理IP地址
Switch(config)#interface vlan 1 //默认情况下交换机所有端口都处于vlan 1 当中Switch(config-if)#ip address 192.168.1.1 255.255.255.0 //配置交换机管理IP地址
Switch(config-if)#no shutdown //开启Interface Vlan1
%LINK-5-CHANGED: Interface Vlan1, changed state to up
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
Switch(config-if)#exit
2、设置进入特权模式的密码
Switch(config)#enable password 123456 //设置进入特权模式的密码
Switch(config)#line console ?
<0-0> First Line number
3、设置通过console端口连接设备的密码
Switch(config)#line console 0
Switch(config-line)#password asdf //设置通过console端口连接设备的密码Switch(config-line)#login
Switch(config-line)#exit
Switch(config)#line vty ?
<0-15> First Line number
4、设置telnet远程登录密码
Switch(config)#line vty 0 4
Switch(config-line)#password abc123 //设置telnet远程登录密码
Switch(config-line)#login
Switch(config-line)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console
5、查看配置情况
Switch#show running-config
Building configuration...
Current configuration : 1064 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
enable password 123456
!
!
!
interface FastEthernet0/1
!
......
!
interface FastEthernet0/24
!
interface GigabitEthernet1/1
!
interface GigabitEthernet1/2
!
interface Vlan1
ip address 192.168.1.1 255.255.255.0
!
!
line con 0
password asdf
login
!
line vty 0 4
password abc123
login
line vty 5 15
login
!
!
end
Switch#
四、验证
1、验证通过console端口连接设备的密码
Press RETURN to get started.
User Access Verification
Password: //这里输入asdf
Switch>
2、验证进入特权模式的密码
Switch>en
Password: //这里输入123456 Switch#
3、验证telnet远程登录密码
a. 给PC机设置IP地址
b. 打开Command Prompt
Packet Tracer PC Command Line 1.0
PC>ipconfig
IP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1
PC>ping 192.168.1.1
Pinging 192.168.1.1 with 32 bytes of data:
Request timed out.
Reply from 192.168.1.1: bytes=32 time=32ms TTL=255
Reply from 192.168.1.1: bytes=32 time=32ms TTL=255 Reply from 192.168.1.1: bytes=32 time=31ms TTL=255
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss), Approximate round trip times in milli-seconds:
Minimum = 31ms, Maximum = 32ms, Average = 31ms
PC>telnet 192.168.1.1 //远程登录Trying 192.168.1.1 ...Open
User Access Verification
Password: //vty密码Switch>en
Password: //enable密码Switch#show running-config
Building configuration...
Current configuration : 1063 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
enable password 123456
!
!
!
interface FastEthernet0/1
!
......
interface FastEthernet0/24
!
interface GigabitEthernet1/1
!
interface GigabitEthernet1/2
!
interface Vlan1
ip address 192.168.1.1 255.255.255.0
!
!
line con 0
password asdf
login
!
line vty 0 4
password abc123
login
line vty 5 15
login
!
!
end
Switch#。
Packet Tracer 5.0实验(三) 交换机划分VLAN配置
一、实验目标
•理解虚拟LAN(VLAN)基本原理;
•掌握一般交换机按端口划分VLAN的配置方法;
•掌握T ag VLAN配置方法。
二、实验背景
某一公司内财务部、销售部的PC通过2台交换机实现通信;要求财务部和销售部内的PC可以互通,但为了数据安全起见,销售部和财务部需要进行隔离,现要在交换机上做适当配置来实现这一目的。
三、技术原理
•VLAN是指在一个物理网段内,进行逻辑的划分,划分成若干个虚拟局域网。
VLAN最大的特性是不受物理位置的限制,可以进行灵活的划分。
VLAN具备了一个物理网段所具备的特性。
相同VLAN内的主机可以相互直接通信,不同VLAN间的主机之间互相访问必须经由路由设备进行转发。
广播数据包只可以在本VLAN内进行广播,不能传输到其他VLAN中。
•Port VLAN是实现VLAN的方式之一,它利用交换机的端口进行VLAN的划分,一个端口只能属于一个VLAN。
•Tag VLAN是基于交换机端口的另外一种类型,主要用于使交换机的相同VLAN内的主机之间可以直接访问,同时对于不同VLAN的主机进行隔离。
Tag VLAN遵循IEEE802.1Q协议的标准。
在使用配置了T ag VLAN的端口进行数据传输时,需要在数据帧内添加4个字节的802.1Q标签信息,用于标示该数据帧属于哪个VLAN,便于对端交换机收到数据帧后进行准确的过滤。
四、实验步骤
实验拓扑
1、设置四台PC机IP地址如图所示。
2、对交换机S1进行设置。
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S1 //设置主机名
S1(config)#vlan 2 //划分VLAN 2
S1(config-vlan)#exit
S1(config)#vlan 3 //划分VLAN 3
S1(config-vlan)#exit
S1(config)#interface fa0/1
S1(config-if)#switchport access vlan 2 //将fa0/1划分到VLAN 2
S1(config-if)#exit
S1(config)#interface fa0/2
S1(config-if)#switchport access vlan 3 //将fa0/2划分到VLAN 3
S1(config-if)#exit
S1(config)#interface fa0/24 //设置fa0/24端口模式为trunk S1(config-if)#switchport mode trunk
S1(config-if)#end
S1#
%SYS-5-CONFIG_I: Configured from console by console
S1#show vlan //查看VLAN划分情况
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Gig1/1, Gig1/2
2 VLAN0002 active Fa0/1
3 VLAN0003 active Fa0/2
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 TranS1
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
2 enet 100002 1500 - - - - - 0 0
3 enet 100003 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
------------------------------------------------------------------------------
Primary Secondary Type Ports
------- --------- ----------------- ------------------------------------------ S1#show running-config
Building configuration...
Current configuration : 1080 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname S1
!
!
!
interface FastEthernet0/1
switchport access vlan 2
!
interface FastEthernet0/2
switchport access vlan 3
!
interface FastEthernet0/3
!
......
!
interface FastEthernet0/24
switchport mode trunk
!
interface GigabitEthernet1/1
!
interface GigabitEthernet1/2
!
interface Vlan1
no ip address
shutdown
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
end
S1#
3、对交换机S2进行设置。
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S2
S2(config)#vlan 2
S2(config-vlan)#exit
S2(config)#vlan 3
S2(config-vlan)#exit
S2(config)#interface fa0/1
S2(config-if)#switchport access vlan 2
S2(config-if)#exit
S2(config)#interface fa0/2
S2(config-if)#switchport access vlan 3
S2(config-if)#exit
S2(config)#interface fa0/24
S2(config-if)#switchport mode trunk
S2(config-if)#end
S2#
%SYS-5-CONFIG_I: Configured from console by console
S2#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- ------------------------------- 1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14 Fa0/15, Fa0/16, Fa0/17, Fa0/18 Fa0/19, Fa0/20, Fa0/21, Fa0/22 Fa0/23, Gig1/1, Gig1/2
2 VLAN0002 active Fa0/1
3 VLAN0003 active Fa0/2
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
2 enet 100002 1500 - - - - - 0 0
3 enet 100003 1500 - - - - - 0 0 1002 fddi 101002 1500 - - - - - 0 0 1003 tr 101003 1500 - - - - - 0 0 100
4 fdnet 101004 1500 - - - ieee - 0 0 100
5 trnet 101005 1500 - - - ibm - 0 0
Remote SPAN VLANs
------------------------------------------------------------------------------
Primary Secondary Type Ports
------- --------- ----------------- ------------------------------------------ S2#show running-config
Building configuration...
Current configuration : 1080 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname S2
!
!
!
interface FastEthernet0/1
switchport access vlan 2
!
interface FastEthernet0/2
switchport access vlan 3
!
interface FastEthernet0/3
!
......
!
interface FastEthernet0/24
switchport mode trunk
!
interface GigabitEthernet1/1
!
interface GigabitEthernet1/2
!
interface Vlan1
no ip address
shutdown
!
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
end
S2#
五、验证
打开PC1的Command Prompt
Packet Tracer PC Command Line 1.0
PC>ipconfig
IP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1
PC>ping 192.168.1.3
Pinging 192.168.1.3 with 32 bytes of data:
Request timed out. //不同VLAN间无法PING通Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.1.3:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
PC>ping 192.168.1.4
Pinging 192.168.1.4 with 32 bytes of data:
Reply from 192.168.1.4: bytes=32 time=172ms TTL=128 //相同VLAN可以PING通Reply from 192.168.1.4: bytes=32 time=78ms TTL=128
Reply from 192.168.1.4: bytes=32 time=63ms TTL=128
Reply from 192.168.1.4: bytes=32 time=79ms TTL=128
Ping statistics for 192.168.1.4:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 63ms, Maximum = 172ms, Average = 98ms。
Packet Tracer 5.0实验(四) 利用三层交换机实现VLAN间路由
一、实验目标
•掌握交换机Tag VLAN 的配置;
•掌握三层交换机基本配置方法;
•掌握三层交换机VLAN路由的配置方法;
•通过三层交换机实现VLAN间相互通信;
二、实验背景
某企业有两个主要部门,技术部和销售部,分处于不同的办公室,为了安全和便于管理,对两个部门的主机进行了VLAN的划分,技术部和销售部分处于不同的VLAN。
现由于业务的需求,需要销售部和技术部的主机能够相互访问,获得相应的资源,两个部门的交换机通过一台三层交换机进行了连接。
三、技术原理
三层交换机具备网络层的功能,实现VLAN间相互访问的原理是:利用三层交换机的路由功能,通过识别数据包的IP地址,查找路由表进行选路转发。
三层交换机利用直连路由可以实现不同VLAN之间的互相访问。
三层交换机给接口配置IP地址,采用SVI(交换虚拟接口)的方式实现VLAN间互连。
SVI是指为交换机中的VLAN创建虚拟接口,并且配置IP地址。
四、实验步骤
实验拓扑
1、在二层交换机上配置VLAN
2、VLAN 3,分别将端口2、端口3划到VLAN 2、VLAN 3;
2、将二层交换机与三层交换机相连的端口Fa0/1定义为Tag VLAN模式;
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#interface fa0/2
Switch(config-if)#switchport access vlan 2
Switch(config-if)#exit
Switch(config)#interface fa0/3
Switch(config-if)#switchport access vlan 3
Switch(config-if)#exit
Switch(config)#interface fa0/1
Switch(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#
3、在三层交换机上配置VLAN 2、VLAN 3,分别将端口2、端口3划到VLAN 2、VLAN 3;
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#interface fa0/2
Switch(config-if)#switchport access vlan 2
Switch(config-if)#exit
Switch(config)#interface fa0/3
Switch(config-if)#switchport access vlan 3
Switch(config-if)#exit
Switch(config)#
4、设置三层交换机VLAN间通信,创建VLAN 2、VLAN 3的虚拟接口,并配置虚拟接口VLAN 2、VLAN 3的
IP地址;
Switch(config)#interface vlan 2 //创建 VLAN 2 的虚拟接口Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up
Switch(config-if)#ip address 192.168.1.1 255.255.255.0 //配置虚拟接口 VLAN 2 的IP地址
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface vlan 3 //创建 VLAN 2 的虚拟接口Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up
Switch(config-if)#ip address 192.168.2.1 255.255.255.0 //配置虚拟接口 VLAN 2 的IP地址
Switch(config-if)#no shutdown
Switch(config-if)#end
Switch#
5、查看三层交换机路由表
Switch#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, Vlan2
C 192.168.2.0/24 is directly connected, Vlan3
Switch#
6、将VLAN 2、VLAN 3下的主机默认网关分别设置为相应虚拟接口的IP地址;
五、验证
打开PC1 Command Prompt
Packet Tracer PC Command Line 1.0
PC>ipconfig
IP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1
PC>ping 192.168.1.3
Pinging 192.168.1.3 with 32 bytes of data:
Reply from 192.168.1.3: bytes=32 time=187ms TTL=128
Reply from 192.168.1.3: bytes=32 time=93ms TTL=128
Reply from 192.168.1.3: bytes=32 time=110ms TTL=128
Reply from 192.168.1.3: bytes=32 time=93ms TTL=128
Ping statistics for 192.168.1.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 93ms, Maximum = 187ms, Average = 120ms
PC>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Request timed out.
Reply from 192.168.2.2: bytes=32 time=188ms TTL=127
Reply from 192.168.2.2: bytes=32 time=112ms TTL=127
Reply from 192.168.2.2: bytes=32 time=125ms TTL=127
Ping statistics for 192.168.2.2:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 112ms, Maximum = 188ms, Average = 141ms
PC>ping 192.168.2.3
Pinging 192.168.2.3 with 32 bytes of data:
Request timed out.
Reply from 192.168.2.3: bytes=32 time=125ms TTL=127
Reply from 192.168.2.3: bytes=32 time=78ms TTL=127
Reply from 192.168.2.3: bytes=32 time=64ms TTL=127
Ping statistics for 192.168.2.3:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 64ms, Maximum = 125ms, Average = 89ms。
Packet Tracer 5.0实验(五) 快速生成树配置
一、实验目标
•理解生成树协议工作原理;
•掌握快速生成树协议RSTP基本配置方法;
二、实验背景
学校为了开展计算机教学和网络办公,建立了一个计算机教室和一个校办公区,这两处的计算机网络通过两台交换机互相连接组成内部校园网,为了提高网络的可靠性,作为网络管理员,你要用2条链路将交换机互连,现要求在交换机上做适当的配置,使网络避免环路。
三、技术原理
生成树协议(spanning-tree),作用是在交换网络中提供冗余备份链路,并且解决交换网络中的环路问题;
生成树协议是利用SPA算法,在存在交换环路的网络中生成一个没有环路的树形网络。
运用该算法将交换网络的冗余备份链路从逻辑上断开,当主链路出现故障时,能够自动的切换到备份链路,保证数据的正常转发;
生成树协议版本:STP、RSTP(快速生成树)、MSTP(多生成树协议);
生成树协议的特点是收敛时间长,从主要链路出现故障到切换至备份链路需要50秒的时间;
快速生成树协议在生成树协议的基础上增加了两种端口角色:替换端口和备份端口,分别做为根端口和指定端口的冗余端口。
当根端口或指定端口出现故障时,冗余端口不需要经过50秒的收敛时间,可以直接切换到替换端口或备份端口,从而实现RSTP协议小于1秒的快速收敛。
四、实验步骤
实验拓扑
默认情况下STP协议启用的,通过两台交换机之间传送BPDU协议数据单元,选出根交换机、根端口等,以便确定端口的转发状态。
上图中标记为橙色的端口处于block堵塞状态。
设置RSTP
查看交换机show spanning-tree 状态,了解根交换机和根端口情况;
通过更改交换机生成树的优先级spanning-tree vlan * priority 4096 可以变化根交换机的角色;
S1:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S1
S1(config)#end
S1#
%SYS-5-CONFIG_I: Configured from console by console
S1#show spanning-tree //查看交换机spanning-tree 状态VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0060.5C36.5620
Cost 19
Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0060.7078.8BDE
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/1 Root FWD 19 128.1 P2p
Fa0/2 Altn BLK 19 128.2 P2p
S1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#interface fa0/10
S1(config-if)#switchport access vlan 10 //将fa0/10划分到vlan 10 % Access VLAN does not exist. Creating vlan 10
S1(config-if)#exit
S1(config)#interface range fa0/1 - 2 //设置fa0/1,fa0/2端口状态为trunk模式
S1(config-if-range)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
%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
S1(config-if-range)#exit
S1(config)#spanning-tree mode ? //设置spanning-tree 为RSTP模式
pvst Per-Vlan spanning tree mode
rapid-pvst Per-Vlan rapid spanning tree mode
S1(config)#spanning-tree mode rapid-pvst
S1(config)#
S2:
Switch>en
Switch#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0060.5C36.5620
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 0060.5C36.5620
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 Desg FWD 19 128.10 P2p
Switch#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up %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
Switch#
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S2
S2(config)#interface fa0/10
S2(config-if)#switchport access vlan 10
% Access VLAN does not exist. Creating vlan 10
S2(config-if)#exit
S2(config)#interface range fa0/1 - 2
S2(config-if-range)#switchport mode trunk
S2(config-if-range)#exit
S2(config)#spanning-tree mode rapid-pvst
S2(config)#
五、测试
当主链路处于down状态时,能够自动的切换到备份链路,保证数据的正常转发。
在S2上shutdown 掉fa0/1
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int
Switch(config)#interface fa0/1
Switch(config-if)#shu
Switch(config-if)#shutdown //shutdown fa0/1端口
Switch(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
Switch#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 32769
Address 0001.63E2.4A7A
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 0001.63E2.4A7A
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
VLAN0010
Spanning tree enabled protocol rstp
Root ID Priority 32778
Address 0001.63E2.4A7A
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 0001.63E2.4A7A
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 Desg FWD 19 128.10 P2p
Switch#
PC1:
PC>ipconfig
IP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1
PC>ping -t 192.168.1.3
Pinging 192.168.1.3 with 32 bytes of data:
Reply from 192.168.1.3: bytes=32 time=78ms TTL=128
Reply from 192.168.1.3: bytes=32 time=94ms TTL=128
Reply from 192.168.1.3: bytes=32 time=78ms TTL=128
Reply from 192.168.1.3: bytes=32 time=78ms TTL=128
Reply from 192.168.1.3: bytes=32 time=78ms TTL=128
Reply from 192.168.1.3: bytes=32 time=94ms TTL=128
Reply from 192.168.1.3: bytes=32 time=93ms TTL=128
Reply from 192.168.1.3: bytes=32 time=93ms TTL=128
Reply from 192.168.1.3: bytes=32 time=62ms TTL=128
Reply from 192.168.1.3: bytes=32 time=94ms TTL=128
Reply from 192.168.1.3: bytes=32 time=79ms TTL=128
Reply from 192.168.1.3: bytes=32 time=94ms TTL=128
......
测试效果:。
Packet Tracer 5.0实
验(六) 路由器基本配置
一、实验目标
•掌握路由器几种
常用配置方法;
•掌握采用
Console线缆配置路由器
的方法;
•掌握采用telnet
方式配置路由器的方法;
•熟悉路由器不同
的命令行操作模式以及各
种模式之间的切换;
•掌握路由器的基
本配置命令;
二、技术原理
路由器的管理方式基本分为两种:带内管理和带外管理。
通过路由器的Console口管理路由器属于带外管理,不占用路由器的网络接口,其特点是需要使用配置线缆,近距离配置。
第一次配置时必须利用Console端口进行配置。
三、实验步骤
实验拓扑
1、用标准console线缆连接计算机的串口和路由器的console口,在计算机上启用超级终端,并配置超级终端
的参数,使计算机与路由器通过console口建立连接;
2、配置路由器的管理IP地址,并为telnet用户配置用户名和登录口令。
配置计算机的IP地址(与路由器管理
IP地址在同一个网段),通过网线将计算机和路由器相连,通过计算机telnet到路由器上进行查看配置;
3、更改路由器的主机名;
4、擦除配置信息、保存配置信息、显示配置信息;
5、显示当前配置信息;
6、显示历史命令;
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fa0/0
Router(config-if)#no shutdown //路由器端口默认关闭,开启fa0/0端口
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#hostname R1 //修改路由器主机名
R1(config)#enable password 123456 //设置进入特权模式密码
R1(config)#line vty 0 4
R1(config-line)#password abc123 //设置telnet远程登录密码R1(config-line)#login
R1(config-line)#exit
R1(config)#interface fa0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0 //配置路由器的管理IP地址R1(config-if)#no shutdown //开启端口
R1(config-if)#end
%SYS-5-CONFIG_I: Configured from console by console
R1#
四、PC端登录测试
Packet Tracer PC Command Line 1.0
PC>ipconfig
IP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1
PC>ping 192.168.1.2
Pinging 192.168.1.2 with 32 bytes of data:
Reply from 192.168.1.2: bytes=32 time=12ms TTL=128
Reply from 192.168.1.2: bytes=32 time=0ms TTL=128
Reply from 192.168.1.2: bytes=32 time=1ms TTL=128
Reply from 192.168.1.2: bytes=32 time=1ms TTL=128
Ping statistics for 192.168.1.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 12ms, Average = 3ms
PC>telnet 192.168.1.1
Trying 192.168.1.1 ...Open
User Access Verification
Password: //输入vty密码
R1>en
Password: //输入enable 密码
R1#
R1#show running-config //查看配置信息
Building configuration...
Current configuration : 501 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
!
!
!
enable password 123456
!
!
!
!
!
!
!
!
!
!
!
!。