Sunteți pe pagina 1din 9

Content-Type: text/x-zim-wiki

Wiki-Format: zim 0.4


Creation-Date: 2015-07-22T16:23:02+03:00
====== 1. OpenShortestPathFirst ======
Created Wednesday 22 July 2015
OSPF is a link-state routing protocol designed for use within an autonomous syst
em (AS). As a link-state interior gateway protocol (IGP), OSPF allows for faster
reconvergence, supports larger internetworks, and is less susceptible to bad ro
uting information than distance-vector protocol.
________________________________________________________________________________
_______________________________________
**Summary:**
- OSPF is IP protocol 89
- OSPF uses all routers multicast address 224.0.0.5 and 224.0.0.6 is use
d by Designated routers
- Hello and Dead Timers must match to form adjacency
- OSPF timers : hello timer 10s and dead timer 40 (dead timer = 4* hello
timer)
- Interface MTU is not checked during formation of neighbor adjacencies
, MTU missmatch will prevent the successful exchange of DD packets and prevent n
eighbor from reaching FULL state
- DD packets are acknowledge by sending back an identical DD packet
- for the Databased Exchange process (ExStart) the router with the highe
r RID is designated the Master and responsible for seting the sequence number of
the DD packets
- DD exchange contains LSA headers and seq number for each LSA
- if a router does not have a LSA described in DD or has the LSA but wit
h a lower sequence number , it will request a full copy of the LSA with LSA Requ
est
- a router receiveing a LSA Req reply with a LSA Update
- each LSA Update is acknowledged by sending back a duplicate LSA Req or
LSA Update or a LSA Ack
- a OSPF router keeps track of which routers owe it an ACK , and will re
transmit the LSA to that neighbor wha have not sent an ACK
- once the LSA updates finish and the LSDB are syncronizae the OSPF tran
sit from "Loading" into "Full"
- the DR/BDR election is hapening at the initial Hello packets exchange
, and the election is based on the higher priority value received in the Hello p
acket and the local one or higher RID
- each LSA is re-flooded every 30 min by default (LSR Reflesh timer)
- the LSA reflood timer is per LSA , so not all LSA in the LSDBB will ne
cessary be re-flooded all the same time
- each LSA has a MaxAge timer that it must be refreshed within 60 minute
s by default
- we disable the LSA aging process by setting the LSA with a bit that sa
ys "Do Not Age"
- LSA Type 2 are only created for network where a DR has been elected:
- DR/BRD is only elected in NBMA and Broadcast network type
- configuring broadcast lins as point-to-point , OSPF prevents D
R election , the link will allow only 2 neighbors on that segment
- LSA Type 2 are only flooded within the area by the DR of the network
- Type 1 LSA are created by each router in the area describing itself ,
its interfaces and neigbhors
- LSA Type 1 and 2 contains most topology details and are confined to th
e area
- LSA Type 3 provide summary info about Type 1 and 2 LSA for other areas
- LSA Type 3 has simple information - the subnet , the mask , and the co

st as known by the ABR


- when something changes with a LSA Type 3 only partial SPF run is neede
d
- OSPF virtual link cannot exist in a stub area
- OSPF Graceful Restart, 2 different metods:
- OSPF link local signalling LLS - a change in the format of the
OSPF hello from fix length to use TLV
- LLS used by default
- Opaque LSAs - send a "Grace LSA" prior to restart informing ne
ighbor
- LSA exponential backoff:
- a flapping link can cause excessive LSA updates and cause rout
ers to be consumedwith processing LSA
- it uses 3 Timers : Initial , Incremental and Maximum timer
- when the link is stable for 2xMaximum timer the LSA update tim
er resets to start from scratch
________________________________________________________________________________
_______________________________________
**OSPF Router Types:**
- Internal Router : All interfaces resides within the same area
- Backbone Router : a router with an interface in area 0 (the backbone)
- Area Border Router : Connects two or more areas
- AS Boundary Router : Connects to additional routing domains , typicall
y located in the backbone
________________________________________________________________________________
_______________________________________
**OSPF States :**
- **Down:**
- The initial state indicates that OSPF is waiting for a start e
vent
- No hellos has been received from this neighbor , but hello pac
kets can still be send on the line to the Multicast
- Durring full Adjacency neigbhor state , if a router doesnt rec
eive hello packet from a neigbor within the the RouteDeadInterva (=4xHelloInterv
al) or if the manualy configured neighbor is removed the state changes from Full
to Down
- **Attempt:**
- This state is valid only for manualy configured neigbhors in a
n NBMA environment
- In this state the routers sends onver sends unicast hello pack
etes every poll interval to the neigbhor, from which hellos have not been receiv
ed whithin the dead interval
- **Init:**
- This state specifies that the router has started to send hello
packets
- It remains in this state as long as it doesn't find its RID in
the received hello packets
- if a hello packet is received from a neigbor on that link
- When a router receives a hello packet from a neighbor ,and the
hello packet is valid the router will update is Hello packets and include that
neigbor RID in the new Hello packets as acknowledgement
- It indicates that there has not been established a bidirection
al communication between neighbours
- Once hello messages were exchanged the __DR and BDR is elected
on the Multiaccess link.__
- Receiving a Database Descriptor packet from a neighbor in the

init state will aslo cause a transition to 2-way


- **2-Way:**
- the router received a packet with the router's ID listed in th
e neighbor section .
- This state designates that bi-directional communication has be
en established between two routers
- Each routers has seen the others hello packet
- At this state the router decide to become adjacent with this n
eigbor
- In Ethernet network a router will become full only with the D
R and BDR , with the rest will remain in 2-Way
- **ExStart:**
- This state indicates that the routers negotiate between themse
lves to determine which router is in charge of the __database syncronization pro
cess__
- it uses Database Description OSPF packets and random sequence
number , the router with the highest ID will be Master , and the slave will conf
irm this by sinding a DD with the Master sequence number
- **Exchange:**
- Indicates that the routers exchange LSA headers describing the
ir own database
- It uses Database Description OSPF packets to exchange LSA head
ers
- DD contain LSA headers and describe the contents of the entire
LS Database
- DD packets has a sequence number incremented by the master and
ACK by the slave
- If a router doesn't know about a received LSA header , it can
transmit a Link State Request for complete information
- **Loading:**
- Indicates that the routers finished transmitting its databaase
to its peer but is still receiving database information.
- The actual exchange of link state informaiton occurs
- based on the inforamiton providede by the DBD s, routers send
link-state request packets
- Neighbors provide th requested link state information in links
-state update packets
- All link state updates packets are ACK
- **Full:**
- Routers are fully adjacent with each other.
- LSAs are exchanged and database are fully syncronized
- Normal state of the OSPF router
________________________________________________________________________________
_______________________________________
**OSPF Packets Type :**
**- Hello :**
- Used to establish and maintain OSPF relationship
- OSPF routers send hello packets on all their links on a regula
r cycle 1 second with a RouterDeadInterval set to 3 seconds
- Are multicasted over All OSPF routers Address : 224.0.0.5
- Consist of the following fields:
- Network mask - used on broadcast media links , all rou
ters must agree on the subnet mask of the link
- Hello interval - the two routers must agreee on how of
ten to send hello packets which this field determins
- Dead interval - the keepalive , states how long to wai
t before removing the adjacency from a neighbor , both end must agree on this ti
mer
- Options: 8-bit field represents such things as ability

to be a stub area , options must match between neighbors.


- Note: if for router A the Hello interval and Dead interval set
, then its neighbor router B will used this values advertised to maintain his a
djiacence to router A , no interference with routers B intervals
**- Database Description:**
- Are used only durring the adjacency formation process between
two OSPF routers
- __Serves two purposes :__
- determining who is in charge of the database syncroniz
ation
- transfering LSA headers between two systems
- Database syncronization follows the following steps :
1. each router exchange DD with a random sequence number
2. the router with the lowest ID sends a DD with the neighbor sequence n
umber ackowledging the neighbor __(with higher ID )__ as the Master router
3. Once the database transfer has finished the Master - Slave relationsh
ip is forgotten.
- OSPF uses DD to transfer the LSA headers between systems , it
uses the following fields:
- OSPF header
- Sequence number :
- This field ensures that the full seq of DD is
received in the database sync process .
- The sequence is the Master's sequence number i
ncremented in subsequent packets.
- The slave it will always reply with the last s
equence number received from the Master
- LSA header:
- Header lists all of the headers of the LSA in
the originator's link state database.
- The header contains enough informaiton to uniq
uely identify the LSA and the particulare instance of the LSA.
- the process will sent at packets at interface MTU leng
th ,
- if the Database needs more DD packets to send the LSA
header, it uses in the DD description field the __M bit (More)__ specify that mo
re DD description will come.
- DD packets are acknowledge with a identical packet sen
t in return.
**- Link-State Request:**
- Used by an OSPF router when that router detects its database h
as missing LSA information
- Used to request precise version of database , it does this by
transmitting the LSA ID and the Advertising router
- it contains the following list of details :
- OSPF header
- Link State Type : the LSA type number ( Router / Netwo
rk LSA )
- Link-State ID : is type dependent on the LSA header
- Advertising router : contains the router ID of the rou
ter that originated the LSA
**- Link State Update**
- Information block in SPF and carry multiple LSAs
- Transmitted using multicast All OSPF routers address or the A
ll DR address (224.0.0.6)
- OSPF sends link-state update packets in two different ways
__- in response to a link-state request packet during th
e adjacency database syncronization __
__- after an adjacency is formed/lost or a redistributio

n is withdrawned , if information about that link state changes__


- Link State Update has the following fields:
- OSPF header
- Number of advertisment : the number of LSA included in
this packet
- Link-State Advertisment : Full LSA , each update can c
arry multiple LSA up to __Maximum Packet size (Links MTU)__
**- Link State Ack**
- It acknowledge Link State Updates
- a single ACK can include responses to multipe update packets a
nd consist of the OSPF header and the LSA header
- are sent in unicast fashion back to the originator
- is the basis for the reliable fooding in OSPF
________________________________________________________________________________
_______________________________________
**Link State Advertisements**
- data structures which contains routing informations
- OSPF uses LSA to reliably flood information about their network links
and the state of those links to their neighboring OSPF routers
- each OSPF router it creates and maintains a link state database LSDB
- OSPF uses the Link state database to run the SPF algorithm and determi
ne the shortes routes from his side .
- LSA ages out , the Max Age of a LSA is 60 min , if this timer expire t
he LSA will be removed from LSDB
- LSA Refresh_timer is the timer used by the originator of the LSA to re
-flood the specific LSA , by default 30 minutes
- to reduce excessive traffic from LSA re-flooding , we can disable LSA
aging proess , setting the "Do Not Age" bit in LSA
- the Max Age :
- it is the maximum age that a LSA can be retained in LSDP
- when an LSA LS age field reaches Max Age , the originator rout
er will increase the LSA seq number and reflood the LSA
- it is used in case of withdraw routes , routes where the Max A
ge is reached are not used in the routing table calculation
- when the Link State Update contiains the LSA and the age is se
t the Max Age , its neighbors will withdraw the route from their LSDB and propag
ate the change to sync all LSDB on the area
- Each LSA has initially its own Sequence number , every change on the
LSA is marked with an increment of the Sequence Number.
- if a LSA is receive , based on the sequence number we will hav
e the following case :
- If the LSA is already in the LSDB and the seq number i
s the same the LSA is ignore
- if the LSA is already in the LSDB and the seq number i
s different then we have to take action:
- if sequence number is higher it means this inf
ormation is newer and we have to add it to LSDB
- if the sequence number is lower then the adver
tising router has an older LSA , and we will send an LSA Update with the local n
ewer LSA to OSPF neighbor
**The Link State Database :**
- it stores the LSAs as a series of records
- details include routers ID, its attached networks , and neighboring ro
uters and the cost associated with thos networks or neighbor
- each router in an OSPF area must have an identical LSDB to ensure accu
rate routing knowledge

ulate the
best path
As :

the information recorded in the database is used as input data to calc


shortest path first for all destination prefixes
Dijkstra algorithm is used to buid a tree of shortest paths , and the
to a network will be picked up and placed in routing table.
The link State Databased has a substructure dictated by the type of LS
-

Router LSA
Network LSA
Summary LSA
ASBR LSA
External LSA

________________________________________________________________________________
_______________________________________
**LSA Packet Types:**
**- Router (Type 1 ):**
- each OSPF speaking router generates a Type 1 LSA to describe t
he status and cost of all interfaces on the router
- this LSA is flooded to each router in that OSPF area
- LSA Type 1 are not flooded across an area boundary
- the following link types are supported
- Point-to-point
- Transit : connection to a broadcast segment , the ID f
ield is the IP address of the segments DR
- Stub :
- when the subnet does not connect to any OSPF n
eigbhors , it occures for loopback and passive interfaces ,
- the IP subnet for any ptp interface is adverti
sed as a stub
- Virtual : used when we have a virtual link operating b
etween an ABR connected to Area 0 and an ABR not connected to Area 0.
**Note:** The withdraw mechanism for LSA Type 1 covers two scena
rios with different mechanism:
- If a router fails :
- its neighbors will generate a new LSA type 1 ,
with a higher Seq No , it will remove the link to the neigbor and the neigbor
floods it to the rest of the routers in the area
- at one point one router observese that the new
topology can't route traffic to the failed router (the SPF alghoritm fails) the
n the LSA will be marked with no route to Adv Router
- once the LSA has aged out it is removed from t
he LSDB
- If a link will fail:
- the adjiacent routers of the link will generat
e a new LSA Type 1 with an higher Seq No and reflooded into the network and with
out the missing link in the LSA.
- if link will flap , multiple LSA will be creat
ed an forwarded over the network causing different unpredictable behavior.
**- Network ( Type 2):**
- each OSPF router elected to be the DR on a broadcast link gene
rates a Type 2 LSA
- LSA Type 2 are flooded in that particular area not across an a
rea boundary
- this LSA list each router connected to the broadcast segment ,
including the DR itself
- it contains the following extra fields:
- Network mask: it denotes the IP subnet mask for the in
terface connected to the broadcast

- Attached router : this field is repeated for each rout


er connected to the broadcast segment.
**Note:** The withdraw mechanism for LSA Type 1 covers three sce
narios with different mechanism:
- If a non DR router Fails :
- the DR will generate a new LSA Type 1 and LSA Type 2 ,
whitout the failed router , and floods it into the area
- If a DR router will Fail:
- the BDR will generate a new LSA Type 1 and LSA Type 2
and flood it over the network
- at any point a router receiving the new LSA Type 2 it
will install it along the old LSA Type 2 ,
- the SPF now with the new LSAs will not find a path to
the failed DR so the route will be marked with No Routing Bit.
- the Old LSA will be Age Out
- If a DR link will fail and recovers:
- the DR will Age Out its LSA Type 2 , and retain it in
the LSDB
- Once the link recoveres , he old DR it will increment
the Seq No of the LSA Type 2 ,and set the Age to MAX to age it out over the net
work.
**- Summary (Type 3):**
- each ABR that transmits information from one OSPF area to anot
her , it generates Type 3 LSA
- this LSA is flooded to each router in the OSPF area.
- For each LSA form area A , an ABR will create a separate Summa
ry LSA which will be flooded in area B.
- as these LSA are re-injected into different areas , the LSA ty
pe never change , but the cost and advertising router details do change
- it contains the following extra fields:
- Advertising Router : is the ABR address
- Network Mask : this field represents the subnet mask a
ssociated with the network advertised.
- Metric : this field provides the cost of the router to
the nearest ABR
**Note:** A LSA type 5 is withdrawned from LSDB using a LSA Upda
te with a higher Seq No and the Age set to maximum 3600s (Age out)
**- ASBR Summary (Type 4)**
- each ABR that must transmit information about an ASBR from one
OSPF area into another generates a Type 4 LSA
- LSA Type 4 has an area scope , so it is not reflooded by anote
r ABR acros area boundary
- as ASBR summary LSAs are re-injected into different areas the
LSA type never changes but the cost and advertising router details do change
- as extra header:
- Network mask : has no meaning to a Type 4 LSA , it is
set to 0.0.0.0
- Metric : this field provides the cost of the router to
ASBR`
**Note:** A LSA type 4 is withdrawned from LSDB by the ABR using
a LSA Update with a higher Seq No and the Age set to maximum 3600s (Age out)
**- External (Type 5) :**
- Each ASBR generates a Type 5 LSA to advertise any networks ext
ernalt to the OSPF domain.
- Each redistributed prefix will generate its own LSA
- the LSA is reflooded to each nonstub router in the entire OSPF
domain
- it describe IP prefixes redistributed from other routing prot
ocols
- by default this LSA are marked with Type E2 designation ,the

cost specified by the redistributingrouter in thee Metric will be used as metric


all over the OSPF domain
- if LSA Type 5 are marked with Type 1 , but the routers will ad
d to the encoded value of the external route cost the cost to reach the ASBR .
- as extra header :
- Metric type : 2 (default ) or 1
- Metric : is the cost of the route set by the ASBR , do
esn't change
- Forward Address : the address to the other area ASBR /
in case NSSA it is the address of the nearest ABR .
- External Tag
**Note:** A LSA type 5 is withdrawned from LSDB by the ABR using
a LSA Update with a higher Seq No and the Age set to maximum 3600s (Age out)
**- NSSA External (Type 7) :**
- Similar to Type 5 in that they describe IP prefixes redistribu
ted from other routing protocols
- these LSA are sent by ASBR in NSSA areas
- these LSAs are translated to type 5 LSA by the ABR attached to
NSSA area in which the type 7 LSAs originated
**- Opaque LSA (Type 10)**
- used for Traffic Engineering
________________________________________________________________________________
_______________________________________
**OSPF Selection Rules:**
- OSPF has the following order of route preference before route cost is
even considered:
- Intra area routes
- Inter area routes
- E1 external routes
- E2 external routes
- E2 routes have a default cost of 20 while E1 route starts with a cost
of 20 and cumulates along the path
- only when E2 routes have the same external metric will OSPF check the
internal cost to the advertising ASBR
- when all else is equal between a LSA Type 5 and LSA Type 7 (metric ,ex
ternal metric , internal cost) the OSPF route will prefer the LSA Type 5
- ABR will ignore LSA Type 3-5 from other ABR over links in the same non
backbone area , ABR will prefer its dirrect connection to area 0
________________________________________________________________________________
_______________________________________
**OSPF Area Types :**
- Standard Area:
- default OSPF area type
- Stub Area:
- External link LSA 5 are replaced witha defaul route
- Totally Stubby Area:
- LSA 3 ,4 and 5 are replaced with a default route
- Not So Stubby Area (NSSA)
- a stub area containing an ASBR type 5 LSA are converted to typ
e 7 within the area
________________________________________________________________________________
_______________________________________
**OSPF Down Bit and Domain Tag:**
__- Down Bit :__
- a bit set in Option field of OSPF LSA type 3

- if the OSPF route has been advertised from a PE router into OS


PF the down bit will be set
- if another PE in the same area receive the LSA with Down Bit s
et it will not redistribute it into iBGP , the PE does not even include the rout
e in the SPF
- it is used to avoid rooting loops in multihomed scenario or ba
ck door
__- Domain Tag (VPN Tag)__
- serves the same purpose as the down bit but for OSPF external
routes
- it can be set manually on the PE routers
- if not set it will take the BGP AS Number value by default
- the tag will be present redistributed LSA 5 , external LSA

S-ar putea să vă placă și