OSPF Neighbor Adjacency

OSPF Deep Dive: Establishing OSPF Neighbor Adjacency

by Elena Mofar, Published on May 19, 2023

Ano ba ang importance ng neighbor adjacency?

Basically, pag sinabi kasing neighbor adjacency - ibig sabihin, ang dalawang same routing protocol routers agree to share routing information.

Sa case ng mga OSPF routers - yung routing information na yan ay ang kanilang LSDB (Link State Database).

Take note na kasama sa mga router LSAs yung mga network addresses ng mga OSPF activated interfaces.

Using that information, malalaman ng isang router kung ano-ano ba yung mga networks available ng kanilang mga neighbor routers para mailagay nila sa kanilang mga routing tables as a dynamically learned route.

Pero ang tanong muna, paano ba nage-establish ng neighbor adjacency ang dalawang OSPF routers?

Bago makapag-establish ng neighbor adjacency ang mga OSPF routers, kailangan muna nilang daanan yung mga tinatawag na OSPF Neighbor States.

OSPF Neighbor States

These are the OSPF Neighbor States:

  1. Down
  2. Init
  3. 2Way
  4. Exstart
  5. Exchange
  6. Loading
  7. Full

Yung mga OSPF neighbor states na yan ay nangyayari during the establishment of neighbor adjacency.

Para mas maintindihan natin yung mga states na yan, i-walkthrough muna kita dun sa kung ano man ang nangyayari sa neighborship establishment.

Balik ko lang ulit yung topology na ginagamit ko sa OSPF lecture natin:

OSPF lecture topology

Balik ko lang din yung OSPF configuration na ginawa ko sa R1:

OSPF Configuration

Take note na ang mga network advertisements natin activates all interfaces whose IP addresses fall in the <network prefix> <wildcard mask> IP range.

And based dyan sa configuration natin - yung fa0/0, fa0/1 and se0/0 are all activated.

OSPF creates a Router LSA based dun sa mga link states na meron sa mga activated interfaces.

Bukod sa Router LSA, may iba pang importanteng trabaho na ginagawa ang mga activated interfaces natin.

OSPF routers sends out Multicast Hello Messages out the activated interfaces every x number of seconds equal to its Hello Interval.

Ang tanong, ano yung Hello Message na yan?

Ang mga Hello Messages ay ginagamit para sa neighbor discovery, at para sa building and maintaining ng OSPF neighbor adjacencies.

Basically, ginagamit ang hello message para mai-announce ng isang router ang presence nya sa mga kapitbahay na routers.

Kumbaga, sumisigaw yung router mo ng - 'HELLO!! may OSPF router ba dyan? Pwede ba tayong maging neighbors??"

If ever may isa pang OSPF router na maka-receive ng hello message na yan, dun na sila papasok sa neighbor adjacency process na ididiscuss ko mamaya-maya.

Sabi ko nga sa definition, ginagamit din yung hello message para sa maintaining ng OSPF neighbor adjacency. Nagbabato kasi ng hello message ang mga routers natin every x number of seconds equal to its hello interval.

Ang default hello interval for OSPF is 10 seconds.

Ibig sabihin lang nyan, once a neighbor adjacency is established, expected na ng isang router na dapat nakaka-receive sya ng hello message galing dun sa kapitbahay nyang router every 10 seconds, and vice versa.

Ginagamit din kasi yung hello message na yan para malaman ng isang router kung yung kapitbhay nyang router is still up or gumagana pa. As long as nakaka-receive sya ng hello galing sa neighbor router, ibig sabihin, lahat ng mga routes na natutunan nya galing dun sa neighbor na yun is still reachable, therefore, those routes needs to be maintained sa routing table.

Eh paano kung lumipas na yung 10 seconds or yung hello interval at hindi pa rin nakaka-receive ng hello yung router galing sa neighbor router nya?

Dyan na papasok yung dead interval.

Ang default dead interval for OSPF is equal to 4x the hello interval. Since yung hello interval is 10 seconds, ibig sabihin, yung dead interval natin is 40 seconds.

Yung dead interval na yan specifies how long should the router wait to receive hello messages before it considers that neighbor dead or unavailable.

If nag-elapse na yung dead interval timer, and still, hindi pa rin nakaka-receive ng hello message ang isang router galing sa kapitbahay nya - ibig sabihin, that neighbor is dead/unavailable and must be removed from the list of OSPF neighbors. Also, yung mga routes na natutunan galing sa unavailable neighbor na yun are now unreachable and must also be removed from the routing table.

Take note na yung hello and dead interval timers MUST BE THE SAME on all routers.

So ayun, every 10 seconds nagbabato yung mga routers natin ng Multicast Hello Message palabas sa mga OSPF activated interfaces.

Multicast is a one-to-many type of messaging where only devices who are tuned to listen to a specific multicast address will respond to the multicast message. Devices NOT tuned to the multicast address will just ignore the messages received.

Ang OSPF Multicast Address for all OSPF speaking routers ay : 224.0.0.5

Yung multicast address na yan ang nilalagay ng mga OSPF routers natin as the destination IP address sa lahat ng mga hello messages na binabato nila.

All OSPF speaking routers are tuned to listen for all incoming messages destined for the multicast address 224.0.0.5 - ibig sabihin, pag naka-receive sila ng isang message na yan ang destination IP address : ia-accept at ipa-process nila yung message na yan.

Pero, kapag ang isang router na hindi configured with OSPF or does not run OSPF receives a message with a destination IP address of 224.0.0.5 - it will just ignore and drop that message kasi hindi sya tuned to listen sa address na yan.

Yung mga OSPF Hello Messages na yan has these contents (take note na lahat ng mga contents na to ay dependent dun sa interface kung saan lalabas yung hello message) :

  1. Router-ID of the originating router
  2. Area ID ng interface kung saan lumabas yung Hello Message
  3. Address and Subnet Mask ng originating interface
  4. Authentication type and Authentication information of the originating interface
  5. Hello Interval
  6. Dead Interval
  7. Router Interface Priority
  8. DR and BDR information
  9. Router-IDs of the originating router's neighbors

So sabi ko nga, yung mga hello messages natin are used for neighbor discovery, at para sa building and maintaining ng OSPF adjacencies..

Once ma-activate natin yung isang interface, it will immediately send out a hello message to find and discover possible OSPF neighbors that are reachable on that interface.

If another OSPF router receives a hello message from a possible neighbor, iche-check nya yung mga contents nung hello na yan.

Ito yung Neighbor Adjacency checklist na tinitignan sa Hello message, all these items MUST MATCH on both routers for them to agree to become neighbors:

  1. Area ID/Number
  2. Area Type
  3. Network address and Subnet Mask (except for point-to-point links)
  4. Hello and Dead Interval timer values
  5. Authentication information
  6. Router-ID of the originating router must not equal the neighbor router's Router-ID (Router-ID must be unique)

Take note na nagiiba-iba ang mga values ng mga hello messages natin depende dun sa interface na pinaglalabasan nya.

Nung nag-configure ako ng OSPF sa R1, actually nag-umpisa na sya magbato ng multicast hello message papunta sa 224.0.0.5 every 10 seconds palabas ng mga activated interface nya.

Kaya lang, since si R1 pa lang yung nako-configurean ko, hindi pa yan nakaka-discover ng kahit na anong OSPF neighbor.

Pwede nating makita yung OSPF neighbor table by using this command:

#show ip ospf neighbor

Tignan ko muna yung neighbor table ni R1:

Notice na wala pang laman yan.

 

Ano na ngayon ang mangyayari kung ko-configurean ko na rin ng OSPF si R2?

 

Eto yung configuration na nilagay ko sa R2:

After ng OSPF configuration kay R2, it will immediately create a Router LSA (Link State Advertisement), and will put that LSA in its own LSDB (Link State Database).

So, ang laman muna nung LSDB ni R2 initially ay yung Router LSA nya.

Then, R2 will send out a hello message palabas ng lahat ng mga OSPF activated interfaces nya.

Isa sa mga contents ng hello message contents ay (9) Router-IDs of the originating router's neighbor. Basically, kasama sa bawat isang hello message na binabato ng isang router yung listahan ng lahat ng mga OSPF neighbors nya.

So parang ang sinasabi ni R2 sa hello nya ay, "Helloww!! Ako nga pala si 2.2.2.2 may OSPF router ba dyan? Pwede ba tayong maging neighbor? Eto pala yung list ng mga neighbors ko na.... Ay! Wala pala akong neighbor, since kaka-configure ko lang.. hehe"

OSPF routers sending hello messages

Presently, yung list ng router neighbors ni R2 ay wala pang laman dahil wala pa naman tayong nafo-form na neighbor adjacency.

Ngayon, nung na-receive ni R1 yung OSPF hello galing kay R2, ichecheck nya yung contents nyan if papasok sa neighbor adjacency checklist.

Take note na lahat ng items na nasa checklist muDst match on both routers for them to agree to become neighbors.

Tignan natin isa-isa kung nagma-match ba yung mga nasa checklist on both R1 and R2 (lagay ko lang yung topology plus yung OSPF configuration natin dito para mas masaya):

OSPF Topology with configuration

(1) Area Number

For 2 OSPF routers to agree to become neighbors, yung interface nila na naka-receive ng hello message ng isa't isa MUST BE on the same Area.

Notice na dun kay R1, yung interface nya na makakatanggap ng hello message from R2 is yung serial 0/0 interface nya.

Kay R2 naman, yung interface nya na makakatanggap ng hello message galing kay R1 ay ang serial 0/0 interface nya.

Based dun sa OSPF configuration natin, yung network advertisement that activated both interfaces are in area 0.

Therefore, check tayo dyan sa item #1.

(2) Area Type

 

Etong area type ay isang configureable value.

 

May iba-ibang area types kasi tayo sa OSPF - regular area, stubby areas, not so stubby areas (NSSA), totally stubby area, and totally not so stubby area....

 

Pero take note, na yung mga types of areas na yan and yung configuration nila is NOT included in the CCNA curriculum kaya hindi muna natin paguusapan yan.

 

Pero, kung ano man yung mga area types na yan - just by looking dun sa configuration natin, obviously wala tayong nilagay na area type hindi ba?

 

Ibig sabihin, yung area type na ginagamit natin is just a regular area.

 

Since on both R1 and R2, wala tayong kinonfigure na area type dyan, ibig sabihin - both interfaces of R1 and R2 is inside a regular area.

 

Therefore, check tayo dyan sa item #2.

(3) Network and Subnet Mask (except for point-to-point links)

 

This only applies for hello messages received on ethernet interfaces - dapat yung network prefix and subnet mask included dun sa hello message must be the same dun ethernet interface na makaka-receive ng hello.

 

Since dito sa topology natin, yung interfaces ni R1 and R2 na nakaka-receive ng hello ng isa't isa ay mga serial interfaces - hindi na natin kailangan to..

 

Therefore, check din tayo dito sa item #3.

(4) Hello and Dead Interval Timers

Yung Hello and Dead interval timers are configured on a per interface basis.

Ibig sabihin, pwedeng magkaiba yung mga timers na yan sa mga interfaces ng routers natin.

Pero based sa configurations natin, wala pa naman akong pinalitan na hello and dead interval timers - ibig sabihin, yung mga timers na yan ay naka-set pa rin sa default na 10 seconds para sa hello interval and 40 seconds para sa dead interval.

Therefore, check din tayo dito sa item #4.

(5) Authentication information

Yung configuration ng mga authentication keys or password sa OSPF is also configured on a per interface basis.

Ibig sabihin, dapat yung configured keys sa mga interface must be the same dun sa neighbor router interface na panggagalingan ng hello message.

Take note na yung OSPF authentication is not included in the CCNA 200-301 curriculum, kaya hindi natin iko-configure yan - and, based sa configuration ko dun sa OSPF - wala rin akong nilagay na additional authentication.

Therefore, check din tayo sa item #5.

(6) Router-ID of the originating router must not equal the local router's Router-ID (Router-IDs must be unique)

For 2 routers to agree to become neighbors - their router-IDs MUST be unique. Hindi pwedeng magkaparehas sila dahil may kinalaman yan mamaya sa palitan nila ng mga LSA nila when building their respective LSDBs.

Based dun sa configuration ko, ang nilagay kong router-ID para kay R1 ay 1.1.1.1

At ang router-ID naman ni R2 ay 2.2.2.2

Notice na yung router-IDs nila are unique.

Therefore, check din tayo dito sa item #6.

Since lahat ng mga items na nasa checklist ay nagma-match on both routers, dadaanan na nila yung mga OSPF neighbor states on their way to establish neighbor adjacency....

NOTE: Yung unang neighbor state natin is the down state. Tatalunan ko muna yang state na yan, at uumpisahan yung discussion sa 2nd state natin, last na natin paguusapan yung down state na yan :)

OSPF Neighbor State : Init

Since nung na-receive ni R1 yung hello message kay R2, at nung chineck nya yung contents nung hello - lahat naman ng items dun ay pasok at nagma-match sa checklist, ibig sabihin, agree na si R1 na maging neighbor kay R2..

At dahil agree na syang maging neighbor, ilalagay na ni R1 yung router-ID ni R2 sa neighbor table nya, pero ang ilalagay nya na neighbor state ay INIT.

OSPF Neighbor State: INIT

Take note na nasa INIT state pa lang si R2 from R1's perspective, ibig sabihin, sya ay nasa Adjcency Initialization State pa lang..

Yung neighbor state ni R1 kay R2 will remain in an INIT state until such time na makareceive sya ng hello ulit galing kay R2 kung saan nakalista na sa neighbor list yung sarili nyang router-ID.

Remember na isa sa mga contents ng hello message yung listahan ng mga neighbors ng router na nagbabato nung hello (Hello Content #9 : Router-IDs of the originating router's neighbors ).

So, ibig sabihin, pag nagbato ng hello message si R1, kasama na yung 2.2.2.2 na router-ID sa neighbor list nya.

OSPF routers in INIT state

Ngayon, mare-receive naman ni R2 yung hello na galing kay R1.

Iche-check ni R2 yung hello message to see if the contents matches the neighborship checklist.

Makikita nya na kasama sa neighbor list ni R1 yung router-ID nya.

If ok lahat ng contents, at agree si R2 na maging neighbor si R1, ilalagay nya na yung router-ID ni R1 dun sa OSPF neighbor table nya.

Pero ang state na ilalagay ni R2 kay R1 (1.1.1.1) is 2Way.

Ano ang meron sa 2Way State?

OSPF Neighbor State : 2Way

Check na muna natin yung OSPF neighbor table ni R2:

OSPF routers in 2Way State

Please note na yung discussion included in this post is taken from the OSPF section nung CCNA 200-301 book ko :)

OSPF is the most commonly used routing protocol in the industry today. And si OSPF din ang nagiisang routing protocol included in the CCNA 200-301 exam.

To help you in passing the OSPF section sa exam, and to also help you in passing your technical interview regarding OSPF - you need to have an in-depth knowledge on it.

Sa CCNA book ko, I explained everything OSPF in detail but in the most simplest zero-to-hero explanation na hindi mo makikita sa ibang Cisco books :)

Eto yung buong OSPF contents that can be found sa CCNA 200-301 book:

If interested ka sa book, you can click here:

Next Topic Suggestion:

Category Suggestion

Recent Posts

Linux Relative and Absolute Paths
Introducing the Linux Shell
Linux Filesystem Hierarchy
Linux Installation : How to Install Centos 7 in Vmware Workstation 15
QOS (Quality of Service) Fundamentals