路由器动态路由协议单区域OSPFv2配置
- 格式:pptx
- 大小:517.65 KB
- 文档页数:21
将路由器连接起来如下图:接下来是为路由器添加模块(注意要关电添加):下面配置路由器A的接口IP:Router#Router#configConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#inRouter(config)#interface seRouter(config)#interface serial 1/1Router(config-if)#ip adRouter(config-if)#ip address 192.168.1.1 255.255.255.0Router(config-if)#coRouter(config-if)#clRouter(config-if)#clock ?rate Configure serial interface clock speedRouter(config-if)#clock raRouter(config-if)#clock rate 64000Router(config-if)#no shRouter(config-if)#no shutdown%LINK-5-CHANGED: Interface Serial1/1, changed state to downRouter(config-if)#%LINK-5-CHANGED: Interface Serial1/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up00:14:54: %OSPF-5-ADJCHG: Process 2, Nbr 10.10.11.1 on Serial1/1 from LOADING to FULL, Loading DoneRouter(config-if)#下面配置路由器B的接口IP:Router#configConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#inRouter(config)#interface se 1/0Router(config-if)#ip adRouter(config-if)#ip address 192.168.1.2 255.255.255.0Router(config-if)#no shRouter(config-if)#no shutdown%LINK-5-CHANGED: Interface Serial1/0, changed state to upRouter(config-if)#%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up01:07:29: %OSPF-5-ADJCHG: Process 2, Nbr 10.10.10.1 on Serial1/0 from LOADING to FULL, Loading DoneRouter(config-if)#接下来进行路由器A环回接口的配置:Router>enRouter#configConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#inRouter(config)#interface loRouter(config)#interface loopback ?<0-2147483647> Loopback interface numberRouter(config)#interface loopback 0%LINK-5-CHANGED: Interface Loopback0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to upRouter(config-if)#ip adRouter(config-if)#ip address 10.10.10.1 255.255.255.0Router(config-if)#下一步进行路由器B环回接口的配置:Router>enRouter#configConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#in lo 0%LINK-5-CHANGED: Interface Loopback0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to upRouter(config-if)#ip add 10.10.11.1 255.255.255.0Router(config-if)#验证路由器A的接口配置:Router#sh interfaces loopback 0Loopback0 is up, line protocol is up (connected)Hardware is LoopbackInternet address is 10.10.10.1/24MTU 1514 bytes, BW 8000000 Kbit, DLY 5000 usec,reliability 255/255, txload 1/255, rxload 1/255Encapsulation LOOPBACK, loopback not setLast input never, output never, output hang neverLast clearing of "show interface" counters neverQueueing strategy: fifoOutput queue 0/0, 0 drops; input queue 0/75, 0 drops5 minute input rate 0 bits/sec, 0 packets/sec5 minute output rate 0 bits/sec, 0 packets/sec0 packets input, 0 bytes, 0 no bufferReceived 0 broadcasts, 0 runts, 0 giants, 0 throttles0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort 0 input packets with dribble condition detected0 packets output, 0 bytes, 0 underruns0 output errors, 0 collisions, 0 interface resets0 babbles, 0 late collision, 0 deferred0 lost carrier, 0 no carrier0 output buffer failures, 0 output buffers s outRouter#验证路由器B的接口配置:Router#sh interfaces loopback 0Loopback0 is up, line protocol is up (connected)Hardware is LoopbackInternet address is 10.10.11.1/24MTU 1514 bytes, BW 8000000 Kbit, DLY 5000 usec,reliability 255/255, txload 1/255, rxload 1/255Encapsulation LOOPBACK, loopback not setLast input never, output never, output hang neverLast clearing of "show interface" counters neverQueueing strategy: fifoOutput queue 0/0, 0 drops; input queue 0/75, 0 drops5 minute input rate 0 bits/sec, 0 packets/sec5 minute output rate 0 bits/sec, 0 packets/sec0 packets input, 0 bytes, 0 no bufferReceived 0 broadcasts, 0 runts, 0 giants, 0 throttles0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort 0 input packets with dribble condition detected0 packets output, 0 bytes, 0 underruns0 output errors, 0 collisions, 0 interface resets0 babbles, 0 late collision, 0 deferred0 lost carrier, 0 no carrier0 output buffer failures, 0 output buffers s outRouter#继续进行路由器A的OSPF的配置:Router#configConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#roRouter(config)#router osfRouter(config)#router osRouter(config)#router ospf ?<1-65535> Process IDRouter(config)#router ospf 2Router(config-router)#netRouter(config-router)#network 10.10.10.0 0.0.0.255 arRouter(config-router)#network 10.10.10.0 0.0.0.255 area 0Router(config-router)#network 192.168.1.0 0.0.0.255 area 0Router(config-router)#继续进行路由器B的OSPF的配置:Router#configConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Router(config)#roRouter(config)#router osRouter(config)#router ospf% Incomplete command.Router(config)#router ospf 2Router(config-router)#net 10.10.10.11 0.0.0.255 area 0Router(config-router)#net 192.168.1.0 0.0.0.255 area 0Router(config-router)#查看路由器A的路由表:Router#sh ip roCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not set10.0.0.0/24 is subnetted, 1 subnetsC 10.10.10.0 is directly connected, Loopback0C 192.168.1.0/24 is directly connected, Serial1/1Router#查看路由器B的路由表:Router#sh ip roCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not set10.0.0.0/8 is variably subnetted, 2 subnets, 2 masksO 10.10.10.1/32 [110/782] via 192.168.1.1, 00:04:25, Serial1/0C 10.10.11.0/24 is directly connected, Loopback0C 192.168.1.0/24 is directly connected, Serial1/0路由器Aping路由器B:通。
ospf 单区域动态路由配置、复习 1静态路由的配置命令2、动态路由RIP 的配置过程router en ablenetwork 直连网络地址二、授新课OSPF 协议是典型的链路状态路由协议,与 RIP 协议对比,它主要是在路由器之间交换 有关自身直连链路的状态信息,这种信息被路由器一个接一个地传递下去,直到到达某一区 域(area)的边界,就不再继续。
一个区域内部的所有路由器原则上都可以得到关于区域内任何一个路由器的链路状态信 息,所以它们可以根据相同的信息得到相同区域的网络拓扑结构图,然后再根据这个图来进 一步计算到达任何一个区域中网络的最佳路径,使结果写入到自己的路由表。
如果只配置单区域的OSPF 协议,则必须使用area 0因为这是一个OSPF 的骨干区域。
当网络规模足够大,要配置其他区域时,OSPF 协议规定这些非骨干区域都要与 area 0直接连 通。
路由器上配置 OSPF 命令:router ospf 进程号network 直连网络地址子网掩码area 0例1:用OSPF 路由协议连通网络10 10.10 2/24 PC2 192 168 2 10Z24 •路由器配置命令序列如下:路由器R1: 路由器R2:PC1192.168 1 10/24 192 168/IF24f0/010.10.10.1/24例2:分别用3种路由配置方法(静态、RIP 、OSPF )连接网络(把配置命令记录在背面)F0/110.10.20 2/24、完成3只设备上的基本配置二、 在3台设备上配置静态路由,使 2台计算机PING 通。
三、 删除原配置的静态路由,然后使用 RIP 路由配置,仍使2台计算机PING 通四、 关闭RIP 路由,使用OSPF 路由配置,使2台计算机PING 通。
作业:把例1中配置OSPF 路由的过程写到作业本上,包括IP 地址的配置10 10 20 1/24FO/2 19216B 11/24Route 1FQ/QF0/010 10 10 2/24Route2 F0/1 192 1闘 2 "24 192 166 2 10/24192 168 1 10/24。
动态路由-----OSPF协议原理与单区域实验配置⼀.OSPF协议的介绍1.OSPF的概述OSPF(Open Shortest Path First)是⼀个内部⽹关协议(Interior Gateway Protocol,简称IGP)。
与RIP相对,OSPF是链路状态路协议,⽽RIP是距离向量路由协议。
链路是路由器接⼝的另⼀种说法,因此OSPF也称为接⼝状态路由协议。
OSPF通过路由器之间通告⽹络接⼝的状态来建⽴链路状态数据库,⽣成最短路径树,每个OSPF路由器使⽤这些最短路径构造路由表。
⽹络,OSPFv3⽤在⽹络。
可⽤于⼤型⽹络。
OSPF路由器收集其所在⽹络区域上各路由器的连接状态信息,即链路状态信息(Link-State),⽣成链路状态数据库(Link-State Database)。
路由器掌握了该区域上所有路由器的链路状态信息,也就等于了解了整个⽹络的拓扑状况。
OSPF路由器利⽤“最短路径优先算法(Shortest Path First, SPF)”,独⽴地计算出到达任意⽬的地的路由。
在OSPF协议下的路由器⼯作流程:2.OSPF的区域简介外部AS:⼀般来讲是运⾏另⼀个路由选择协议的区域,⽐如RIP,EIGRP等。
⾻⼲区域:Area 0,所有区域都必须(⼀般情况下)通过⾻⼲区域进⾏区域间的路由。
标准区域:同上,即最普通的区域。
末梢区域:Stub Area,不接收外部AS(AS代表同⼀路由协议下的路由区域)的路由信息。
完全末梢区域:Totally Stub Area,不接收外部AS的路由信息,同时也不接收本AS中其他Area的。
⾮纯末梢区域:NSSA(Not-So-Stub-Area),允许接收外部AS中以类型7的LSA发送的路由信息,并且ABR将类型7的LSA转换成类型5的LSA 在本AS内进⾏发送...3.OSPF的五种路由器DR:指定路由器,⼀个区域中的主路由器,当其他路由发数据给它时,指定路由器负责通知所有路由器。
单区域OSPF路由协议的配置-电脑资料1.拓扑图2.各路由器上配置完成后的 show runa.r1#show runBuilding configuration...Current configuration : 645 bytes!version 12.4no service timestamps log datetime msecno service timestamps debug datetime msec no service password-encryption!hostname r1!!interface Loopback0ip address 11.11.1.1 255.255.255.0!interface FastEthernet0/0ip address 172.16.123.1 255.255.255.0duplex autospeed auto!interface FastEthernet0/1ip address 10.10.1.254 255.255.255.0duplex autospeed auto!interface Vlan1no ip addressshutdown!router ospf 100log-adjacency-changesnetwork 172.16.123.1 0.0.0.0 area 0 network 10.10.1.254 0.0.0.0 area 0!ip classless!!line con 0line vty 0 4login!!end入内容b.r2#r2#show runBuilding configuration...Current configuration : 666 bytes!version 12.4no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption!hostname r2!!interface Loopback0ip address 22.22.2.2 255.255.255.0!interface FastEthernet0/0ip address 172.16.123.2 255.255.255.0 duplex autospeed auto!interface FastEthernet0/1ip address 10.10.2.254 255.255.255.0 duplex autospeed auto!interface Vlan1no ip addressshutdown!router ospf 100router-id 22.22.2.2log-adjacency-changesnetwork 172.16.123.2 0.0.0.0 area 0 network 10.10.2.254 0.0.0.0 area 0!ip classless!!line con 0line vty 0 4login!!endc.r3#r3#show runBuilding configuration...Current configuration : 645 bytes!version 12.4no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption!hostname r3!!interface Loopback0ip address 33.33.3.3 255.255.255.0!interface FastEthernet0/0ip address 172.16.123.3 255.255.255.0 duplex autospeed auto!interface FastEthernet0/1ip address 10.10.3.254 255.255.255.0duplex autospeed auto!interface Vlan1no ip addressshutdown!router ospf 100log-adjacency-changesnetwork 172.16.123.3 0.0.0.0 area 0network 10.10.3.254 0.0.0.0 area 0!ip classless!!line con 0line vty 0 4login!!end3.查看邻居表、拓扑表、路由表a.r1#show ip ospf neiNeighbor ID Pri State Dead Time Address Interface22.22.2.2 1 FULL/BDR 00:00:35 172.16.123.2 FastEthernet0/033.33.3.3 1 FULL/DROTHER 00:00:31 172.16.123.3 FastEthernet0/0r1#show ip ospf neiNeighbor ID Pri State Dead Time Address Interface22.22.2.2 1 FULL/BDR 00:00:30 172.16.123.2 FastEthernet0/033.33.3.3 1 FULL/DROTHER 00:00:36 172.16.123.3 FastEthernet0/0r1#show ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not set10.0.0.0/24 is subnetted, 3 subnetsC 10.10.1.0 is directly connected, FastEthernet0/1O 10.10.2.0 [110/2] via 172.16.123.2, 00:06:07, FastEthernet0/0O 10.10.3.0 [110/2] via 172.16.123.3, 00:05:57, FastEthernet0/011.0.0.0/24 is subnetted, 1 subnetsC 11.11.1.0 is directly connected, Loopback0172.16.0.0/24 is subnetted, 1 subnetsC 172.16.123.0 is directly connected, FastEthernet0/0r1#b.r2#show ip ospf neiNeighbor ID Pri State Dead Time Address Interface11.11.1.1 1 FULL/DR 00:00:38 172.16.123.1 FastEthernet0/033.33.3.3 1 FULL/DROTHER 00:00:31 172.16.123.3 FastEthernet0/0r2#show ip ospf dataOSPF Router with ID (22.22.2.2) (Process ID 100)Router Link States (Area 0)Link ID ADV Router Age Seq# Checksum Link count172.16.123.1 172.16.123.1 2475 0x80000003 0x0055f2 2172.16.123.2 172.16.123.2 1926 0x80000005 0x006ed2 2172.16.123.3 172.16.123.3 1651 0x80000007 0x0087b2 222.22.2.2 22.22.2.2 489 0x80000007 0x0063f0 211.11.1.1 11.11.1.1 489 0x80000007 0x003254 233.33.3.3 33.33.3.3 469 0x80000003 0x009c89 2Net Link States (Area 0)Link ID ADV Router Age Seq# Checksum172.16.123.1 11.11.1.1 469 0x80000004 0x00fd41r2#show ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not set10.0.0.0/24 is subnetted, 3 subnetsO 10.10.1.0 [110/2] via 172.16.123.1, 00:07:57, FastEthernet0/0C 10.10.2.0 is directly connected, FastEthernet0/1O 10.10.3.0 [110/2] via 172.16.123.3, 00:07:47, FastEthernet0/022.0.0.0/24 is subnetted, 1 subnetsC 22.22.2.0 is directly connected, Loopback0172.16.0.0/24 is subnetted, 1 subnetsC 172.16.123.0 is directly connected, FastEthernet0/0r2#c.r3#show ip ospf neiNeighbor ID Pri State Dead Time Address Interface22.22.2.2 1 FULL/BDR 00:00:33 172.16.123.2 FastEthernet0/011.11.1.1 1 FULL/DR 00:00:37 172.16.123.1 FastEthernet0/0r3#show ip ospf dataOSPF Router with ID (33.33.3.3) (Process ID 100)Router Link States (Area 0)Link ID ADV Router Age Seq# Checksum Link count172.16.123.1 172.16.123.1 2546 0x80000003 0x0055f2 2172.16.123.2 172.16.123.2 1997 0x80000005 0x006ed2 2172.16.123.3 172.16.123.3 1722 0x80000007 0x0087b2 222.22.2.2 22.22.2.2 560 0x80000007 0x0063f0 211.11.1.1 11.11.1.1 560 0x80000007 0x003254 233.33.3.3 33.33.3.3 540 0x80000003 0x009c89 2Net Link States (Area 0)Link ID ADV Router Age Seq# Checksum172.16.123.1 11.11.1.1 540 0x80000004 0x00fd41r3#show ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA externaltype 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not set10.0.0.0/24 is subnetted, 3 subnetsO 10.10.1.0 [110/2] via 172.16.123.1, 00:08:59, FastEthernet0/0O 10.10.2.0 [110/2] via 172.16.123.2, 00:08:59, FastEthernet0/0C 10.10.3.0 is directly connected, FastEthernet0/133.0.0.0/24 is subnetted, 1 subnetsC 33.33.3.0 is directly connected, Loopback0172.16.0.0/24 is subnetted, 1 subnetsC 172.16.123.0 is directly connected, FastEthernet0/0r3#备注:在Packet Tracer环境中,如开始没有配置router-id,之后才配置loopback 0 IP地址,loopback地址不会自动成为router-id,而需要保存配置后,用reload命令重启路由器,,电脑资料《单区域OSPF路由协议的配置》(https://www.)。