link-state routing and ospf olof hagsand kth/csc · ospf and link-state summary ospf message types...

78
Link-state routing and OSPF Olof Hagsand KTH/CSC DD2490 p4 2009

Upload: others

Post on 26-May-2020

7 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Link-state routing and OSPF

Olof HagsandKTH/CSC

DD2490 p4 2009

Page 2: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Literature

RFC 2328:● Browse through Section 1.

● Section 2 gives a very good understanding of OSPF issues. The example is realistic (complex) and the section can be quite hard to get through. But it is well worth the reading. In particular, the figures can be difficult to get a grasp of since they are written in ASCII.

● Section 2.1.1 can be skipped.

● Section 3 introduces areas to the previous example. Again, the example is quite demanding, but a thorough reading of this section will give you a good understanding of OSPF areas.

● Section 3.5, only the last two paragraphs, the rest discusses CIDR: you should know this already.

Page 3: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

OSPF and Link-state summary

● OSPF message types

– Hello

– Database Description

– Link-State Request

– Link-State Update

– Link-State Acknowledge

● Link-State Advertisment

– Age

– Sequence

– Link-State ID

– Advertising Router

– Type

1. Router

• point-to-point link• transit link• stub link• virtual link

2. Network

3. Network Summary

4. ASBR Summary

5. AS External

Page 4: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

OSPF Network Topology

● Area 0 is the backbone area. All (inter-area) traffic goes via the backbone.

● All other areas are connected to the backbone (1-level hierarchy)● A Area Border Router (ABR) has one interface in each area.● An AS Boundary Router (ASBR) – redistributes external routes● Backbone router – at least one interface in backbone area

AS2Area 0

Area 1 Area 2 Area 3

Area Border Router:Interfaces in different

areas

AS boundary router:External routing

All areas connected tobackbone area

Internal router +

ASBR

Internal router

External

External

Page 5: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Link-state routing

● Each router spreads information about its links to its neighbours.

● This information is flooded to every router in the routing domain so that every router has knowledge of the entire network topology.

● Using Dijkstra's algorithm, the shortest path to each prefix in the network is calculated

Page 6: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Comparison with Distance-vector

● Link-state uses a distributed database model● Distance-vector uses a distributed processing model● Link-state pros:

– More functionality due to distribution of original data, no dependency on intermediate routers

● Easier to troubleshoot

– Fast convergence: when the network changes, new routes are computed quickly

– Less bandwidth consuming

● Distance-vector pros:– Less complex – easier to implement and administrate

– Needs less memory

Page 7: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Comparison with IS-IS● Both are link-state protocols● IS-IS has a longer history from Digital via OSI● OSPF is newer and developed in IETF● Area difference

– OSPF defines area boundaries between interfaces

– IS-IS defines area boundaries between nodes

– IS-IS areas leads to simpler configuration

● Protocol dependency– IS-IS can run many protocols (IPv6, CLNP)

– OSPF only IPv4, ( OSPFv3 supports IPv6)

● OSPF is implemented on more platforms and more deployed

● IS-IS often popular among backbone networks

Page 8: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Original OSPF requirements

● A more descriptive routing metric– Link metric: 1-65535

● Equal-cost multipath– Multiple best paths: load balance

● Routing hierarchy– Two-level routing scheme: areas

● Separate internal and external routes

– External routes● Security

– Cryptographic authentication

Page 9: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Basic OSPF

1. The hello protocol– Is there anybody out there?

– Detection of neighboring routers

– Election of designated routers

2. The exchange protocol• Exchange database between neighbours

3. Reliable flooding• When links change/age send: update to neighbours and

flood recursively.

4. Shortest path calculation• Dijkstra's algorithm

• Compute shortest path tree to all destinations

Page 10: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Dijkstra's shortest path computationFrom the link-state database, compute a shortest path delivery tree using a permanent set S and a tentative set Q:

1)Define the root of the tree: the router

2)Assign a cost of 0 to this node and make it the first permanent node.

3)Examine each neighbor node of the last permanent node.

4)Assign a cumulative cost to each node and make it tentative.

5)Among the list of tentative nodes:• Find the node with the smallest cumulative cost and make it

permanent.

• If a node can be reached from more than one direction, select the direction with the smallest cumulative cost.

6)Repeat steps 3 to 5 until every node is permanent.

Page 11: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Dijkstra pseudo-code

function Dijkstra(G, w, s)for each vertex v in V[G] // Initializations d[v] := infinity previous[v] := undefinedd[s] := 0S := empty set // S: Permanent setQ := set of all vertices // Q: Tentative setwhile Q is not an empty set // The algorithm itself u := Extract_Min(Q) S := S union {u} for each edge (u,v) outgoing from u if d[v] > d[u] + w(u,v) // Relax (u,v) d[v] := d[u] + w(u,v) previous[v] := u

(from Wikipedia)

Page 12: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Example network

N1

N6

N4

N9 N10

N2 N3

N5

N7

N8

A

B C

D

E

F

1

13

21

2

1 2

2

3

5

Metric (may be assymmetric)

Page 13: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Corresponding link-state database

N2 N3

N5

N7

N8

A

B C

D

E

F

N1

N6’s DesignatedRouter

N6

N9

N4

N10

1

13

2 1

2

1 2

2

3

5

0 0

Page 14: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Dijkstra’s algorithm computed

N2 N3

N5

N7

N8

A

B C

D

E

F

N1

N6

N9

N4

N10

1

13

01

2

1 2

2

3

5

Final shortest path delivery tree from A

Page 15: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

OSPF Encapsulation

● OSPF runs directly on IP● Needs its own reliable protocol

– The flooding protocol

● No port numbers– Need to run as root – raw sockets

● No checksum– Computes its own checksum or digest

● Since it runs on IP (IS-IS runs on the link-level)– OSPF messages can be routed – tunneled or routed by some

other protocol

Page 16: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

OSPF header 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Version # | Type | Packet length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Router ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Area ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | AuType | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Authentication | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Authentication | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP OSPF common header OSPF specific header

Page 17: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

OSPF common header

● Version– 2 for IPv4

– 3 for IPv6

● Type– Hello

– DD – database description

– Link-State Request

– Link-State Update

– Link-State Acknowledge

● Router ID– First configured interface

or highest loopback IP

● Area ID– Backbone: 0.0.0.0

● Checksum– Standard IP checksum

● AUtype– NULL

– Simple password

– Cryptographic authentication

Page 18: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Cryptographic authentication

● Authentication field (see figure)● Checksum field set to zero● Create message digest from complete packet

– Eg, MD5● Append digest to packet● Set key (if many keys are used), seq#, and digest

length.

0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0 | Key ID | Auth Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Cryptographic sequence number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP OSPF common header OSPF specific header Digest

Page 19: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

OSPF Adjacency

● How does a router know who its neighbours are?

– By sending each other Hello packets

– Multicast to AllSPFRouters (224.0.0.5)● Sent every 10 seconds

– Hello interval● Three failed Hello attempts result in a link failure

report.

– Router dead interval

Page 20: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

The Hello packet

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Network Mask | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | HelloInterval | Options | Rtr Pri | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RouterDeadInterval | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Designated Router | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Backup Designated Router | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Neighbor | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... |

IP OSPF common header Hello

Page 21: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Adjacency on a broadcast network

● N-squared problem: too many adjacencies if the network is fully meshed: n(n-1)/2

● We elect one router to represent the network– Designated router (DR)

● We elect one router to take over in case of failure– Backup designated router (BDR)

● OSPF communication

– From a router to the DR and BDR ● Multicast: AllDRouters (224.0.0.6)

– The DR sends messages to other neighbours● Multicast: AllSPFRouters (224.0.0.5)

– Data traffic still forwarded directly!

Page 22: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Electing designated router

● Election algorithm– First router always DR

– Second router always BDR

● Only in case of failure change DR/BDR – Elect DR and BDR from router priority

– If equal prio => Highest router ID

– Routerprio is 0 => can never be DR/BDR

● Why is a BDR necessary?– For fast failover if DR fails

– The BDR runs in parallelwith the DR

Page 23: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Variants of multi-point networks

● Broadcast networks– The link-layer is broadcast capable

● Non-Broadcast Multiple Access (NBMA)– Any two routers can communicate but no broadcast

– X.25, ATM, FR

– Neighbour detection via configuration

● Point-to-Multipoint– Not all routers can communicate

– Packet radio, cloud of point-to-point links

– No DR/BDR, treated more like many point-to-point protocols.

Page 24: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Database exchange

● When two routers has established adjacency, the databases need to get synchronized.

● First: mutually send summary to each other's databases.

● The Database description packet includes a list of Link-state headers– Only database headers – not actual entries.

● Then: Request explicitly database entries– Link-State requests

● Last: Send database entries– Link-state updates

Page 25: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Link-State Advertisements

● LSAs are the elements of the distributed database– Also called LSPs (Link-State packets)

● A router describes its environment in the form of networks that it is connected to

● Fundamental task in OSPF: – Distribute the LSAs to all nodes in a reliable way

● Then, each node can compute Dijkstra on the same database

Page 26: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Reliable flooding

● Every router spreads its LSAs to all its peers– That is, all information about its own links

● All routers forward the LSAs to its other peers– LSAs are acknowledged

● When a link changes, a new instance of the LSA is distributed

● Periodic updates every 30 minutes– Flood a new instance

Page 27: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Reliable flooding example (1)● A link-state changes in the originator

● The originator floods an LSA over the network

● Update is resent until acknowledged

u u

Page 28: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Reliable flooding example (2)

● An update already received is taken as an implicit acknowledgement

● Updates not sent on links where they were received (unless designtaed router - later)

u

u

u

Page 29: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Reliable flooding example (3)

● LS Acknowledgements sent after timeout

● Several acks can be sent in one LS acknowledgement

a

a a

Page 30: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Flooding in a transit network (1)

● In a transit network, the roles of the designated router (and backup designated router) are important

DR BDR

u

Page 31: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Flooding in a transit network (2)

● From peer to DR and BDR

– Using multicast address AllDRouters (224.0.0.6)

DR BDR

u ua

Page 32: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Flooding in a transit network (3)

● From designated routers to all others

– Using multicast address AllSPFRouters (224.0.0.5)

● Acks sent by unicast

● If the BDR does not hear an update from the DR, it assumes the DR has crashed and takes over

DR BDR

u u u u

u

Page 33: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

LSA header● Every LSA has a common header

– The rest is different depending on LSA type

● LSA headers appear in DD, LS update and LS ack

0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LS age | Options | LS type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Link State ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Advertising Router | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LS sequence number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LS checksum | length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP OSPF common header LSA 1 LSA 2 LSA n...

LSA hdr LSA body

Page 34: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

The type field

1.Router LSATransit, stub, and point-to-point connections between routers

2.Network LSAOriginated by DR. Contains list of routers connected to shared

medium.

3. Network Summary LSA

4. ASBR Summary LSA

5. AS External LSA

6. Group Membership LSA (MOSPF)

7. NSSA external information LSA

8. External attributes LSA

Page 35: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

The link-state ID field

● Different for different types:

– Type 1 – Router LSA: Router ID

– Type 2 – Network LSA: IP address of DR

– ...

Page 36: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

The age field

● An LSA is valid up to 30 minutes● When an LSA reaches 30 minutes, the originating

router makes a new instance – New instance: increment sequence number

● If not refreshed, the LSA will be deleted after one hour (MaxAge)

● Premature aging is used to flush LSAs from the database– Age == MaxAge is the same as delete!

● If deleted by any router – that router floods the LSAs with MaxAge– To ensure that all deletes the LSA at the same time

Page 37: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Sequence number

● An originating router typically increments the sequence every 30 minutes - when age has expired

● “Larger” sequence => more recent LSA instance● But how do you define “larger” if sequence number

may wrap?

circular lollipop linear

Page 38: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Sequence numbers

● Original ARPANET: Circular

● OSPFv1: Lollipop

● OSPFv2: Linear

● Initial sequence number: 0x80000001

● Max sequence number: 0x7fffffff

● When an LSA sequence number reaches Max, the router must delete the LSA

– By flooding of a prematured aged LSA

● And then reintroduce the LSA

● But sequence number is 32-bits, if router updates sequence # every 5 seconds it takes 600 years to wrap-around!

Page 39: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Metric

● The metric is dependent on LSA and is not in the common header

● The metric is a scalar 1- 65536● It can mean anything: hops, €, delay, load, ...● Metrics are asymmetric● CISCO's default metric is:

– 10^8 / <linkbw>

– Eg 10Mb eth has metric 10

– E1 (serial 2Mbps) has metric 50

● Juniper does not have this by default

Page 40: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

LSA type 1: Router LSA

● A list of links that a ”true” router is connected to● Link to a Point-to-point network● Link to Transit networks

– Broadcast, NBMA or point-to-multipoint

● Link to Stub networks– No other router

● Virtual link– Tunnel to other router

– Used in error cases and to keep the backbone connected

LSA hdr Router LSA hdr  Link #1  Link #2  Link #n 

Page 41: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Router LSA: Stub network

● RFC 2328, fig 1a● Stub network: only one entry point● Represented by IP address and network mask● Note that the database arrow is not bidirectional

RT7

RT7

N3

LSA hdr Router LSA hdr  Stub Link: N3RT7's router LSA(part of a LS update)

N3

LSA (database) viewPhysical network

Packet view

Page 42: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Router LSA: Point-to-point ● For unnumbered interfaces, Ia and Ib are omitted● Ia and Ib does not need to be on common subnet● OSPF obscurity: RT1 points to Ib!● In practice (OSPF + JunOS): both addresses in same

subnet.Ia

IbRT1 RT2

RT1 RT2

Ia Ib

LSA hdr Router LSA hdr  Router link:RT2

Stub Link: IbRT1's router LSA

LSA hdr Router LSA hdr  Router link:RT1

Stub Link: IaRT2's router LSA

Page 43: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Router LSA: Transit network ● The link points to a transit network's IP address

– The address of the designated router

RT3 RT4

RT5 RT6

LSA hdr Router LSA hdr  Transit link:N2RT3's router LSA

RT3 RT4 RT4 RT6

N2

N2

Page 44: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Router LSA: Virtual link ● The link points to a remote router connected by an IP

network

– Similar to point-to-point, but remote peer is not physically connected

– Used to keep the backbone connected

● We will talk more about virtual links in the area section

Page 45: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

LSA Type 2: Network LSA

● Links of a transit network distributed from a designated router● The designated router distributes the information on behalf of the

connected routers● Metric on entry to network but zero cost to leave● Example: (RT3 is DR)

RT3 RT4

RT5 RT6

RT3 RT4 RT4 RT6

N2

N2

LSA hdr Network LSA hdr  RT3, RT4, RT5, RT6RT3's network LSA

DR

Page 46: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

External routes

● An external route is a prefix that OSPF has learnt from another protocol (or static route)

– Has been redistributed into OSPF

● External routes come in two flavors based on the metrics:

– External Type 1 (E1): use same metrics as internal

– External Type 2 (E2): external metric takes precedence

● If RIP routes are imported as E1, and OSPF uses hop-count metric, then OSPF and RIP can work seamlessly

● BGP routes are imported as E2, where metric is AS-path length

Page 47: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

AS External- LSA (Type 5)● But how are the external routes communicated to the

network ?– Router and network LSAs are not applicable

● AS External LSAs – Originated by AS boundary routers

– Announces an external particular prefix

– Redistributed route from another protocol

– A forwarding address (may be different than AS boundary router)

– External route tag

● Eg an BGP AS path – would enable the use of OSPF instead of IBGP

● AS External LSAs are flooded throughout the AS

RT3RT3

N1

N1

LSA hdr AS External LSA hdr  N1RT3's AS External LSA

ASBR

ASBR

Page 48: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

From network to FIB: Example

1. Network topology and metrics->

2. Database ->

3. OSPF Routing table ->

3. RIB ->

4. FIB

Page 49: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

RT1N1

RT2N2

3

3

N3

1

RT4

1

RT3

N4

2

1

1RT5

RT6

8 8

8 6

N12

N13

N14

N15

8

88

6

7

RT9N11

RT12

N10

3

10

N9

1

1

H12

1

RT11

2

N8

RT10

6

Ia 7

Ib

3

N6

1

RT8

1

4

N7

RT7

6

1

9

6

62

Network example

RFC 2328 fig 2

Page 50: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Building a database

With LSA type 1 and 2, we can build databases by combining the LSA views

The matrix shows all metrics in the network **FROM**

|RT|RT|RT|RT|RT|RT|RT|RT|RT|RT|RT|RT| |1 |2 |3 |4 |5 |6 |7 |8 |9 |10|11|12|N3|N6|N8|N9| ----- --------------------------------------------- RT1| | | | | | | | | | | | |0 | | | | RT2| | | | | | | | | | | | |0 | | | | RT3| | | | | |6 | | | | | | |0 | | | | RT4| | | | |8 | | | | | | | |0 | | | | RT5| | | |8 | |6 |6 | | | | | | | | | | RT6| | |8 | |7 | | | | |5 | | | | | | | RT7| | | | |6 | | | | | | | | |0 | | | * RT8| | | | | | | | | | | | | |0 | | | * RT9| | | | | | | | | | | | | | | |0 | T RT10| | | | | |7 | | | | | | | |0 |0 | | O RT11| | | | | | | | | | | | | | |0 |0 | * RT12| | | | | | | | | | | | | | | |0 | * N1|3 | | | | | | | | | | | | | | | | N2| |3 | | | | | | | | | | | | | | | N3|1 |1 |1 |1 | | | | | | | | | | | | | N4| | |2 | | | | | | | | | | | | | | N6| | | | | | |1 |1 | |1 | | | | | | | N7| | | | | | | |4 | | | | | | | | | N8| | | | | | | | | |3 |2 | | | | | | N9| | | | | | | | |1 | |1 |1 | | | | | N10| | | | | | | | | | | |2 | | | | | N11| | | | | | | | |3 | | | | | | | | N12| | | | |8 | |2 | | | | | | | | | | N13| | | | |8 | | | | | | | | | | | | N14| | | | |8 | | | | | | | | | | | | N15| | | | | | |9 | | | | | | | | | | H1| | | | | | | | | | | |10| | | | |

RFC 2328 fig 3

Page 51: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

RT1N1

RT2N2

3

3

N31

RT4

1RT3

N4

2

1

1 RT5

RT6

8

8

8

6

N12

N13

N14

N15

8

88

6

7

RT9N11

RT12

N10

3

10

N9

1

1

H12

1RT11

2N8

RT10

5

Ib

7

Ia

3

N6

1

RT8

0

4

N7

RT7

6

1

9

6

62

0 0

0 0

5

1

00

0

00

0

Database, graphical form

0

LSA Type 5: AS External

7

7

Page 52: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

RT1N1

RT2N2

3

3

N3

RT4

1RT3

N4

2

RT5

RT66

N12

N13

N14

N15

8

88

6

RT9N11

RT12

N10

3

10

N9

H12

1RT11 N8

RT10

Ib

7

Ia

3

N6

1

RT8

0

4

N7

RT7

92

0

0

5

00

0

Shortest path tree for RT6

0

0

RFC 2328 fig 5

7

Page 53: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Building a routing table● Local routing table (RIB) computed from Dijkstra shortest path

calculation

● Next-hop routing: only nexthop router even if complete path is known

Example: RT6 Local destinations Remote destinations(type 1)

RFC 2328, table 2 RFC 2328, table 3

Destination Next Hop Distance__________________________________N1 RT3 10N2 RT3 10N3 RT3 7N4 RT3 8Ib * 7Ia RT10 12N6 RT10 8N7 RT10 12N8 RT10 10N9 RT10 11N10 RT10 13N11 RT10 14H1 RT10 21__________________________________RT5 RT5 6RT7 RT10 8

Destination Next Hop Distance__________________________________N12 RT10 10N13 RT5 14N14 RT5 14N15 RT10 17

Page 54: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

OSPF Network Topology

● Area 0 is the backbone area. All (inter-area) traffic goes via the backbone.

● All other areas are connected to the backbone (1-level hierarchy)● A Area Border Router (ABR) has one interface in each area.● An AS Boundary Router (ASBR) – redistributes external routes● Backbone router – at least one interface in backbone area

AS2Area 0

Area 1 Area 2 Area 3

Area Border Router:Interfaces in different

areas

AS boundary router:External routing

All areas connected tobackbone area

Internal router +

ASBR

Internal router

External

External

Page 55: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

OSPF Areas● Divides the OSPF domain into smaller zones

– Smaller link-state database in each zone

– Also decreases signaling traffic

● Routers have limits on processing power and memory– Router CPUs are typically much slower than PCs

● CISCO used to recommend ~80 routers as a limit in a single area

● You need a large network to benefit from areas– Typical large companies

● Example: KTHLAN using OSPF with 15-20 routers used to have areas – but now only uses area 0.

● However, areas are less used today.

Page 56: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Smaller database● Using areas makes the database smaller

– That is, fewer and more compact LSAs

● The destinations inside the area is still fully described by type-1 router and type-2 network LSAs– Full Dijkstra algorithm

● But destination networks outside the area are summarized– Transit networks (Network LSAs)

– Stub networks (Router LSA stub links)

– Router-LSAs are not distributed outside an area● Unless they are ASBR

● Only the (cumulative) metric and prefix necessary– Not full link state

● This leads to a smaller database and less processing to compute shortest path

Page 57: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Summary LSAs: types 3 and 4

● To distribute the summary information, we need two new LSAs

● Type 3 Network summary LSA– Destination, network mask

and cumulative metric

● Type 4 ASBR Summary LSA– Same as type 3, but destination is an AS boundary router

– Next hop for external routes

● Why is LSA type 4 needed?– Because type 5 AS external LSAs are flooded throughout

the AS, but the ASBR might not be visible from inside an area

N8

ABSR11

Page 58: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Area 2

RT1N1

RT2N2

3

3

N3

1

RT4

1

RT3

N4

2

1

1RT5

RT6

8 8

8 6

N12

N13

N14

N15

8

88

6

7

RT9N11

RT12

N10

3

10

N9

1

1

H12

1

RT11

2

N8

RT10

6

Ia 7

Ib

3

N6

1

RT8

1

4

N7

RT7

6

1

9

6

62

Area 1

Area 3

RFC 2328 fig 6

Page 59: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Comment 1: Route summarization

● When the details of an area has been hidden it makes sense to aggregate the prefixes

● Typically, all networks within an area, can be summarized into one LSA– Routes can also be summarized at redistribution to/from

another protocol

● The metric uses the max of all summarized metrics● In the example, area 2's routes are summarized:

– N9-N11, H1

– With max cost 11 (to H1)

Page 60: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Comment 2: Virtual links

● The backbone must be logically connected● But it does not have to be physically connected

– You can use virtual links (tunnels) to make the backbone virtually connected

– Traffic passing in the backbone may then physically use a non-backbone area: this is called a transit area.

● Example:– A virtual link is (manually) configured between RT10 and

RT11

– For robustness, RT7 and RT11 may also have a virtual link

Page 61: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Virtual link example

● A virtual link is (manually) configured between RT10 and RT11, and RT7 and RT10

● Area 2 is now a transit area

Area 2

1

RT11

2

N8

RT10

3

N6

1

RT8

1

4

N7

RT71

Page 62: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Example: Areas in 0 and 1

● Note 1: The Area Border Routers (RT3 and RT4) injects summaries both – Into Area 1 from the backbone and other areas

– Into Area 0 (backbone) from area 1

● Note 2: The external routes are flooded through all areas● Note 3: Area 1 has two points of exits

– Internal routers can make intelligent decisions, and load balance between exit points

– Example: RT1 uses RT4 to N6, and load balances to N8!

Page 63: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

N8

N6N7

Area 1

RT4

RT3

RT5

RT6

8

8

8

6

N12

N13

N14

N15

8

88

6

7

RT11

RT10

5

Ib

7

Ia

3RT7

6 9

6

62

N3

N2

N1

N4

5

Backbone Database: RFC 2328 fig 8

N9-N11, H1

Area 3

2

Area 2

11

Max of all individual metrics

Page 64: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

RT1N1

RT2N2

3

3

N31

RT4

1RT3

N4

2

1

1

RT5 N12

N13

N14

N15

8

88

9

2

N9-N11, H1

N8

N6

Ib

Ia

0 0

0 0

N7

Area 1's database: RFC 2328 fig 7

RT7

8 14

14

20

LSA Type 5: AS External

LSA Type 3: Network Summary

LSA Type 4: ASBR SummaryLSA Type 1:

RouterLSA Type 2: Network

Area 1

18

18

Page 65: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Stub areas● A problem with flooding external LSAs:

– Suppose many external routes are injected into OSPF

– Maybe the core carries transit traffic (between other AS:s)

● High performance routers

– But large parts of the areas do not

● Simpler routers

– This will give a high burden on the smaller routers

● In a stub area, the ABR does not flood external LSAs into the area

● Instead, one (or many) default routes are injected● Then all external traffic must use the default route

announced by the ABRs● But the inter-area networks are still announced by

summaries from the ABRs

Page 66: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

RT1N1

RT2N2

3

3

N3

1

RT4

1

RT3

N4

2

1

1RT5

RT6

8 8

8 6

N12

N13

N14

N15

8

88

6

7

RT7

6 9

6

62

Area 1

default

Stub area example

Page 67: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Motivation for NSSA

● Sometimes, the restrictions on stub areas are too strict: – You would like to import a limited number of external

routes

● Example: You want to block large routing tables from transit traffic, but want to import a small number of routes

● But in stub areas, you cannot import any external routes.

Page 68: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Example: NSSA motivation

Area 1

Area 0

Large amount of transit routes

Peering with other AS

Want to import routes from C but not from A and B

C

Peering with other AS

A

B

Page 69: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Not-So-Stubby Area (NSSA)

● RFC 3101● NSSA allows to inject external routes into a stub area● LSA type 7 are spread through the NSSA● At ABRs, the Type-7 LSA are translated to Type-5

(External-AS LSA) and spread through the AS● But other External-AS LSAs are still not inserted in

the NSSA

Page 70: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Example: NSSA solution

Area 1

Area 0

Peering with other AS

Routes from Cspread as Type-7 LSA

C

Peering with other AS

A

B

Routes from Ctranslated to Type-5 LSAs

Page 71: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Totally stub areas

● Totally stub area– In addition to external routes, do not distribute inter-area

routes into an area

● Just use default route

– CISCO-specific

● NSSA totally stub area– Combination of NSSA and totally stub area

Page 72: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Summary of LSAs: regular areas

Regular area Area 0

1 -----> -----> 3* 2 -----> -----> 3

5 -----> -----> 4 -----> 5

Regular area Area 0

3* <----- <---- 13 <----- <---- 23 <----- <---- 23 <----- <---- 34 <----- <---- 45 <----- <---- 54 <-----

Note:(*) Only stub links of type 1 translated to type 3●Type 5 passes through but generates a new type 4 (ASBR)●Type 3 and 4 from other areas passes through but changes origin (to ABR)●Summaries (3 and 4) are not forwarded into backbone

(stub links)

ABR ABR

3 ----->x 4 ----->x

Page 73: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Summary of LSAs: stub areas

Stub area Area 0

3 ----->x4 ----->x5 ----->x

Stub area Area 0

3 <----- <---- 23 <----- <---- 23 <----- <---- 3 x<---- 4 x<---- 5

0/0 <-----

1 -----> -----> 3* 2 -----> -----> 3

3* <----- <---- 1(stub links)

Note:● All type 5 blocked. Replaced with default route (in a type 3 LSA)

ABR ABR

Page 74: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Summary of LSAs: not-so-stubby areas

Stub area Area 0

3 ----->x4 ----->x5 ----->x7 -----> -----> 4 -----> 5

Stub area Area 0

3 <----- <---- 23 <----- <---- 23 <----- <---- 3 x<---- 4 x<---- 5

0/0 <----- x<---- 7

1 -----> -----> 3* 2 -----> -----> 3

3* <----- <---- 1

Page 75: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Opaque LSA Option

● RFC 2370● For Future extensibility● Standard LSA header● Followed by application-specific information● Three new LSA, difference in scope:

– Type 9-LSA: Link-local scope

– Type 10-LSA: Area-local scope

– Type 11-LSA: AS-local scope

Page 76: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Summary

● This was OSPF essentials● But there are many more issues, for more reading

consult:

– RFC 2328

– J Moy, OSPF Anatomy of an Internet Routing Protocol

– Lots of vendor documentation

Page 77: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

Traffic Engineering extensions● RFC 2370● It adds bandwidth and administrative constraints● So that a (network) manager can control traffic in more

detail● Distribute it in an area

– Uses Type-10 opaque LSA, area scope

– Call it Traffic Engineering LSA

● The LSA payload contains nested TLVs, for example:● Traffic engineering metric

● Maximum bandwidth

● Maximum reservable bandwidth

● Unreserved bandwidth

● Administrative group

Page 78: Link-state routing and OSPF Olof Hagsand KTH/CSC · OSPF and Link-state summary OSPF message types – Hello – Database Description – Link-State Request – Link-State Update

OSPFv3

● OSPF for IPv6 is OSPFv3● Unchanged: Flooding, DR election, area support, SPF calculations, etc● Authentication removed (use IPSEC)● New LSAs for IPv6 addresses● Addressing semantics removed from basic LSAs and msgs

● Avoid IPv4/IPv6 addresses – prefer RouterID

● Network-protocol independence

● Renaming: ● Type-3 summary LSA -> Inter-Area-prefix LSA

● Type-4 summary-LAS -> Inter-Area-router LSA