6

I have several questions on OSPF.

1 OSPF is a link-state prototol, so routers inside an AS only broadcast their link states to all the other routers.

I'm wondering if a router doesn't tell other routers its routing table, how can other routers know what packets should be destined to it?

for example, if a router A is an edge router(leaf router) which interfaces the subnet 10.0.2.1/24. Assume another router B receives a packet with destination IP 10.0.0.2.4. From OSPF, B knows the shortest path to A, but B doesn't know A is an edge router interfacing the subnet 10.0.2.1/24, so how will B route this packet?

2 if a router receives a packet with destination outside the AS, according to my understanding, the packet will follow the default route 0.0.0.0 and the router will route the packet to a ABR. but ususally an AS has several ABR, so how does a router select one from these ABRs?

  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer. – Ron Maupin Aug 10 '17 at 0:59
11

OSPF is a link state protocol that uses multicast. It sends Link State Advertisements (LSAs) that are flooded.

Every router builds a tree by running SPF where the router itself is the root of the tree. In OSPF we have transit networks and stub networks. Transit networks are networks that are used for transit to reach networks while stub networks are the endpoints or leaves as you described it.

If we are in the same area then the router LSA (type-1) is examined to find the destination. Here is a router-LSA to reach the network of R1 which has a RID of 1.1.1.1.

R2#sh ip ospf data router 1.1.1.1

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

                Router Link States (Area 0)

  LS age: 256
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 1.1.1.1
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000005
  Checksum: 0x4B09
  Length: 60
  Number of Links: 3

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 1.1.1.1
     (Link Data) Network Mask: 255.255.255.255
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 13.13.13.1
     (Link Data) Router Interface address: 13.13.13.1
      Number of TOS metrics: 0
       TOS 0 Metrics: 10

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 12.12.12.2
     (Link Data) Router Interface address: 12.12.12.1
      Number of TOS metrics: 0
       TOS 0 Metrics: 10

R1 has a cost of 1 to this stub network. R2 can reach this network through the 12.12.12.0/24 transit network. So we need to add a cost of 10 which brings the total metric to 11.

R2#sh ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 11, type intra area
  Last update from 12.12.12.1 on FastEthernet0/0, 00:06:49 ago
  Routing Descriptor Blocks:
  * 12.12.12.1, from 1.1.1.1, 00:06:49 ago, via FastEthernet0/0
      Route metric is 11, traffic share count is 1

This is an intra area route. For inter area routes OSPF actually behaves like a distance vector protocol because traffic is sent through the ABR. How can we identify an ABR?

R4#sh ip ospf data router 2.2.2.2

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

                Router Link States (Area 1)

  Routing Bit Set on this LSA
  LS age: 573
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 2.2.2.2
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000002
  Checksum: 0xCCB6
  Length: 36
  **Area Border Router**
  Number of Links: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 24.24.24.2
     (Link Data) Router Interface address: 24.24.24.2
      Number of TOS metrics: 0
       TOS 0 Metrics: 10

The B bit is set in the OSPF header which makes a router an ABR.

This can be seen in a packet capture.

OSPF ABR B bit

To find the metric of an inter area route the metric of the ABR to the destination + the metric of the local route to the ABR is added.

R4#sh ip ospf border-routers 

OSPF Process 1 internal Routing Table

Codes: i - Intra-area route, I - Inter-area route

i 2.2.2.2 [10] via 24.24.24.2, FastEthernet0/0, ABR, Area 1, SPF 4
i 3.3.3.3 [10] via 34.34.34.3, FastEthernet0/1, ABR, Area 1, SPF 4
R4#

Here the cost is 10 to reach the two ABRs. Because the cost was 11 from the ABR to the destination that should mean that R4 has a metric of 21.

R4#sh ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 21, type inter area
  Last update from 24.24.24.2 on FastEthernet0/0, 00:09:37 ago
  Routing Descriptor Blocks:
  * 34.34.34.3, from 3.3.3.3, 00:09:37 ago, via FastEthernet0/1
      Route metric is 21, traffic share count is 1
    24.24.24.2, from 2.2.2.2, 00:09:37 ago, via FastEthernet0/0
      Route metric is 21, traffic share count is 1

Which it is. Because there are two ABRs here with the same cost both routes are installed into the RIB/FIB. If we increase the cost to one ABR then only one entry will be installed.

R4#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R4(config)#int f0/0
R4(config-if)#ip ospf cost 11
R4(config-if)#^Z
R4#sh ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 21, type inter area
  Last update from 34.34.34.3 on FastEthernet0/1, 00:10:58 ago
  Routing Descriptor Blocks:
  * 34.34.34.3, from 3.3.3.3, 00:10:58 ago, via FastEthernet0/1
      Route metric is 21, traffic share count is 1

There really is no concept of AS in OSPF but you can originate a default route and then the best metric would win. I recommend that you read through RFC 2328 and OSPF: Anatomy of an Internet Routing Protocol if you want more understanding of OSPF.

2

@misteryes; Your initial concept, that OSPF routers in an area do not share their routing information, is erroneous. In your first example, the connection to the 10.0.2.0 network is in Router A's database, and that information will be shared with Router B. Router B will update its topological database with this information, and if that is the best route to the 10.0.2.0 network, it will add the route through Router A to its routing table.

Your second sub-question is unclear to me. You appear to be somewhat confused by OSPF terminology (most of us were, at one point in our careers). Cisco has some good basic information on how OSPF works available online, as well as the various books available from Cisco Press. The manner in which default routes are handled in OSPF depends upon the way you are implementing it, so there is no one "right answer" to your query.

  • Under normal circumstances, yes, A should announce it. If we assume A has been specifically configured NOT to, then B would route to any other path, default, or drop. – Ricky Beam Oct 7 '13 at 22:20
0

Question 1 is a little unclear to me, but the leaf concept really only relates to the need to run SPF (and how it is run). If you have a basic network like this:

(10.0.2.0/24)---(a)----(c)----(b)

A tells C: I'm connected to 10.0.2.0/24 C tells B: I'm connected to A, also, here is what A is connected to. B then puts these together: 10.0.2.0/24 is connected to A. C is connected to A, I'm connected to see, so B -> C -> A -> 10.0.2.0/24

If I know about A, but don't know about the specific prefix A has behind it then I would drop the packet (or send it towards my default route).

2.) Route metrics. If I have multiple default routes the "best" default route is the one with the lowest metric.

  • for question 1), actually you mean in OSPF A has to tell C its routing table? in this way, actually A is flooding its routing table? but in OSPF, as I said, A only flood its link state. – misteryes Oct 6 '13 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.