1、中国矿业大学网络系统实践实验报告 组长: 组员: 实验一、交换机的基本配置实验1、 交换机的基本配置实验步骤1、在交换机上配置管理IP地址Red-Giantenable !进入特权模式Red-Giant # configure terminal !进入全局配置模式Red-Giant (config)# hostname SwitchB !配置交换机名称为 “SwitchB” SwitchB(config)# interface vlan 1 !进入交换机管理接口配置模式SwitchB(config-if)# ip address 192.168.0.138 255.255.255.0 !配置交
2、换机管理接口IP地址SwitchB(config-if)# no shutdown !开启交换机管理接口2、验证测试:验证交换机管理IP地址已经配置和开启SwitchB#show ip interface !验证交换机管理IP地址已经配置,管理接口已开启Interface : VL1Description : Vlan 1OperStatus : upManagementStatus : EnabledPrimary Internet address: 192.168.0.138/24Broadcast address : 255.255.255.255PhysAddress : 00d0.f
3、8fe.1efa3、配置交换机远程登录密码SwitchB(config)# enable secret level 1 0 start !设置交换机远程登录密码为“start”验证测试:验证从PC机可以通过网线远程登录到交换机上C:telnet 192.168.0.138 !从PC机登录到交换机上4、配置交换机特权模式密码SwitchB(config)# enable secret level 15 0 start !设置交换机特权模式密码为 “start”验证测试:验证从PC机通过网线远程登录到交换机上后可以进入特权模式C:telnet 192.168.0.138 !从PC机登录到交换机上5
4、、保存在交换机上所做的配置SwitchB# copy running-config startup-config ! 保存交换机配置6、验证测试:验证交换机配置已保存SwitchB# show configure ! 验证交换机配置已保存实验2、 备份交换机配置到TFTP服务器实验步骤1、在交换机上配置管理接口IP地址。SwitchB(config)# interface vlan 1 !进入交换机管理接口配置模式SwitchB(config-if)# ip address 192.168.0.138 255.255.255.0 !配置交换机管理接口IP地址SwitchB(config-if)
5、# no shutdown !开启交换机管理接口验证测试:验证交换机管理IP地址已经配置和开启,TFTP服务器与交换机有网络连通性SwitchB#show ip interface !验证交换机管理IP地址已经配置,管理接口已开启SwitchB#ping 192.168.0.137 !验证交换机与TFTP服务器具有网络连通性2、备份交换机配置。SwitchB#copy running-config startup-config ! 保存交换机的当前配置SwitchB#copy startup-config tftp: ! 备份交换机的配置到TFTP服务器Address of remote ho
6、st 192.168.0.137 ! 按提示输入TFTP服务器IP地址Destination filename config.text? ! 选择要保存的配置文件名称!%Success : Transmission success,file length 302验证测试:验证已保存配置文件打开TFTP服务器上的配置文件C:config.text,文件内容显示如下:实验 3、 从TFTP服务器恢复交换机配置实验步骤1、在交换机上配置管理接口IP地址。SwitchB(config)# interface vlan 1 !进入交换机管理接口配置模式SwitchB(config-if)# ip add
7、ress 192.168.0.138 255.255.255.0 !配置交换机管理接口IP地址SwitchB(config-if)# no shutdown !开启交换机管理接口验证测试:验证交换机管理IP地址已经配置和开启,TFTP服务器与交换机有网络连通性SwitchB#show ip interface !验证交换机管理IP地址已经配置,管理接口已开启SwitchB#ping 192.168.0.137 !验证交换机与TFTP服务器具有网络连通性2、加载交换机配置。SwitchB#copy tftp: startup-config ! 加载配置到交换机的初始配置文件中Source fil
8、ename ?config.text !按提示输入源文件名Address of remote host 192.168.0.137 !按提示输入TFTP服务器的IP地址!%Success : Transmission success,file length 302验证测试:验证交换机已经更改为新的配置3、重启交换机,使新的配置生效。SwitchB#reload ! 重启交换机实验二、虚拟局域网VLAN 实验1、交换机端口隔离实验步骤1、在未划VLAN前两台PC互相ping可以通。2、创建VLAN。SwitchB#configure terminal ! 进入交换机全局配置模式。SwitchB(
9、config)# vlan 10 ! 创建vlan 10。SwitchB(config-vlan)# name user10 ! 将Vlan 10命名为user10。SwitchB(config)# vlan 20 ! 创建vlan 20。SwitchB(config-vlan)# name tuser20 ! 将Vlan 20命名为user20。验证测试Switch#show vlan3、将接口分配到VLAN。SwitchB(config-if)# interface fastethernet 0/5 ! 进入fastethernet 0/5的接口配置模式。SwitchB(config-if
10、)# switch access vlan 10 ! 将fastethernet 0/5端口加入vlan 10中。SwitchB(config-if)# interface fastethernet 0/15 ! 进入fastethernet 0/15的接口配置模式。SwitchB(config-if)# switch access vlan 20 ! 将fastethernet 0/15端口加入vlan 20中。4、两台PC互相ping不通。验证测试 SwitchB#show vlan实验2、跨交换机实现VLAN实验步骤1、在交换机SwitchB上创建Vlan 10,并将0/5端口划分到Vl
11、an 10中。SwitchB# configure terminal !进入全局配置模式。SwitchB(config)# vlan 10 !创建Vlan 10。SwitchB(config-vlan)# name sales !将Vlan 10命名为sales。SwitchB(config-vlan)#exitSwitchB(config)#interface fastethernet 0/5 !进入接口配置模式。SwitchB(config-if)#switchport access vlan 10 !将0/5端口划分到Vlan 10。验证测试:验证已创建了Vlan 10,并将0/5端口已
12、划分到Vlan 10中。SwitchA#show vlan id 102、在交换机SwitchB上创建Vlan 20,并将0/15端口划分到Vlan 20中。SwitchB(config)# vlan 20 !创建Vlan 20。SwitchB(config-vlan)# name technical !将Vlan 20命名为technical。SwitchB(config-vlan)#exitSwitchB(config)#interface fastethernet 0/15 !进入接口配置模式。SwitchB(config-if)#switchport access vlan 20 !将
13、0/15端口划分到Vlan 20。验证测试:验证已创建了Vlan 20,并将0/15端口已划分到Vlan 20中。SwitchB#show vlan id 203、在交换机SwitchA上将与SwitchB相连的端口(假设为0/24端口)定义为tag vlan模式。SwitchB(config)#interface fastethernet 0/24 !进入接口配置模式。SwitchB(config-if)#switchport mode trunk !将fastethernet 0/24端口设为tag vlan模式。 验证测试:验证fastethernet 0/24端口已被设置为tag vl
14、an模式。4、在交换机SwitchA上创建Vlan 10,并将0/5端口划分到Vlan 10中。SwitchA # configure terminal !进入全局配置模式。SwitchA(config)# vlan 10 !创建Vlan 10。SwitchA(config-vlan)# name sales !将Vlan 10命名为sales。SwitchA(config-vlan)#exitSwitchA(config)#interface fastethernet 0/5 !进入接口配置模式。SwitchA(config-if)#switchport access vlan 10 !将0
15、/5端口划分到Vlan 10。验证测试:验证已在SwitchA上创建了Vlan 10,并将0/5端口已划分到Vlan 10中。SwitchA#show vlan id 105、在交换机SwitchB上将与SwitchA相连的端口(假设为0/24端口)定义为tag vlan模式。SwitchA(config)#interface fastethernet 0/24 !进入接口配置模式。SwitchA(config-if)#switchport mode trunk !将fastethernet 0/24端口设为tag vlan模式。验证测试:验证fastethernet 0/24端口已被设置为t
16、ag vlan模式。6、验证PC1与PC3能互相通信,但PC2与PC3不能互相通信。C:ping 192.168.10.30 !在PC1的命令行方式下验证能Ping通PC3 。Pinging 192.168.10.30 with 32 bytes of data:Reply from 192.168.10.30: bytes=32 time10ms TTL=128Reply from 192.168.10.30: bytes=32 time10ms TTL=128Reply from 192.168.10.30: bytes=32 time10ms TTL=128Reply from 192.
17、168.10.30: bytes=32 timeping 192.168.10.30 !在PC2的命令行方式下验证不能Ping通PC3 。Pinging 192.168.10.30 with 32 bytes of data:Request timed out.Request timed out.Request timed out.Request timed out.Ping statistics for 192.168.10.30: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),Approximate round trip tim
18、es in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms实验三、生成树配置 实验1、生成树协议STP实验步骤1.在每台交换机上开启生成树协议例如对SwitchB做如下配置:SwitchB#configure terminal !进入全局配置模式SwitchB(config)#spanning-tree !开启生成树协议 SwitchB(config)#end测试:验证生成树协议已经开启SwitchB#show spanning-tree !显示交换机生成树的状态SwitchB#show spanning-tree inte
19、rface fastthernet 0/1 !显示交换机接口fastthernet 0/1的状态2.设置生成树模式SwitchB(config)#spanning-tree mode stp !设置生成树模式为STP (802.1D)测试:验证生成树协模式为802.1DSwitchB#show spanning-tree3.设置交换机的优先级SwitchB(config)#spanning-tree priority 4096 !设置交换机SwitchB的优先级为4096, 数值最小的交换机为根交换机(也称根桥),交换机SwitchA的优先级采用默认优先级(32768),因此SwitchB将成
20、为根交换机。测试:验证交换机SwitchA的优先级SwitchA#show spanning-tree4.综合验证测试A.验证交换机SwitchB的端口F0/和F0/的状态。SwitchB#show spanning-tree interface fastEthernet 0/1 !显示SwitchB的端口fastthernet 0/1的状态PortAdminPortfast : DisabledPortOperPortfast : DisabledPortAdminLinkType : autoPortOperLinkType : point-to-pointPortBPDUGuard: D
21、isabledPortBPDUFilter: DisabledPortState : forwarding!SwitchB的端口fastthernet 0/处于转发(forwarding)状态PortPriority : 128PortDesignatedRoot : 200000D0F8EF9E89PortDesignatedCost : 0PortDesignatedBridge : 200000D0F8EF9E89PortDesignatedPort : 8002PortForwardTransitions : 22PortAdminPathCost : 0PortOperPathCos
22、t : 200000PortRole : rootPortSwitchB#show spanning-tree interface fastEthernet 0/2 !显示SwitchB的端口fastthernet 0/2的状态PortAdminPortfast : DisabledPortOperPortfast : DisabledPortAdminLinkType : autoPortOperLinkType : point-to-pointPortBPDUGuard: DisabledPortBPDUFilter: DisabledPortState : discarding!Swit
23、chB的端口fastthernet 0/2处于阻塞(discarding)状态PortPriority : 128PortDesignatedRoot : 200000D0F8EF9E89PortDesignatedCost : 200000PortDesignatedBridge : 800000D0F8EF9D09PortDesignatedPort : 8002PortForwardTransitions : 39PortAdminPathCost : 0PortOperPathCost : 200000PortRole : alternatePortB. 验证网络拓扑发生变化时,pin
24、g的丢包情况。C:ping 192.168.0.136 t !从主机PC1 ping PC2(用连续ping),然后拔掉SwitchA与SwitchB的端口F0/1之间的连线,观察丢包情况。显示结果如下:以上结果显示丢包数为30个。C. 验证网络拓扑发生变化时,交换机SwitchB的端口的状态变化,并观察生成树的收敛时间。SwitchB#show spanning-tree interface fastEthernet 0/2 !显示SwitchB的端口fastthernet 0/2的状态PortAdminPortfast : DisabledPortOperPortfast : Disabl
25、edPortAdminLinkType : autoPortOperLinkType : point-to-pointPortBPDUGuard: DisabledPortBPDUFilter: DisabledPortState : forwarding!SwitchB的端口fastthernet 0/2转变为转发(forwarding)状态,转换时间大约32秒PortPriority : 128PortDesignatedRoot : 200000D0F8EF9E89PortDesignatedCost : 200000PortDesignatedBridge : 800000D0F8EF
26、9D09PortDesignatedPort : 8002PortForwardTransitions : 40PortAdminPathCost : 0PortOperPathCost : 200000PortRole : rootPortSwitchB#show spanning-tree interface fastEthernet 0/2 !显示SwitchB的端口fastthernet 0/2的状态2003-04-27 23:27:24 5-LINKUPDOWN:Fa0/2 changed state to up2003-04-27 23:27:53 4-TOPOCHANGE:Top
27、ology is changedPortAdminPortfast : DisabledPortOperPortfast : DisabledPortAdminLinkType : autoPortOperLinkType : point-to-pointPortBPDUGuard: DisabledPortBPDUFilter: DisabledPortState : discarding!SwitchB的端口fastthernet 0/2转变为阻塞(discarding)状态,转换时间大约31秒PortPriority : 128PortDesignatedRoot : 200000D0F8EF9E89PortDesignatedCost : 200000PortDesignatedBridge : 800000D0F8EF9D09PortDesignatedPort : 8002PortForwardTransitions : 40PortAdminPathCost : 0PortOperPathCost : 200000PortRole : alternatePort
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2