IGP-OSPF-LAB-P2P(Area0)

单区域OSPF(p2p)

OSPF作为一种内部网关协议(InteriorGatewayProtocol,IGP),用于在同一个自治系统(AS)中的路由器之间交换路由信息。OSPF的特性如下:

1.可适应大规模网络;

2.收敛速度快;

3.无路由环路;

4.支持VLSM和CIDR;

5.支持等价路由;

6.支持区域划分,构成结构化的网络;

7.提供路由分级管理;

8.支持简单口令和MD5认证;

9.以组播方式传送协议报文;

10.OSPF路由协议的管理距离是110;

11.OSPF路由协议采用cost作为度量标准;

12.OSPF维护邻居表、拓扑表和路由表。

OSPF将网络划分为四种类型:广播多路访问型(BMA)、

非广播多路访问型(NBMA)、

点到点型(Point-to-Point)、

点到多点型(Point-to-MultiPoint)。

不同的二层链路的类型需要OSPF不同的网络类型来适应。

下面的几个术语是学习OSPF要掌握的:

1.链路:链路就是路由器用来连接网络的接口;

2.链路状态:用来描述路由器接口及其与邻居路由器的关系。所有链路状态信息构成链路状态数据库;

1.区域:有相同的区域标志的一组路由器和网络的集合。在同一个区域内的路由器有相同的链路状态数据库;

2.自治系统:采用同一种路由协议交换路由信息的路由器及其网络构成一个自治系统;

3.链路状态通告(LSA):LSA用来描述路由器的本地状态,LSA包括的信息有关于路由器接口的状态和所形成的邻接状态;

4.最短路经优先(SPF)算法:是OSPF路由协议的基础。SPF算法有时也被称为Dijkstra算法,这是因为最短路径优先算法(SPF)是Dijkstra发明的。OSPF路由器利用SPF,独立地计算出到达任意目的地的最佳路由。



点到点链路上的OSPF

233416921.png

R1

R1(config)#intlo0

R1(config-if)#ipadd1.1.1.1255.255.255.0

R1(config)#ints0/0

R1(config-if)#ipadd12.1.1.1255.255.255.0

R1(config-if)#nosh

R1(config)#routeros110

R1(config-router)#router-id1.1.1.1

R1(config-router)#network1.1.1.00.0.0.255area0

R1(config-router)#network12.1.1.00.0.0.255area0

R2

R2(config)#ints0/0

R2(config-if)#ipadd13.1.1.1255.255.255.0

R3(config-if)#nosh

R2(config)#intlo0

R2(config-if)#ipadd2.2.2.2255.255.255.0

R2(config-if)#ints0/1

R2(config-if)#ipadd12.1.1.2255.255.255.0

R3(config-if)#nosh

R2(config)#routeros110

R2(config-router)#router-id2.2.2.2

R2(config-router)#network12.1.1.00.0.0.255area0

R2(config-router)#network2.2.2.00.0.0.255area0

R2(config-router)#network13.1.1.00.0.0.255area0

R3:

R3(config)#ints0/1

R3(config-if)#ipadd13.1.1.2255.255.255.0

R3(config)#nosh

R3(config)#intlo0

R3(config-if)#ipadd3.3.3.3255.255.255.0

R3(config)#routeros110

R3(config-router)#router-id3.3.3.3

R3(config-router)#network3.3.3.00.0.0.255area0

R3(config-router)#network13.1.1.00.0.0.255area0

R1:查看路由表信息

R1#shipro

Codes:C-connected,S-static,R-RIP,M-mobile,B-BGP

D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea

N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2

E1-OSPFexternaltype1,E2-OSPFexternaltype2

i-IS-IS,su-IS-ISsummary,L1-IS-ISlevel-1,L2-IS-ISlevel-2

ia-IS-ISinterarea,*-candidatedefault,U-per-userstaticroute

o-ODR,P-periodicdownloadedstaticroute

Gatewayoflastresortisnotset

1.0.0.0/24issubnetted,1subnets

C1.1.1.0isdirectlyconnected,Loopback0

2.0.0.0/32issubnetted,1subnets

O2.2.2.2[110/65]via12.1.1.2,00:06:17,Serial0/0

3.0.0.0/32issubnetted,1subnets

O3.3.3.3[110/129]via12.1.1.2,00:06:17,Serial0/0

12.0.0.0/24issubnetted,1subnets

C12.1.1.0isdirectlyconnected,Serial0/0

13.0.0.0/24issubnetted,1subnets

O13.1.1.0[110/128]via12.1.1.2,00:06:17,Serial0/0

注意:R1学习到R2/R3lo0口的路由信息是个32位的路由,这里可以通过在lo0接口上改网络类型,还原实际路由信息。

R2

R2(config)#intlo0

R2(config-if)#ipospfnetworkpoint-to-point

R3

R3(config)#intlo0

R3(config-if)#ipospfnetworkpoint-to-point

R2/R3lo0改完网络类型,在去R1上看就是24位的路由了。

R1

R1#shipro

Codes:C-connected,S-static,R-RIP,M-mobile,B-BGP

D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea

N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2

E1-OSPFexternaltype1,E2-OSPFexternaltype2

i-IS-IS,su-IS-ISsummary,L1-IS-ISlevel-1,L2-IS-ISlevel-2

ia-IS-ISinterarea,*-candidatedefault,U-per-userstaticroute

o-ODR,P-periodicdownloadedstaticroute

Gatewayoflastresortisnotset

1.0.0.0/24issubnetted,1subnets

C1.1.1.0isdirectlyconnected,Loopback0

2.0.0.0/24issubnetted,1subnets

O2.2.2.0[110/65]via12.1.1.2,00:00:10,Serial0/0

3.0.0.0/24issubnetted,1subnets

O3.3.3.0[110/129]via12.1.1.2,00:00:10,Serial0/0

12.0.0.0/24issubnetted,1subnets

C12.1.1.0isdirectlyconnected,Serial0/0

13.0.0.0/24issubnetted,1subnets

O13.1.1.0[110/128]via12.1.1.2,00:00:10,Serial0/0

R1:查看邻居表信息

R1#shiposnei

NeighborIDPriStateDeadTimeAddressInterface

2.2.2.20FULL/-00:00:3812.1.1.2Serial0/0

NeighborID

2.2.2.2邻居router-id

State

FULL/-经历五个状态,达到FULL状态,并且不线DRp2p网络)

DeadTime

00:00:38老化时间到计时

Interface

Serial0/0本地与邻居相连接口。

R1#shiposints0/0

Serial0/0isup,lineprotocolisup

InternetAddress12.1.1.1/24,Area0

ProcessID110,RouterID1.1.1.1,NetworkTypePOINT_TO_POINT,Cost:64cost值)

TransmitDelayis1sec,StatePOINT_TO_POINT,(网络类型p2p

Timerintervalsconfigured,Hello10,Dead40,Wait40,Retransmit5

Hello更新时间10s老化时间是hello时间4wait时间也是hello时间4倍(选DR等待时间)

oob-resynctimeout40

Helloduein00:00:07

SupportsLink-localSignaling(LLS)

Index2/2,floodqueuelength0

Next0x0(0)/0x0(0)

Lastfloodscanlengthis1,maximumis1

Lastfloodscantimeis0msec,maximumis0msec

NeighborCountis1,Adjacentneighborcountis1

Adjacentwithneighbor2.2.2.2

Suppresshellofor0neighbor(s)

Ospfcost计算:ospfcost=10^8/接口带宽(bit

列如:

R1#shints0/0

Serial0/0isup,lineprotocolisup

HardwareisM4T

Internetaddressis12.1.1.1/24

MTU1500bytes,BW1544Kbit,DLY20000usec,

reliability255/255,txload1/255,rxload1/255

EncapsulationHDLC,crc16,loopbacknotset

S0/0cost=100000000/1544000=64(取整数)

---------------------------------------------------------------------------------------------------------------------------------

R1ospflsdb信息

R1#shiposda

OSPFRouterwithID(1.1.1.1)(ProcessID110)

RouterLinkStates(Area0)注:lsa1类(router

LinkIDADVRouterAgeSeq#ChecksumLinkcount

1.1.1.11.1.1.118230x800000030x00342C3

2.2.2.22.2.2.28090x800000040x0066285

3.3.3.33.3.3.37940x800000050x0041053

注:

lsa1类中:

linkidadvrouter所表示的是一致router―id信息。

R2上看:

R2#shiposda

OSPFRouterwithID(2.2.2.2)(ProcessID110)

RouterLinkStates(Area0)

LinkIDADVRouterAgeSeq#ChecksumLinkcount

1.1.1.11.1.1.116810x800000040x00322D3

2.2.2.22.2.2.26170x800000050x0064295

3.3.3.33.3.3.35630x800000060x003F063

注:说明在同一个区域里面,每台路由的routerlsa1)信息是一致的。

---------------------------------------------------------------------------------------------------------------------------------

R1:通过ospf学习到的路由信息

R1#shiproos

2.0.0.0/24issubnetted,1subnets

O2.2.2.0[110/65]via12.1.1.2,00:16:06,Serial0/0

3.0.0.0/24issubnetted,1subnets

O3.3.3.0[110/129]via12.1.1.2,00:16:06,Serial0/0

13.0.0.0/24issubnetted,1subnets

O13.1.1.0[110/128]via12.1.1.2,00:16:06,Serial0/0

注:通过lsa1类学习到的路由前缀都是打o的。

R1查看lsa1router)数据库信息:

R1#shiposdatabaserouter

OSPFRouterwithID(1.1.1.1)(ProcessID110)

RouterLinkStates(Area0)

LSage:1193

Options:(NoTOS-capability,DC)

LSType:RouterLinks

LinkStateID:1.1.1.1

AdvertisingRouter:1.1.1.1

LSSeqNumber:80000004

Checksum:0x322D

Length:60

NumberofLinks:3

Linkconnectedto:anotherRouter(point-to-point)

(LinkID)NeighboringRouterID:2.2.2.2

(LinkData)RouterInterfaceaddress:12.1.1.1(拓扑信息)

NumberofTOSmetrics:0

TOS0Metrics:64

Linkconnectedto:aStubNetwork

(LinkID)Network/subnetnumber:12.1.1.0

(LinkData)NetworkMask:255.255.255.0

NumberofTOSmetrics:0

TOS0Metrics:64

Linkconnectedto:aStubNetwork

(LinkID)Network/subnetnumber:1.1.1.1

(LinkData)NetworkMask:255.255.255.255(路由信息)

NumberofTOSmetrics:0

TOS0Metrics:1

LSage:199

Options:(NoTOS-capability,DC)

LSType:RouterLinks

LinkStateID:2.2.2.2

AdvertisingRouter:2.2.2.2

LSSeqNumber:80000005

Checksum:0x6429

Length:84

NumberofLinks:5

Linkconnectedto:anotherRouter(point-to-point)

(LinkID)NeighboringRouterID:3.3.3.3

(LinkData)RouterInterfaceaddress:13.1.1.1

NumberofTOSmetrics:0

TOS0Metrics:64

Linkconnectedto:aStubNetwork

(LinkID)Network/subnetnumber:13.1.1.0

(LinkData)NetworkMask:255.255.255.0

NumberofTOSmetrics:0

TOS0Metrics:64

Linkconnectedto:aStubNetwork

(LinkID)Network/subnetnumber:2.2.2.0

(LinkData)NetworkMask:255.255.255.0

NumberofTOSmetrics:0

TOS0Metrics:1

Linkconnectedto:anotherRouter(point-to-point)

(LinkID)NeighboringRouterID:1.1.1.1

(LinkData)RouterInterfaceaddress:12.1.1.2

NumberofTOSmetrics:0

TOS0Metrics:64

Linkconnectedto:aStubNetwork

(LinkID)Network/subnetnumber:12.1.1.0

(LinkData)NetworkMask:255.255.255.0

NumberofTOSmetrics:0

TOS0Metrics:64

LSage:147

Options:(NoTOS-capability,DC)

LSType:RouterLinks

LinkStateID:3.3.3.3

AdvertisingRouter:3.3.3.3

LSSeqNumber:80000006

Checksum:0x3F06

Length:60

NumberofLinks:3

Linkconnectedto:aStubNetwork

(LinkID)Network/subnetnumber:3.3.3.0

(LinkData)NetworkMask:255.255.255.0

NumberofTOSmetrics:0

TOS0Metrics:1

Linkconnectedto:anotherRouter(point-to-point)

(LinkID)NeighboringRouterID:2.2.2.2

(LinkData)RouterInterfaceaddress:13.1.1.2

NumberofTOSmetrics:0

TOS0Metrics:64

Linkconnectedto:aStubNetwork

(LinkID)Network/subnetnumber:13.1.1.0

(LinkData)NetworkMask:255.255.255.0

NumberofTOSmetrics:0

TOS0Metrics:64

你可能感兴趣的:(接口,认证,gateway,路由器,路由表)