Wednesday, 8 May 2019

OSPF Series 6: OSPF Areas, OSPF Redistribution, Type-3 LSA, Type-5 LSA, Prefix Lists, Administrative Distance and Metric in OSPF

OSPF AREAS:

  • It is specific to interface (given in the network command)

To make a router in OSPF as Autonomous System Border Router (ASBR) that connects it to another AS running static routing, then, use

  • #router ospf 1
  • #redistribute static //if the other external AS is using static routing

(OR)

#redistribute connected //if the other external AS is also running OSPF (or if it is a loopback on the ABSR itself)


We can know if a router is an ABR or not by looking at the B bit in the flags of LSA Type-1 of that router.

We can know if a router is an ASBR or not by looking at the E bit in the flags of LSA Type-1 of that router and also in that router’s Hello packet.

  • All areas must be connected to Area 0
  • Another area accepts a type-3-LSA only if it comes from Area 0 . If a Type-3-LSA comes from another area, other areas will discard it.
  • This way, we prevent loops inside an Autonomous System.
  • For example, in the LSA-Type-3-Metric topology, Even if MT703 receives an LSA-Type-3 from MT702 and MT705 (both of them are ABR), it will accept it only because both of the ABRs are connected to area 0. If it Type-3-LSA comes from MT701, it will not accept it as it is not connected to area 0.
  • THUS, area 0 should always be one block. It should NOT be disjoint.

Thus, for a router to accept LSA-Type-3 from a router, either of these conditions must be satisfied:

  • A router will accept LSA Type-3 from another area too, if it has a Loopback in Area 0 and no transit link in area 0.
  • If the the router has a transit link in Area 0, it will not accept LSA-Type-3 from another area (since it will expect the LSA-Type-3 from the transit link in area 0). (In Metric-topology, MT703 will not accept type-3-LSA from MT701 and MT702 since it has a transit link in area 0 from MT705).

https://supportforums.cisco.com/discussion/11565901/ospf-backbone-area-rule

Can you think of why in OSPF, there is need for LSA Type-3,

  • Why every area must be connected to area 0 and why those routes in areas which are not connected to area 0 are not being redistributed across the OSPF domain. ( which led virtual link concept i suppose )?
  • Why any router which is an ABR should be connected to area 0 and why a router which is not connected to area 0 but connected to multiple areas do not summarize the type 3 LSAs?

Ans-

  • The ABR between area X and area 0 takes the responsibility to generate LSA type 3 and eventually type 4 to represent all IP prefixes that are in area X (and ASBR nodes if they are present)
  • All other ABR nodes receive the summary LSAs generated in area 0 and create corresponding summary LSAs for the SAME IP prefixes with single area Y,... area Z scope.
  • The backbone area is central for routing information propagation that cannot happen between two normal areas without going through area 0, and it is also a central point in the data plane: user traffic is moved from area X to area Y going via area 0. LSAs and user traffic cannot hop from one area X directly into an area Y.
  • In this way some possible routing loops or suboptimal paths that would be caused allowing routes and traffic to traverse directly from an area X to an area Y are avoided.
  • In this way competition about an IP prefix present in multiple summary LSAs generated by two different ABR nodes happen within area 0. This provides a common ground for route propagation.
  • All ABR nodes need to be rooted in area 0 as their duty is to work as border between area 0 and other areas.
  • A router that is member of multiple areas but that has no link in area 0, is simply that: a member of multiple areas but it is not allowed to propagate routes between the different areas of which it is member of.

Area 0 makes the OSPF Hierarchy loop-resistant when combining multiple areas because of two important rules in OSPF:

  • Having a backbone area and requiring all other areas connect to it creates a point to point topology which in itself is resistant to loops.
  • Having ABRs reject any Type-3 LSA that is received over a non backbone area.

Consider this topology.

Screen Shot 2016-11-21 at 11.53.25 PM.png

Areas 30, 40, 50, and 60 are all part of the OSPF domain. In order for them to communicate between each other they must connect to Area 0. This makes the entire OSPF hierarchy a logical Point-to-Point topology where in order for any two areas to communicate they must traverse the backbone. This design helps to prevent loops. The ABRs are the “gatekeepers” that allow the flooding of these Inter Area prefixes. This is done using Type-3 LSAs.

Now, Area 40 has multiple ABRs. They both receive Type-3 LSAs from the backbone router R1. A case for loop to occur here would be if ABR-41 received Type-3 LSAs that were propagated by ABR-42 over the non-backbone area Area 40. ABR-41 could choose to route through ABR-42 to reach the prefix, likewise ABR-42 could choose to route through ABR-41. To prevent this the ABRs will ignore any Type-3 LSAs received in Area 40 when running the SPF algorithm.

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

LSA Type-5

If we do #show IP route on some router running OSPF, we see some OSPF learned routes showing as E2 and some as E1:

  • E1 routes indicate cumulative cost to reach the destination i.e. int indicates cost to reach ASBR + cost to destination from ASBR.

  • E2 route reflects cost only from the ASBR to destination. This is the default used by ospf for redistribution.

  • E1 routes ALWAYS take precedence than E2

  • Type 5 LSA can be configured to share cost or not to share. If we choose to share the cost information, then, we get an E1 route. By default, the cost information is not shared, so by default it is E2

  • In Type-5 LSA, E, or External Metric bit, specifies the type of external metric to be used with this route. If the E-bit is set to 1, the metric type is E2. If the E-bit = 0, the metric type is E1.

  • So, even if the Metric field in LSA Type-5 has lower value in E2 route, we always prefer to go for the E1 route. So, it is possible to have both E1 and E2 in the routing table.

  • We can share the cost information using the command:

    • mt701(config-router-ospf)#route-map new permit <sequence_number>
    • mt701(config-route-map-name)#set metric-type
    • mt701(config-router-ospf)#redistribute connected route-map <route_map_name>

(OR)

mt701(config-router-ospf)#redistribute static route-map <route_map_name>

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

OSPF Prefix Lists:

Len < GE <= LE

Therefore “ip prefix-list LIST permit 1.2.3.0/24 ge 8″ is not a valid list.

  • In the prefix list, the sequence number matters. If a lower sequence number’s permit/deny matches an IP address, then, even if the same IP is there in another higher sequence number, it will be ignored. (Precedence for lower sequence number)

  • NOTE: prefix-lists also have an implicit deny. So we much give a permit explicitly for all IP addresses using permit 0.0.0.0/0 le 32 and use high sequence number for it (due to this, all the denys first take place and the IP addresses not denied will be permitted with the above permits).

  • Example: On the switch (using the Classnote Metric topology):

    • mt701(config)#ip prefix-list NAME1
    • mt701(prefix-list-NAME1)#permit 0.0.0.0/0 le 32 //the subnet of the IP address can be less than /32 (.ie. all subnets are matched) and none of the bits in begining need to be matched
    • mt701(prefix-list-NAME1)# mt701(config)#ip prefix-list NAME1 deny 7.7.7.7/32

// the above ip prefix-list named ‘NAME1’ permits all IP address except 7.7.7.7/32

    • mt701(prefix-list-NAME1)#exit
    • mt701(config-router-ospf)#redistribute static route-map ROU //static OR connected keywords can be used
    • mt701(config-router-ospf)#route-map ROU
    • mt701(config-route-map-ROU)#match ip address prefix-list NAME1
    • mt701(config-router-ospf)#exit
  • Another example only for the prefix-list:

    • mt701(config)#ip prefix-list PRE permit 10.10.10.0/8 gr 21 le 29 //the subnet of the Ip address should be /21 to /29. If the subnet is within this range, then, check if the first 8 bits match (since: /8 subnet)
    • <<>>

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

ADMINISTRATIVE DISTANCE and METRIC:

  • Each routing protocol has a default AD

  • But, the AD can be changed using the distance ospf command

  • First, we prefer the route that has a lower administrative distance. If AD is same, it prefers a lower Metric

  • Also, Intra-Area routes are preferred than Inter-Area and External area routes.

    • Case: We learnt two routes for same network via both Inter-Area and Intra-Area. The Intra-Area has higher metric of 40 and Inter-Area has lower metric of 20. So, which route gets stored in routing table?
    • Ans: It still prefers Intra-Area because in Intra-Area we know the exact cost. But, in inter-area, the ABR may not advertise the exact cost and may always give the cost as 10.
  • Intra-Area OSPF routes are shown as OSPF, Inter-Area OSPF routes are shown as OSPF IA, and external OSPF routes can be either OSPF E1 or OSPF E2 in the routing table.

  • In the same LSA-Type-3 topology in classnote:

  • img

  • Administrative distance:

    • A network can use more than one routing protocol, and routers on the network can learn about a route from multiple sources.
    • Routers need to find a way to select a better path.
    • Administrative distance number is used by routers to find out which route is better (lower number is better). Measure of reliability.
    • For example, if the same route is learned from RIP and EIGRP, a Cisco router chooses EIGRP route and stores the route in the routing table. This is because EIGRP routes have, by default, an administrative distance of 90, while RIP route have a higher administrative distance of 120.
    • img
  • Metric:

    • If a router learns two different paths for the same network from the same routing protocol, it has to decide which route is better and will be placed in the routing table.
    • Metric is a measure used to decide which route is better (lower number is better).
    • Each routing protocol uses its own metric.
    • For example, RIP uses hop counts as a metric, while OSPF uses cost.

 

No comments:

Post a Comment