计算机网络实验报告Word格式.docx
《计算机网络实验报告Word格式.docx》由会员分享,可在线阅读,更多相关《计算机网络实验报告Word格式.docx(54页珍藏版)》请在冰豆网上搜索。
【背景描述】
假设此交换机是校园网中的一台底层交换机,学院书记PC1连接在交换机的0/5口;
教学秘书PC2连接在交换机的0/15口。
由于书记使用机器要管理学院网络非常重要,现要实现书记与教学秘书使用的端口隔离。
【实现功能】
通过划分PORTVLAN实现本交换端口隔离。
【实验拓扑】
【实验设备】
S2126G(1台)
【实验步骤】
第一步:
在未划VLAN前两台PC互相ping可以通。
(必须是两台机器在同一网段)
第二步:
创建VLAN。
Switch#configureterminal!
进入交换机全局配置模式。
Switch(config)#vlan10!
创建vlan10。
Switch(config-vlan)#nameshuji10!
将Vlan10命名为shuji10。
Switch(config-vlan)#exit
Switch(config)#vlan20!
创建vlan20。
Switch(config-vlan)#namemishu20!
将Vlan20命名为mishu20。
验证测试:
Switch#showvlan
VLANNameStatusPorts
----------------------------------------------------------------------------
1defaultactiveFa0/1,Fa0/2,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,Fa0/24
10shuji10active
20mishu20active
第三步:
将接口分配到VLAN。
Switch(config)#interfacefastethernet0/5!
进入fastethernet0/5的接口配置模式。
Switch(config-if)#switchportaccessvlan10!
将fastethernet0/5端口加入vlan10中。
Switch(config-if)#exit
Switch(config)#interfacefastethernet0/15!
进入fastethernet0/15的接口配置模式。
Switch(config-if)#switchportaccessvlan20!
将fastethernet0/15端口加入vlan20中。
第四步:
两台PC互相ping不通。
Fa0/4,Fa0/6,Fa0/7
Fa0/8,Fa0/9,Fa0/10
Fa0/11,Fa0/12,Fa0/13
Fa0/14,Fa0/16,Fa0/17
Fa0/18,Fa0/19,Fa0/20
Fa0/21,Fa0/22,Fa0/23
Fa0/24
10shuji10activeFa0/5
20mishu20activeFa0/15
【注意事项】
清空交换机原有vlan配置。
deleteflash:
config.text
vlan.dat(这2个命令在14级特权模式下是无效的,掌握命令就可以)
执行完命令要重启交换机,交换机重启命令reload。
【参考配置】
Switch#showrunning-config
Systemsoftwareversion:
2.41
(2)BuildOct242005Release
Buildingconfiguration...
Currentconfiguration:
227byte
!
version1.0
hostnameSwitch
vlan1
vlan10
nameshuji10
vlan20
namemishu20
interfaceFastEthernet0/5
switchportaccessvlan10
interfaceFastEthernet0/15
switchportaccessvlan20
end
【实验结果】
实验名称:
实验2跨交换机实现VLAN802.1Q
理解VLAN如何跨交换机实现。
TagVlan是基于交换机端口的另外一种类型,主要用于实现跨交换机的相同VLAN内可以直接访问,同时对于不同VLAN的主机进行隔离。
TagVlan遵循IEEE802.1q协议标准。
在利用配置了TagVlan的接口进行数据传输是,需要在数据帧内添加4个字节的802.1q标签信息,用于标识该数据帧属于哪个VLAN,以便于对端交换机接收到数据帧后进行准确的过虑。
假设某企业有2个主要部门:
销售部(sales)和技术部(technical),其中销售部门的个人计算机系统分散连接在2台交换机上,他们之间需要相互进行通信,但为了数据安全起见,销售部和技术部需要进行相互隔离,现要在交换机上做适当配置来实现这一目标。
使在同一VLAN里的计算机系统能跨交换机进行相互通信,而在不同VLAN里的计算机系统不能进行相互通信。
实验内容
S2126G(2台)
在第一台交换机上把交换机命名为SwitchA并创建Vlan10,并将0/5端口划分到Vlan10中。
Switch#configureterminal!
进入全局配置模式。
Switch(config)#hostnameSwitchA!
给交换机命名。
SwitchA(config)#vlan10!
创建Vlan10。
SwitchA(config-vlan)#namesales!
将Vlan10命名为sales。
SwitchA(config-vlan)#exit
SwitchA(config)#interfacefastethernet0/5!
进入接口配置模式。
SwitchA(config-if)#switchportaccessvlan10!
将0/5端口划分到Vlan10。
验证已创建了Vlan10,并将0/5端口已划分到Vlan10中。
SwitchA#showvlanid10
10salesactiveFa0/5
在交换机SwitchA上创建Vlan20,并将0/15端口划分到Vlan20中。
SwitchA(config)#vlan20!
创建Vlan20。
SwitchA(config-vlan)#nametechnical!
将Vlan20命名为technical。
SwitchA(config)#interfacefastethernet0/15!
SwitchA(config-if)#switchportaccessvlan20!
将0/15端口划分到Vlan20。
验证已创建了Vlan20,并将0/15端口已划分到Vlan20中。
SwitchA#showvlanid20
20technicalactiveFa0/15
在交换机SwitchA上将与SwitchB相连的端口(假设为0/24端口)定义为tagvlan模式。
SwitchA(config)#interfacefastethernet0/24!
SwitchA(config-if)#switchportmodetrunk!
将fastethernet0/24端口设为tagvlan模式。
验证fastethernet0/24端口已被设置为tagvlan模式。
SwitchA#showinterfacesfastEthernet0/24switchport
InterfaceSwitchportModeAccessNativeProtectedVLANlists
-------------------------------------------------------------------------
Fa0/24EnabledTrunk11DisabledAll
在第二台交换机上把交换机命名为SwitchB并在交换机上创建Vlan10,并将0/5端口划分到Vlan10中。
Switch(config)#hostnameSwitchB!
SwitchB(config)#vlan10!
SwitchB(config-vlan)#namesales!
SwitchB(config-vlan)#exit
SwitchB(config)#interfacefastethernet0/5!
SwitchB(config-if)#switchportaccessvlan10!
验证已在SwitchB上创建了Vlan10,并将0/5端口已划分到Vlan10中。
SwitchB#showvlanid10
第五步:
在交换机SwitchB上将与SwitchA相连的端口(假设为0/24端口)定义为tagvlan模式。
SwitchB(config)#interfacefastethernet0/24!
SwitchB(config-if)#switchportmodetrunk!
SwitchB#showinterfacesfastEthernet0/24switchport
第六步:
验证PC1与PC3能互相通信,但PC2与PC3不能互相通信。
C:
\>
ping192.168.10.30!
在PC1的命令行方式下验证能Ping通PC3。
Pinging192.168.10.30with32bytesofdata:
Replyfrom192.168.10.30:
bytes=32time<
10msTTL=128
Pingstatisticsfor192.168.10.30:
Packets:
Sent=4,Received=4,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=0ms,Maximum=0ms,Average=0ms
在PC2的命令行方式下验证不能Ping通PC3。
Requesttimedout.
Sent=4,Received=0,Lost=4(100%loss),
两台交换机之间相连的端口应该设置为tagvlan模式。
把三台PC的IP设置成同一网段的地址
SwitchA#showrunning-config!
显示交换机SwitchA的全部配置。
284bytes
hostnameSwitchA
namesales
nametechnical
interfacefastEthernet0/5
interfacefastEthernet0/15
interfacefastEthernet0/24
switchportmodetrunk
witchB#showrunning-config!
显示交换机SwitchB的全部配置。
hostnameSwitchB
实验3静态路由
2015年11月13日(填写做实验当日日期)
掌握通过静态路由方式实现网络的连通性
路由器属于网络层设备,能够根据IP包头的信息,选择一条最佳路径,将数据包转发出去。
实现不同网段的主机之间的互相访问。
静态路由是在拓扑结构简单的网络中,网络管理员通过手工的方式配置本路由器未知网段的路由信息,从而实现不同网段之间的连接。
假设校园网通过一台路由器连接到校园外的另一台路由器上,现要在路由器上做适当配置,实现校园网内部主机与校园网外部主机的相互通信。
【实现功能】
实现网络的互连互通,从而实现信息的共享和传递
【实验拓扑】
R2624(2台)、V35DTE线缆(1根)、V35DCE线缆(1根)
【实验步骤】
在路由器Router1上配置接口的IP地址和串口上的时钟频率
(登录路由器以后ctrl+c键挂断询问)
Red-Giant>
enable
Red-Giant#configureterminal
Red-Giant(config)#hostnameRouter1
Router1(config)#interfacefastethernet0!
进入接口F0的配置模式
Router1(config-if)#ipaddress172.16.1.1255.255.255.0!
配置路由器接口F0的IP地址
Router1(config-if)#noshutdown!
开启路由器fastethernet0接口!
Router1(config)#interfaceserial0!
进入接口S0配置模式
Router1(config-if)#ipaddress172.16.2.1255.255.255.0!
配置路由器接口S0的IP地址
Router1(config-if)#clockrate64000!
配置Router1的时钟频率(DCE)
开启路由器fastethernet0接口
验证路由器接口的配置
Router1#showipinterfacebrief
InterfaceIP-AddressOK?
MethodStatusProtocol
FastEthernet0172.16.1.1YESmanualupup
Serial0172.16.2.1YESmanualdowndown
Serial1unassignedYESunsetadministrativelydowndown
Router1#showinterfaceserial0
Serial0isdown,lineprotocolisdown
HardwareisHDLC4530A
Internetaddressis172.16.2.1/24
MTU1500bytes,BW2048Kbit,DLY20000usec,rely255/255,load1/255
EncapsulationHDLC,loopbacknotset,keepaliveset(10sec)
Lastinputnever,outputnever,outputhangnever
Lastclearingof"
showinterface"
countersnever
Inputqueue:
0/75/0(size/max/drops);
Totaloutputdrops:
0
Queueingstrategy:
weightedfair
Outputqueue:
0/64/0(size/threshold/drops)
Conversations0/0(active/maxactive)
ReservedConversations0/0(allocated/maxallocated)
5minuteinputrate0bits/sec,0packets/sec
5minuteoutputrate0bits/sec,0packets/sec
0packetsinput,0bytes,0nobuffer
Received0broadcasts
0inputerrors,0CRC,0frame,0overrun,0ignored,0abort
0packetsoutput,0bytes,0underruns
0outputerrors,0collisions,8interfaceresets
0outputbufferfailures,0outputbuffersswappedout
0carriertransitions
DCD=downDSR=downDTR=downRTS=downCTS=down
在路由器Router1上配置静态路由
Router1(config)#iproute172.16.3.0255.255.255.0172.16.2.2
或(注意是在什么模式下配置的路由信息)
Router1(config)#iproute172.16.3.0255.255.255.0serial0
验证Router1上的静态路由配置
Router1#showiproute
Codes:
C-