计算机网络实验报告.docx
《计算机网络实验报告.docx》由会员分享,可在线阅读,更多相关《计算机网络实验报告.docx(55页珍藏版)》请在冰豆网上搜索。
计算机网络实验报告
电子科技大学
计算机科学与工程学院
标准实验报告
(实验)课程名称计算机网络基础
电子科技大学教务处制表
电子科技大学
实验报告
一、实验项目名称:
交换机和路由器的基本配置
二、实验目的:
理解和掌握交换机和路由器的工作原理;掌握交换机和路由器命令行各种操作模式的区别;能够使用各种帮助信息,以及用命令进行基本的配置。
三、实验内容:
假设是某公司新进的网管,公司要求你熟悉网络产品。
首先要求你登录交换机或路由器,了解并掌握交换机和路由器的命令行操作,以及如何使用一些基本命令对设备进行配置,包括交换机和路由器的设备名、登录时的描述信息、端口参数的基本配置,以及设备运行状态的查看。
4、实验环境:
五、实验设备
交换机1台、路由器1台、计算机1台。
六、实验原理:
交换机和路由器(以下简称设备)的管理方式基本分为两种:
带内管理和带外管理。
通过设备的Console口管理设备属于带外管理,不占用设备的网络接口,其特点是需要使用配置线缆,近距离配置。
第一次配置交换机或路由器时必须利用Console端口进行配置。
交换机或路由器的命令行操作模式,主要包括:
用户模式、特权模式、全局配置模式、端口模式等几种。
●用户模式:
进入设备后得到的第一个操作模式,该模式下可以简单查看设备的软、硬件版本信息,并进行简单的测试。
用户模式提示符为switch>或router>
●特权模式:
由用户模式进入的下一级模式,该模式下可以对设备的配置文件进行管理,查看设备的配置信息,进行网络的测试和调试等。
特权模式提示符为switch#或router#
●全局配置模式:
属于特权模式的下一级模式(子模式),该模式下可以配置设备的全局性参数(如设备名、登录信息等)。
在该模式下可以进入下一级的配置模式,对设备的具体功能进行配置。
全局配置模式提示符为switch(config)#或router(config)#
●端口配置模式:
属于全局配置模式的下一级模式(子模式),该模式下可以对交换机或路由器的网络端口进行参数配置。
端口模式提示符为switch(config-if)#或router(config-if)#
交换机或路由器的基本操作命令包括:
Exit命令是退回到上一级操作模式。
End命令是指用户从特权模式以下级别直接返回到特权模式。
交换机和路由器的命令行支持获取帮助信息、命令的简写、命令的自动补齐、快捷键功能。
配置交换机的设备名称和配置交换机的描述信息必须在全局配置模式下执行。
Hostname配置交换机和路由器的设备名称。
当用户登录交换机或路由器时,你可能需要告诉用户一些必要的信息。
你可以通过设置标题来达到这个目的。
你可以创建两种类型的标题:
每日通知和登录标题。
⏹Bannermotd配置交换机和路由器每日提示信息。
motd是messageoftheday的缩写。
⏹Bannerlogin配置交换机和路由器登录提示信息,位于每日提示信息之后。
查看交换机或路由器的系统和配置信息,相应的查看命令要在特权模式下执行。
a)Showversion查看交换机或路由器的版本信息,可以查看到交换机或路由器的硬件版本信息和软件版本信息,用于进行交换机路由器操作系统升级时的依据。
b)Showmac-address-table查看交换机当前的MAC地址表信息。
c)Showiproute查看路由器中的路由表信息。
d)Showrunning-config查看交换机路由器当前生效的配置信息。
7、实验步骤
1.交换机各个操作模式直接的切换
2.交换机命令行界面基本功能
3.配置交换机的名称和每日提示信息
Switch#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Switch(config)#hostnameheekhero
heekhero(config)#bannermoth@
^
%Invalidinputdetectedat'^'marker.
heekhero(config)#bannermotd@
EnterTEXTmessage.Endwiththecharacter'@'.
@
heekhero(config)#exit
heekhero#
%SYS-5-CONFIG_I:
Configuredfromconsolebyconsole
heekhero#exit
heekherocon0isnowavailable
PressRETURNtogetstarted.
heekhero>
4.配置接口状态
5.查看交换机的系统和配置信息
6.配置路由器的接口并查看接口配置
7.显示路由表的信息
8、实验结果
(1)交换机的配置文件内容
heekhero#showrunning-config
Buildingconfiguration...
Currentconfiguration:
1030bytes
!
version12.1
noservicetimestampslogdatetimemsec
noservicetimestampsdebugdatetimemsec
noservicepassword-encryption
!
hostnameheekhero
!
!
!
interfaceFastEthernet0/1
description"Thisisopenbyheekhero"
duplexhalf
speed10
!
interfaceFastEthernet0/2
!
interfaceFastEthernet0/3
!
interfaceFastEthernet0/4
!
interfaceFastEthernet0/5
!
interfaceFastEthernet0/6
!
interfaceFastEthernet0/7
!
interfaceFastEthernet0/8
!
interfaceFastEthernet0/9
!
interfaceFastEthernet0/10
!
interfaceFastEthernet0/11
!
interfaceFastEthernet0/12
!
interfaceFastEthernet0/13
!
interfaceFastEthernet0/14
!
interfaceFastEthernet0/15
!
interfaceFastEthernet0/16
!
interfaceFastEthernet0/17
!
interfaceFastEthernet0/18
!
interfaceFastEthernet0/19
!
interfaceFastEthernet0/20
!
interfaceFastEthernet0/21
!
interfaceFastEthernet0/22
!
interfaceFastEthernet0/23
!
interfaceFastEthernet0/24
!
interfaceVlan1
noipaddress
shutdown
!
bannermotd^C
^C
!
linecon0
!
linevty04
login
linevty515
login
!
!
end
(2)路由器的配置文件内容:
Router#showrunning-config
Buildingconfiguration...
Currentconfiguration:
463bytes
!
version12.4
noservicetimestampslogdatetimemsec
noservicetimestampsdebugdatetimemsec
noservicepassword-encryption
!
hostnameRouter
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interfaceFastEthernet0/0
ipaddress192.168.1.1255.255.255.0
duplexauto
speedauto
!
interfaceFastEthernet0/1
noipaddress
duplexauto
speedauto
shutdown
!
interfaceVlan1
noipaddress
shutdown
!
ipclassless
!
!
!
!
!
!
!
linecon0
linevty04
login
!
!
!
end
报告评分:
指导教师签字:
实验报告
学生姓名:
付明浩学号:
2017060202006指导教师:
王晓敏
实验地点:
主楼A2-413-1实验时间:
2019年5月22日
一、实验项目名称:
虚拟局域网VLAN组网
二、实验目的:
掌握如何在交换机上划分基于端口的VLAN、如何给VLAN内添加端口,理解跨交换机之间VLAN的特点。
三、实验内容:
本实验包括两阶段组网需求:
(1)阶段一:
使用VLAN实现隔离。
假设某企业有两个主要部门:
销售部和技术部,其中销售部门内部的个人计算机系统连接在不同的交换机上,他们之间需要相互进行通信,但为了数据安全起见,销售部和技术部需要进行相互隔离,现要在交换机上做适当配置来实现这一目标。
通过划分PortVLAN实现交换机的端口隔离,然后使在同一VLAN里的计算机系统能跨交换机进行相互通信,而在不同VLAN里的计算机系统不能进行相互通信。
(2)阶段二:
使用三层交换机实现VLAN间互联互通。
在采用VLAN实现了阶段一的不同VLAN之间隔离需求后,现在销售部和技术部之间也需要互联。
现要在交换机上做适当配置来实现这一目标。
需要在网络内所有的交换机上配置VLAN,然后在三层交换机上给相应的VLAN设置IP地址,以实现VLAN间的路由。
四、实验环境
五、实验设备:
(1)三层交换机L3-SW:
3560-24PS
(2)二层交换机L2-SW:
2960-24
(3)终端:
PC-PT
六、实验原理
(1)使用VLAN实现隔离:
VLAN(VirtualLocalAreaNetwork,虚拟局域网)是指在一个物理网段内,进行逻辑的划分,划分成若干个虚拟局域网。
VLAN最大的特性是不受物理位置的限制,可以进行灵活的划分。
VLAN具备了一个物理网段所具备的特性。
相同VLAN内的主机可以互相直接访问,不同VLAN间的主机之间互相访问必须经由路由设备进行转发。
广播数据包只可以在本VLAN内进行传播,不能传输到其他VLAN中。
PortVlan是实现VLAN的方式之一,PortVlan是利用交换机的端口进行VLAN的划分,一个端口只能属于一个VLAN。
TagVlan是基于交换机端口的另外一种类型,主要用于实现跨交换机的相同VLAN内主机之间可以直接访问,同时对于不同VLAN的主机进行隔离。
TagVlan遵循了IEEE802.1q协议的标准。
在利用配置了Tagvlan的接口进行数据传输时,需要在数据帧内添加4个字节的802.1q标签信息,用于标识该数据帧属于哪个VLAN,以便于对端交换机接收到数据帧后进行准确的过滤。
(2)使用三层交换机实现VLAN间的互联互通
在交换网络中,通过VLAN对一个物理网络进行了逻辑划分,不同的VLAN之间是无法直接访问的,必须通过三层的路由设备进行连接。
一般利用路由器或三层交换机来实现不同VLAN之间的互相访问。
三层交换机和路由器具备网络层的功能,能够根据数据的IP包头信息,进行选路和转发,从而实现不同网段之间的访问。
直连路由是指:
为三层设备的接口配置IP地址,并且激活该端口,三层设备会自动产生该接口IP所在网段的直连路由信息。
三层交换机实现VLAN互访的原理是,利用三层交换机的路由功能,通过识别数据包的IP地址,查找路由表进行选路转发。
三层交换机利用直连路由可以实现不同VLAN之间的互相访问。
三层交换机给接口配置IP地址,采用SVI(交换虚拟接口)的方式实现VLAN间互连。
SVI是指为交换机中的VLAN创建虚拟接口,并且配置IP地址。
七、实验步骤:
1.配置两台交换机的主机名
2.在三层交换机上生成VLAN并添加成员端口
3.在二层交换机上生成VLAN并添加成员端口
4.设置交换机之间的链路为Trunk
5.查看VLAN和Trunk的配置
6.验证配置
见实验结果
7.在三层交换机上配置SVI端口
8.启动三层交换机路由转发
9.查看SVI端口的配置
10.验证配置
见实验结果
八、实验结果:
1.使用VLAN实现隔离:
(1)每个交换机的配置文件内容,即showrunning-config的结果\
①Switch3:
heekehro_sw_3#showrunning-config
Buildingconfiguration...
Currentconfiguration:
1750bytes
!
version12.2
noservicetimestampslogdatetimemsec
noservicetimestampsdebugdatetimemsec
noservicepassword-encryption
!
hostnameheekehro_sw_3
!
!
!
!
!
iprouting
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interfaceFastEthernet0/1
switchporttrunkencapsulationdot1q
switchportmodetrunk
!
interfaceFastEthernet0/2
!
interfaceFastEthernet0/3
!
interfaceFastEthernet0/4
!
interfaceFastEthernet0/5
!
interfaceFastEthernet0/6
switchportaccessvlan10
switchportmodeaccess
!
interfaceFastEthernet0/7
switchportaccessvlan10
switchportmodeaccess
!
interfaceFastEthernet0/8
switchportaccessvlan10
switchportmodeaccess
!
interfaceFastEthernet0/9
switchportaccessvlan10
switchportmodeaccess
!
interfaceFastEthernet0/10
switchportaccessvlan10
switchportmodeaccess
!
interfaceFastEthernet0/11
switchportaccessvlan20
switchportmodeaccess
!
interfaceFastEthernet0/12
switchportaccessvlan20
switchportmodeaccess
!
interfaceFastEthernet0/13
switchportaccessvlan20
switchportmodeaccess
!
interfaceFastEthernet0/14
switchportaccessvlan20
switchportmodeaccess
!
interfaceFastEthernet0/15
switchportaccessvlan20
switchportmodeaccess
!
interfaceFastEthernet0/16
!
interfaceFastEthernet0/17
!
interfaceFastEthernet0/18
!
interfaceFastEthernet0/19
!
interfaceFastEthernet0/20
!
interfaceFastEthernet0/21
!
interfaceFastEthernet0/22
!
interfaceFastEthernet0/23
!
interfaceFastEthernet0/24
!
interfaceGigabitEthernet0/1
!
interfaceGigabitEthernet0/2
!
interfaceVlan1
noipaddress
shutdown
!
interfaceVlan10
ipaddress192.168.10.1255.255.255.0
!
interfaceVlan20
ipaddress192.168.20.1255.255.255.0
!
ipclassless
!
!
!
!
!
!
!
linecon0
linevty04
login
!
!
!
end
②Switch2:
heekhero_sw_2#showrunning-config
Buildingconfiguration...
Currentconfiguration:
1232bytes
!
version12.1
noservicetimestampslogdatetimemsec
noservicetimestampsdebugdatetimemsec
noservicepassword-encryption
!
hostnameheekhero_sw_2
!
!
!
interfaceFastEthernet0/1
switchportmodetrunk
!
interfaceFastEthernet0/2
!
interfaceFastEthernet0/3
!
interfaceFastEthernet0/4
!
interfaceFastEthernet0/5
!
interfaceFastEthernet0/6
switchportaccessvlan10
switchportmodeaccess
!
interfaceFastEthernet0/7
switchportaccessvlan10
switchportmodeaccess
!
interfaceFastEthernet0/8
switchportaccessvlan10
switchportmodeaccess
!
interfaceFastEthernet0/9
switchportaccessvlan10
switchportmodeaccess
!
interfaceFastEthernet0/10
switchportaccessvlan10
switchportmodeaccess
!
interfaceFastEthernet0/11
!
interfaceFastEthernet0/12
!
interfaceFastEthernet0/13
!
interfaceFastEthernet0/14
!
interfaceFastEthernet0/15
!
interfaceFastEthernet0/16
!
interfaceFastEthernet0/17
!
interfaceFastEthernet0/18
!
interfaceFastEthernet0/19
!
interfaceFastEthernet0/20
!
interfaceFastEthernet0/21
!
interfaceFastEthernet0/22
!
interfaceFastEthernet0/23
!
interfaceFastEthernet0/24
!
interfaceVlan1
noipaddress
shutdown
!
!
linecon0
!
linevty04
login
linevty515
login
!
!
End
(2)各个ping的测试结果截图
①PC4ping通PC2
②PC4不能ping通PC3
③将PC2连线转移到VLAN20端口上,此时与PC4失去连接
2.使用三层交换机实现VLAN间的互联互通
(1)每个交换机的配置文件内容,即showrunning-config的结果
如上所示
(2)各个ping的测试结果截图
①PC4pingPC3成功
②PC4pingPC2成功
报告评分:
指导教师签字:
实验报告
学生姓名:
付明浩学号:
2017060202006指导教师:
王晓敏
实验地点:
主楼A2-413-1实验时间:
2019年5月25日
一、实验名称:
静态路由
二、实验目的:
理解静态路由的工作原理,掌握如何配置静态路由。
三、实验内容:
假设计划建设的园区网,分为两个区域,距离较远。
其中区域1中存在网络NET1,区域2中存在网络NET3,NET4。
现在需要使用两台路由器实现两个区域之间的互联互通。
NET1,NET3和NET4均是通过二层交换机构建的以太网局域网,连接用户PC机,每个局域网均连接到各自的网关路由器以太网接口上。
NET2是广域网,实现两个区域两台路由器之间的连接。
局域网NET1中的PC机与NET3、NET4中PC机的通信通过广域网NET2实现。
现要在路由器上做适当配置,实现园区网内各个区域子网之间的相互通信。
两台路由器通过广域网串行接口,以V.35DCE/DTE广域网专用电缆连接在一起,设置静态路由,实现所有子网间的互通。
四、实验环境:
五、实验设备:
交换机:
3台;路由器(带广域网串行接口):
2台;广域网电缆V.35