案例十一 OSPF协议实现网络互连【背景描述】假设校园网通过1台三层交换机连接到校园网出口路由器,路由器连接到校园外的另1 台路山器上,现要在路山器上做适当配置,实现校园网内部主机与校园网外部的相互通信本案例以两台R2624路由器、1台三层交换机为例oS3550上划分有VLAN 10和VLAN50, 其中VLAN 10用于连接RouterLVLAN50用于连接校园网主机路由器分别命名为Router 1 和Router2,路由器Z间用过串口采川V35 DCE/DTE电缆连接,DCE端连接到Routerl上 PC1的IP地址和缺省网关分别为172.16.5.11和172.16.5」,PC2的IP地址和缺省网关分別 为 172.16.3.22 和 172.16.3.1,网络掩码都是 255.255.255.0.【实现功能】实现网络的互连互通,从而实现信息的共享和传递使用设备】设备类型设备名称设备数量交换机路由器Router2三层交换机Switch1双绞线3计算机2【实验拓扑】【实现步骤】步骤1基本配置三层交换机的基本配置Switch#configure terminalSwitch(config)#hostname S3550S3550(config)#VLan 10S3550(config-vlan)#EXltS3550(config)#Vlan 50S3550(config-vlan)#exitS3550(config)#interface fastEthernet 0/1S3550(config-if)#switchport access vlan 10S3550(config-if)#exiS3550(config)#interface fastEthernet 0/5S3550(config-if)#switchport access vlan 50S3550(config-if)#exitS3550(config)#interface vlan 10S3550(config-if)#ip address 172.16.1.2 255.255.255.0S3550(config-if)#no shutdownS3550(config-if)#exitS3550(config)#interface vlan 50S3550(config-if)#ip address 172.16.5.1 255.255.255.0S3550(config-if)#no shutdownS3550(config-if)#exit验证测试S3550#show vlanVLAN NameStatusPorts1defaultactiveFaO/2 ,FaO/3 ,FaO/4 ,FaO/6FaO/7 ,FaO/8 ,FaO/9 ,Fa0/10FaO/11 ,FaO/12,FaO/13,FaO/14FaO/15,Fa()/l 6,FaO/l 7,FaO/l 8Fa0/19,Fa0/20,Fa0/21 ,FaO/22FaO/23,FaO/24,Gil/l10VLAN0010activeFaO/150VLAN0050activeFaO/5S3550#show ip interface:VL10InterfaceDescription : Vian 10OperStatus : downManagementstatus : Enabled:00d0.f8b8.2817Primary Internet address: 172.16.1.2/24 Broadcast address : 255.255.255.255InterfaceDescriptionOperStatus Managementstatus:VL50:Vian 50:down:EnabledPhysAddressPrimary Internet address: 172.16.5.1/24Broadcast address:255.255.255.255PhysAddress : (X)dO.f8b8.2818路由器基本配置Rcd-Giant#confConfiguring from terminal, memory, or network [terminal]? Red-Giant(config)#hostname router 1router 1 (config)#interface fastEthernet 0router 1 (config-if)#ip address 172.16.1.1 255.255.255.0router 1 (config-if)#no shutdownrouter 1 (config-if)#cxitrouter 1 (config)#interface serial 0router 1 (config-if)#ip address 172.16.2.1 255.255.255.0router 1 (config-if)#no shutdownRcd-Giant>cnablcRed-Giant#conf routcr2(config)#intcrfacc serial 0 router2(config-if)#ip address 172.16.2.2 255.255.255.0 routcr2(config-if)#no shutdown router2(config-if)#clock rate 64000 routcr2(config-if) #cxitrouter2(config)#interface fastEthernet 0 router2(config-if)#ip address 172.16.3.1 255.255.255.0 router2(config-if)#no shutdownroutcr2(config-if) #cxit验证测试:验证接口的配置和状态InterfaceIP-AddressFastEthernetO172.16.1」FastEthernetlunassignedFastEthernet2unassignedFastEthernetSunassignedSerialO172.16.2.1Serial 1unassignedScrial2unassignedSerial3unassignedrouter 1 #show ip interface briefrouter2#show ip interface briefInterfaceIP-AddressFastEthernetO172.16.3」FastEthcrnct 1unassignedFastEthernet2unassignedFastEthernet3unassignedSerialO172.16.2.2Serial 1unassigned步骤2配置RIPOK? Method Status ProtocolYES manual up upYES unset administratively down down YES unset administratively down downYES unset administratively down down YES manual up upYES unset administratively down down YES unset administratively down downYES unset administratively down downOK? Method Status ProtocolYES manual up upYES unset administratively down downYES unset administratively down down YES unset administratively down downYES manual up upYES unset administratively down downS3550配置OCPF协议S3550(config)#router ospf !开启 OSPF 进程S3550(config-router)#network 172.16.5.0 0.0.0.255 area 0 !中明直连网段,并分配区域号.S3550(config-router)#network 172.16.1.0 0.0.0.255 area 0S3550(config-router)#endrouterl配置OSPF协议router 1 (config) #rouier ospf 1routerl(config-router)#network 172.16.1.() 0.0.0.255 area 0routerl(config-router)#network 172.16.2.0 0.0.0.255 area 0 router 1 (config-router)#end router2配置OSPF协议 router2(config )# router ospf 1 routcr2(config-routcr) #nctrouter2(config-router)#network 172.16.2.0 0.0.0.255 a router2(config-router)#network 172.16.2.0 0.0.0.255 area 0 router2(config-router)#network 172.16.3.0 0.0.0.255 area 0 routcr2(config-routcr)#cnd步骤3验证三台路由设备的路由表,查看是否学习了其它网段的路由信息 S3550#show ip routeType: C - connected, S - static, R - RIP, O ・ OSPE IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2El - OSPF external type 1, E2 ・ OSPF external type 2Type Destination IPNext hopInterface Distance MetricStatusc172.16.1.0/24o.o.o.oVL1000Active0172.16.2.0/24172.16.1.1VL1011049Active0172.16.3.0/24172.16.1.1VL1011050Activec172.16.5.0/24O.O.O.OVL5000Activerouter 1 #show ip routeCodes: C - connected, S ・ static, R ・ RIPO - OSPF, IA - OSPF inter areaEl - OSPF external type。