"Link count" in sh ip ospf database

Answered Question
Oct 21st, 2009

In building my little practice OSPF network, I've started with a simple point-to-point link (201.0.0.0/30) between R1 and R10. Only those point-to-point interfaces are declared in the ospf process; and when I do a show ip ospf database command on either router, I see two Router Link States (as I expect to) only the "Link count" for each is "2."

If I understand the Link count field correctly, it's the number of OSPF interfaces on the router. Except I've only configured one OSPF interface on each, and sure enough just one is listed when I do show ip ospf interface.

Is the 2nd one supposed to be the loopback interface used as the ID (even though I didn't include the loopbacks under the network statement?) What is the explanation?

I have this problem too.
0 votes
Correct Answer by Giuseppe Larosa about 4 years 6 months ago

Hello Stuey,

point-to-point links are counted twice in the sh ip ospf database.

I've faced the same issue when I started to work on OSPF in the previous century.

Hope to help

Giuseppe

  • 1
  • 2
  • 3
  • 4
  • 5
Average Rating: 5 (2 ratings)
Correct Answer
Giuseppe Larosa Wed, 10/21/2009 - 22:38

Hello Stuey,

point-to-point links are counted twice in the sh ip ospf database.

I've faced the same issue when I started to work on OSPF in the previous century.

Hope to help

Giuseppe

Peter Paluch Thu, 10/22/2009 - 21:35

Hello Seth,

You should ask why :)

Actually, it is quite simple. In OSPF database, a point-to-point link is modelled actually as two entries in LSA1: one entry describes solely a direct connection to another router, without advertising the network that is present on the link. The second entry advertises the network on the point-to-point link as a stub network.

I have put together a small network consisting of two routers connected by a single serial link. The router R1 is 10.0.0.1/24, the router R2 is 10.0.0.2/24. Now, let's have a look at the LSA1 of the R1:

R1#show ip ospf database router self-originate

OSPF Router with ID (10.0.0.1) (Process ID 1)

Router Link States (Area 0)

LS age: 16

Options: (No TOS-capability, DC)

LS Type: Router Links

Link State ID: 10.0.0.1

Advertising Router: 10.0.0.1

LS Seq Number: 80000002

Checksum: 0xEC7F

Length: 48

Number of Links: 2

Link connected to: another Router (point-to-point)

(Link ID) Neighboring Router ID: 10.0.0.2

(Link Data) Router Interface address: 10.0.0.1

Number of TOS metrics: 0

TOS 0 Metrics: 64

Link connected to: a Stub Network

(Link ID) Network/subnet number: 10.0.0.0

(Link Data) Network Mask: 255.255.255.0

Number of TOS metrics: 0

TOS 0 Metrics: 64

Note that there are two entries there. The first entry describes a point-to-point link - on which R1's interface router it starts and what does it connect to. The second entry contains the address of the network that is present on the point-to-point link.

The LSA1 of the R2 looks very similar:

R2#show ip ospf database router self-originate

OSPF Router with ID (10.0.0.2) (Process ID 1)

Router Link States (Area 0)

LS age: 359

Options: (No TOS-capability, DC)

LS Type: Router Links

Link State ID: 10.0.0.2

Advertising Router: 10.0.0.2

LS Seq Number: 80000001

Checksum: 0xE288

Length: 48

Number of Links: 2

Link connected to: another Router (point-to-point)

(Link ID) Neighboring Router ID: 10.0.0.1

(Link Data) Router Interface address: 10.0.0.2

Number of TOS metrics: 0

TOS 0 Metrics: 64

Link connected to: a Stub Network

(Link ID) Network/subnet number: 10.0.0.0

(Link Data) Network Mask: 255.255.255.0

Number of TOS metrics: 0

TOS 0 Metrics: 64

So this is the general idea behind the "counting the point-to-point links twice".

Best regards,

Peter

CriscoSystems Fri, 10/23/2009 - 09:21

See, it's still not exactly dripping with logic, over here.

For you see, the documentation says the Link Count field means # of interfaces; not # of interfaces + networks. Isn't an interface (ESPECIALLY a p2p interface) nearly always connected to just one network anyway?

I could pull my hair out trying to understand this thoroughly, and in the long term I aim to understand it that way; however I have the BSCI on 11/20 so I am in that cheapskate, narrow-minded mode in which I'm paying attention to the stuff that'll be on the exam.

I know, I know, I hate those cheapskate lightweights who just want the paper that says "CCNP" and don't care whether they actually _have_ the knowledge it represents. Still, the exam approaches; survivalism rules...

Giuseppe Larosa Fri, 10/23/2009 - 10:22

Hello Stuey,

yes you need to decide what requires more deep inspection and what has to be accepted as a practical rule.

To be honest, there is people that never realized this fact (that point-to-point links counts twice in Link count) and they worked and work on OSPF.

Edit:

Peter: I don't mean your explanation is a bad one.

Hope to help

Giuseppe

Peter Paluch Fri, 10/23/2009 - 14:00

Hello Seth,

First, the "interface" is not the same as the "link" in OSPF. A "link" represents a topological relation - something connected or related to something, but it does not necessarily have to be an interface. For example, all summary networks described by LSA3 appear as connected (that is, linked) to an ABR even though they may not really exist as interfaces on it. The same goes, for instance, for external networks in LSA5 that appear as linked to an ASBR. We can also draw this abstraction for LSA1 - if two routers are interconnected by a network, this relation can be described as link from one router to the common interconnection (the network) and another link from this common interconnection to the second router. This is how LSA1+LSA2 work together. And if you draw the abstraction even further, you can describe a point-to-point connection of two routers by first advertising a link from one router to another and second by saying that each of these routers is connected to a common stub network. This is how the OSPF currently does it.

If you had a topic called the Graph Theory during your studies then the routers and networks could be described as nodes in a graph, and the links are the edges that interconnect these nodes (routers and networks) together.

I suggest that you read this URL. It is a part of a book by the creator of the OSPF itself, Mr. John Moy. It also tries to explain what is going behind the point-to-point link logic. Note that he actually explains how the OSPF did it originally and only then he explains how the OSPF does it now (which is what you see in IOS):

http://books.google.sk/books?id=YXUWsqVhx60C&lpg=PA153&ots=KvAIPc1Tz8&dq=why%20is%20the%20representation%20of%20point-to-point%20links%20in%20OSPF%20so%20strange&pg=PA153#v=onepage&q=why%20is%20the%20representation%20of%20point-to-point%20links%20in%20OSPF%20so%20strange&f=false

Please feel free to ask further!

Best regards,

Peter

CriscoSystems Fri, 10/23/2009 - 14:18

Thank you for the link Peter, that is very helpful indeed.

And don't worry about me not asking further...my BSCI questions will bury this discussion board before long.

Actions

Login or Register to take actions

This Discussion

Posted October 21, 2009 at 6:36 PM
Stats:
Replies:7 Avg. Rating:5
Views:1209 Votes:0
Shares:0
Tags: No tags.

Discussions Leaderboard