实验四路由交换综合实验.docx
《实验四路由交换综合实验.docx》由会员分享,可在线阅读,更多相关《实验四路由交换综合实验.docx(10页珍藏版)》请在冰豆网上搜索。
实验四路由交换综合实验
实验四PacketTracer路由交换综合实验
实验要求:
使用PacketTracer模拟器搭建实验拓扑,并对交换机、路由器、
PC和服务器进行相应配置,配置最后结果,能实现PC之间的ping互通,能
通过PC的浏览器访问服务器网站。
配置步骤如下:
Stepl:
搭建实验拓扑如下图所示:
PC1-VLAH10
taD/Z3
PC-PT
PC1-VLAN2C
fa3/24
LTZIT.20..1LO/24
fiL'/O
172.17.M.200/2^r£.]740.2CO/24
2M.165i201
S&irv@r-PTSeiVer0
Step2:
规划各设备的IP地址,如下表所示:
设备
接口
IP地址
网关
R1
FaO/O
172.17.10.1/24
FaO/1
172.17.20.1/24
Fa1/0
192.168.12.1/24
R2
Fa0/0
172.17.30.1/24
Fa0/1
172.17.40.1/24
Fa1/0
192.168.12.2/24
Fa1/1
209.165.201.1/24
PC1
快速以太网口
172.17.10.100/24
172.17.10.1
PC2
快速以太网口
172.17.20.100/24
172.17.20.1
PC3
快速以太网口
172.17.30.200/24
172.17.30.1
PC4
快速以太网口
172.17.40.200/24
172.17.40.1
SERVER
快速以太网口
209.165.201.254/24
209.165.201.1
请注意:
在配置PC机的IP地址时,切记一定要配网关IP地址。
Step3:
路由器及交换机基本配置:
一、配置路由器R1、R2,交换机S1、S2的主机名分别为Routerl、Router2、Switchl、
Switch2。
Switch>enable
Switch#configureterminal
Enterconfigurationcommands,oneperline.
Switch(config)#hostnameSwitch1
Switch1(config)#
Switch>enable
Switch#configureterminal
Enterconfigurationcommands,oneperline.
Switch(config)#hostnameSwitch2
Switch2(config)#
Router>enable
Router#configureterminal
Enterconfigurationcommands,oneperline.
Router(config)#hostnameRouter1
Router1(config)#
Router>enable
Router#configureterminal
Enterconfigurationcommands,oneperline.
Router(config)#hostnameRouter2
Router2(config)#
EndwithCNTL/Z.
EndwithCNTL/Z.
EndwithCNTL/Z.
EndwithCNTL/Z.
EndwithCNTL/Z.
EndwithCNTL/Z.
根据IP地址规划表配置各设备IP地址、掩码、网关。
Router1#
Router1#configureterminal
Enterconfigurationcommands,oneperline.
Router1(config)#interfaceFastEthernet0/0Router1(config-if)#exit
Router1(config)#intf1/0
Router1(config-if)#ipadd192.168.12.1255.255.255.0
Router1(config-if)#noshut
Router1(config-if)#exit
Router1(config)#intf0/0
Router1(config-if)#ipadd172.17.10.1255.255.255.0
Router1(config-if)#noshut
Router1(config-if)#exit
Router1(config)#intf0/1
Router1(config-if)#ipadd172.17.20.1255.255.255.0
Router1(config-if)#noshut
Router1(config-if)#
Router2#
Router2#configureterminal
Enterconfigurationcommands,oneperline.
Router2(config)#interfaceFastEthernet0/0Router2(config-if)#exit
Router2(config)#intf1/0
Router2(config-if)#ipadd192.168.12.2255.255.255.0
Router2(config-if)#noshut
Router2(config-if)#exit
Router2(config)#intf0/0
Router2(config-if)#ipadd172.17.30.1255.255.255.0
Router2(config-if)#noshut
Router2(config-if)#exit
Router2(config)#intf0/1
Router2(config-if)#ipadd172.17.40.1255.255.255.0
Router2(config-if)#noshut
Router(config-if)#exit
Router(config)#interfaceFastEthernet1/1
Router(config-if)#ipaddress209.165.201.1255.255.255.0
Router(config-if)#noshut
Router2(config-if)#
Step4:
交换机VLAN配置:
一、在交换机S1上创建两个VLAN:
1.VLAN10,VLAN名称为sales。
Switch1(config)#vlan10
Switch1(config-vlan)#namesales
Switch1(config-vlan)#exit
Switch1(config)#
2.VLAN20,VLAN名称为faculty。
Switch1(config)#vlan20
Switch1(config-vlan)#namefaculty
Switch1(config-vlan)#exit
Switch1(config)#
3.将fa0/1、fa0/23配置为access模式,并将它们划分为VLAN10的成员。
Switch1(config)#interfaceFastEthernet0/1
Switch1(config-if)#switchportaccessvlan10
Switch1(config-if)#
Switch1(config)#interfaceFastEthernet0/23
Switch1(config-if)#switchportaccessvlan10
4.将fa0/2、fa0/24配置为access模式,并将它们划分为VLAN20的成员。
Switch1(config)#interfaceFastEthernet0/2
Switch1(config-if)#switchportaccessvlan20
Switch1(config)#interfaceFastEthernet0/24
Switch1(config-if)#switchportaccessvlan20
二、在交换机S2上创建两个VLAN:
1.VLAN30,VLAN名称为management。
Switch2(config)#vlan30
Switch2(config-vlan)#namemanagement
Switch2(config-vlan)#exit
Switch2(config)#
2.VLAN40,VLAN名称为partner。
Switch2(config)#vlan40
Switch2(config-vlan)#namepartner
Switch2(config-vlan)#exit
Switch2(config)#
3.将fa0/1、fa0/23配置为access模式,并将它们划分为VLAN30的成员。
Switch2(config)#interfaceFastEthernet0/1
Switch2(config-if)#switchportaccessvlan30
Switch2(config-if)#exit
Switch2(config)#interfaceFastEthernet0/23
Switch2(config-if)#switchportaccessvlan30
Switch2(config-if)#exit
4.将fa0/2、fa0/24配置为access模式,并将它们划分为VLAN40的成员。
Switch2(config)#interfaceFastEthernet0/2
Switch2(config-if)#switchportaccessvlan40
Switch2(config-if)#exit
Switch2(config)#interfaceFastEthernet0/24
Switch2(config-if)#switchportaccessvlan40
Step5:
路由器动态路由协议配置
在两个路由器上启动OSPF协议,将各接口直连网络用network命令发布。
配置OSPF协议的步骤如下:
R1的配置:
1.全局模式下启动OSPF协议
R1(config)#
routerospf1
Router1(config)#routeospf1
Routerl(config-router)#
解释:
命令格式上
1启动OSPF协议与启动RIP协议类似,但routerOSPF后面多出
了一个进程号(ID为1),该进程号仅具有本地意义,各路由器上的进程号可以不一样。
回
车后进入路由配置模式:
Router(config-router)。
2.使用network命令发布网络。
R1(config-router)#
net192.168.12.00.0.0.255area0;net是network的
简写
R1(config-router)#
net172.17.10.00.0.0.255area0
R1(config-router)#
net172.17.20.00.0.0.255area0
解释:
OSPF协议在发布网络的时候可以做到精确发布,可以看到network命令后面
不止携带了网络地址,
还有如0.0.0.255这样的通配符。
从通配符的形式上可以看出,它是
子网掩码的反码形式,用255.255.255.255减去子网掩码即可得到通配符。
另外,OSPF作为一个层次化的路由协议,还需要指明运行协议的区域。
一个复杂的
OSPF网络(自治系统)中会包含多个区域,它们之间用区域号来进行区分,每个区域中运行各自的OSPF协议实例,区域之间通过ABR连接主干区域进行交互,而主干区域总是
area0。
本实验中我们只进行单区域的OSPF配置,默认使用区域0
在R2上进行相同的配置。
R2(config-router)#
R2(config-router)#
net192.168.12.00.0.0.255area0
net209.165.201.00.0.0.255area0
3.在路由模式下配置路由器被动接口。
解释:
若路由器接口连接的是终端设备诸如PC、SERVER,则不用向该网络通告动态
路由更新,只有与中间设备(诸如路由器)交互路由更新才是有意义的。
把路由器中连接终端设备的接口配置为被动接口,将不会向接口直连网络通告路由更新,这样可以降低流量,
提高性能。
配置被动接口的方法是:
在路由模式下使用passive-interfaceinterface命令。
对于本实验拓扑中的两个路由器,除了其互连的fa1/0口之外,其他接口均可配置为被动接
口。
R1上的被动接口配置如下:
R1(config-router)#passive-interfacefa0/0
R1(config-router)#passive-interfacefa0/1
根据拓扑,在R2上配置相应的被动接口。
R2上的被动接口配置如下:
R2(config-router)#passive-interfacefa0/0
R2(config-router)#passive-interfacefa0/1
R2(config-router)#passive-interfacefa1/1
Step6:
验证配置结果。
三、在各设备中使用show命令查看配置结果,可以使用的命令如:
1.showrun:
查看运行配置。
routerospf1
log-adjacency-changespassive-interfaceFastEthernetO/O
passive-interfaceFastEthernet0/1
network192.168.12.00.0.0.255area0network172.17.10.00.0.0.255area0
network172.17.210.00.0.0.255area0
!
2.showiproute:
查看路由表。
Router1#shoiprout
Codes:
C-connected,S-static,I-IGRP,R-RIP,M-mobile,B-BGP
D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterareaN1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2E1-OSPFexternaltype1,E2-OSPFexternaltype2,E-EGPi-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterarea*-candidatedefault,U-per-userstaticroute,o-ODRP-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
172.17.0.0/24issubnetted,2subnets
C172.17.10.0isdirectlyconnected,FastEthernet0/0
C172.17.20.0isdirectlyconnected,FastEthernet0/1
C192.168.12.0/24isdirectlyconnected,FastEthernet1/0
Router1#
3.showvlanbrief:
查看VLAN分配情况。
Router1#shvlanbrief
VLANNameStatusPorts
1default
active
1002fddi-default
active
1003token-ring-default
active
1004fddinet-default
active
1005trnet-default
active
Router1#
4.showipintbrief:
查看接口IP地址配置情况。
Router1#shipintbrief
Interface
IP-Address
OK?
MethodStatus
Protocol
FastEthernet0/0
172.17.10.1
YESmanualup
up
FastEthernet0/1
172.17.20.1
YESmanualup
up
FastEthernet1/0
192.168.12.1
YESmanualup
up
FastEthernet1/1
unassigned
YESunsetadministrativelydowndown
Vlan1
unassigned
YESunsetadministrativelydowndown
Router1#
四、使用ping命令验证连通性。
1.PC1与其他PC之间的连通性。
在路由器上运行路由协议后,可以实现不同VLAN间的通信。
2.各PC和网关、路由器接口、服务器之间的连通性。
3.在PC的webbrowser中的地址栏键入SERVER的IP地址209.165.201.254,可以访问SERVER网站(webbrowser中出现网页显示)。
三、记录自己的配置步骤和结果。
5.showinterface
interface:
查看单个接口配置情况。
欢迎下载,谢谢观看!
资料仅供参考学习