Routing

Introduction to Routing

एक network से दूसरे network में packets send करने की process को routing कहते है। Routing static और dynamic 2 प्रकार की होती है। Routes destination network पर based होते है। Routing में एक network से दूसरे network के लिए best path find किया जाता है। Best path को metric और administrative distance के base पर चुना जाता है। Routing routers के द्वारा perform की जाती है। इसके लिए routers routing tables बनाते है। आइये अब routing tables के बारे में जानने का प्रयास करते है।

Routing Tables

Routers routing tables बनाते है जिनमें निचे दी गई information होती है।

  • Destination network और उसका sub-net mask होता है।
  • Destination network तक जाने के लिए next hop router के बारे में information होती है।
  • Routing metrics और administrative distance stored होती है।

Routing tables 2 तरह के protocols से related होती है।

  1. Routed protocols - ये network layer protocols होते है। Routed protocols devices के साथ logical addresses attach करते है। ये protocols data को एक network से दूसरे network में भेजने के लिए responsible होते है। उदाहरण के लिए IP (Internet Protocol) और IPX आदि।
  2. Routing protocols - ये protocols routing tables में network, topology और next hop information build करते है। ये सारी information dynamically (automatically) build की जाती है। उदाहरण के लिए RIP, IGRP और OSPF आदि। Routing protocols 2 तरह के होते है।
    1. Distance vector - इस तरह के protocols में metric hop count (number of routers between source and destination) के द्वारा determine की जाती है। जिस route में distance सबसे कम होती है वही route choose किया जाता है। इस तरह के protocol का उदाहरण RIP है।
    2. Link state - इस तरह के protocols में metric shortest path first algorithm से determine की जाती है। सभी routes की cost में जो सबसे कम cost होती है उसे ही route चूना जाता है। इस तरह के protocols का उदाहरण OSPF है।

Destination network तक best route identify करने के लिए router निचे दिए गए 3 elements को यूज़ करता है।

  1. Prefix-Length - ये network को identify करने के लिए bits की quantity होती है। इससे सबसे सटीक route determine किया जाता है। Prefix length जितनी ज्यादा होती है route उतना ही सटीक होता है। उदाहरण के लिए मान लीजिए एक packet 10.1.5.0/24 host पर जा रहा है और router की routing table में निचे दिए गए 2 networks है। यँहा पर पहले network को choose किया जायेगा क्योंकि इसकी prefix length अधिक है। इससे कोई फर्क नहीं पड़ता की metric या administrative distance क्या है।

    1. 10.1.5.0/24
    2. 10.0.0.0/8
  2. Metric - Metric router को routing protocol के अंतर्गत best route ढूंढने की योग्यता देती है। Distance vector protocols distance को metric की तरह यूज़ करते है और link state protocols shortest path first algorithm द्वारा calculate की गई cost को metric की तरह यूज़ करते है। जिन routes की best metric होती है वही routing tables में add किये जाते है। यँहा तक की यदि किसी routing protocol के पास एक ही network तक जाने के 4 route है तो भी जो metric सबसे better होगी उसे ही routing table में add किया जायेगा। यदि equal metric के एक से ज्यादा route available है तो load balance के द्वारा सही metric को choose किया जायेगा।

  3. Administrative Distance - यदि router पर एक से अधिक routing protocols चल रहे है तो किस protocol पर सबसे अधिक trust करना है ये administrative distance के द्वारा determine किया जाता है। जँहा पर administrative distance सबसे कम होती है वही protocol choose किया जाता है। Administrative distance एक numerical value होती है जो dynamic protocols को assign की जाती है। ये fixed होती है। जिस protocol की administrative distance unknown होती है उसे कभी भी routing table में नहीं लिया जाता है। कुछ common protocols की administrative distance निचे दी जा रही है।

Protocols Administrative Distance 
IGRP 100 
OSPF 110 
RIP 120 
Unknown 255

Viewing Routing Table

किसी भी router पर routing table देखी जा सकती है। इसके लिए आप show ip route command execute करते है। इसे आप user execution mode से देख सकते है।

# router1 show ip route

जब आप इस command को execute करते है तो आपको सभी routers की list show हो जाती है। इन सभी routers के साथ एक label भी show किया जाता है जो ये बताता है की ये सब router current router से किस प्रकार connected है। जैसे की C मतलब directly connected होता है। इन सभी labels की list निचे दी जा रही है।

  • C - इस label का मतलब है की दिया गया router current router से directly connected है।
  • S - ये label बताता है की दिया गया router statically manage किया गया है।
  • S* - ये बताता है की current router से दिए गए router के बीच में default route है।
  • D - इस label का मतलब है की दिया गया router EIGRP protocol यूज़ कर रहा है।
  • I - ये label बताता है की दिया गया router IGRP protocol यूज़ कर रहा है।
  • R - ये बताता है की दिया गया router RIP protocol यूज़ कर रहा है।
  • O - इस label का मतलब है की दिया गया router OSPF protocol यूज़ कर रहा है।

Clearing Routing Table

यदि आप routing table से सभी routes clear करना चाहते है तो इसके लिए आप clear command यूज़ कर सकते है। Routing table clear करके आप routing protocols को routing table दोबारा populate करने के लिए force कर सकते है।

# router clear ip route

Choosing Best Route

किसी भी destination router तक best route choose करने के लिए आप निचे दी हुई process को follow कर सकते है।

  • सबसे पहले आप सभी route की destination route के साथ prefix length match करेंगे। जिन routes की prefix length सबसे accurate है आप उन्हें चुन लेंगे।
  • अब इन routes में से जिस route की metric सबसे कम है आप उसे choose कर लेंगे।
  • यदि same metric के एक से अधिक route है तो आप सबसे कम administrative distance वाले route को choose करेंगे और यही आपका सबसे best route होगा।

Static & Dynamic Routing

Routing table build करने के लिए 2 basic method available है।

  • Static routing
  • Dynamic routing

इन दोनों methods के बारे में निचे detail से दिया जा रहा है।

Static Routing

Static routing table को network administrator manually create, maintain और update करता है। हर network के लिए route हर router पर manually configure किया जाता है। इससे आप routing को बहुत deep level पर control कर सकते है। लेकिन ये approach large networks के लिए impractical है।

इस approach में routers एक दूसरे के साथ routes नहीं share करते है, इससे router की RAM/CPU पर extra stress नहीं पड़ता है और साथ ही इससे bandwidth भी save हो जाती है। Static routing fault tolerant नहीं है क्योंकि इसमें सभी कुछ manually किया जाता है। इसलिए जब भी कोई link down होती है या नया router add किया जाता है तो routers में changes manually करने पड़ते है। जो routers pure static environment में काम करते है वो कोई भी link unavailable होने पर दूसरा better route choose करने में incapable होते है।

Static routes की administrative distance 1 होती है इसलिए इन्हें dynamic routes से पहले preference दी जाती है। इस administrative distance को change भी किया जा सकता है। जिन static routes की administrative distance adjust की जाती है उन्हें floating static route कहते है। निचे static routing की कुछ advantages दी जा रही है।

  • Static routing में CPU पर overhead बहुत कम होता है।
  • Bandwidth में overhead बिलकुल भी नहीं होता है क्योंकि routers एक दूसरे के साथ updates share नहीं करते है।
  • Static routing से आप network को deep level पर control कर सकते है।

निचे static routing की कुछ disadvantages भी दी जा रही हैं।

  • यदि network में कोई change करना हो तो उसे सभी routers पर manually करना होता है।
  • यदि कोई link down हो जाये तो इसमें कोई fault tolerant नहीं होती है।
  • Static routing large networks के लिए impractical है।

Dynamic Routing

एक dynamic routing table routing protocols के द्वारा create, maintain और update की जाती है। Routing protocols में निचे दिए गए 3 protocols होते है।

  1. RIP (Routing Information Protocol)
  2. IGRP (Interior Gateway Routing Protocol)
  3. EIGRP - (Enhanced Interior Gateway Routing Protocol)
  4. OSPF - (Open Shortest Path First)

Dynamic routing में routers एक दूसरे के साथ routing information share करते है। इससे CPU और Memory का overhead बढ़ जाता है और bandwidth भी use होती है। लेकिन यदि network में कोई link down हो जाये तो routing protocols dynamically दूसरा better path choose कर सकते है।

नीचे dynamic routing की कुछ advantages दी जा रही है।

  • Dynamic routing को large networks पर आसानी से configure किया जा सकता है।
  • Automatically better path choose करने में सक्षम।
  • Different links के बीच में load balance करने में सक्षम।

निचे dynamic routing की कुछ disadvantages भी दी जा रही हैं।

  • Dynamic routing bandwidth consume करती है।
  • Router के CPU पर additional load पड़ता है।
  • Route की choice routing protocol के हाथ में होती है administrator इसमें कुछ नहीं कर सकता है।

Categories of Dynamic Routing Protocols

Dynamic routing protocols को 2 categories में divide किया गया है।

  • Distance vector protocols
  • Link state protocols

इन दोनों protocols के बारे में निचे detail से दिया जा रहा है।

Distance Vector Routing Protocols

RIP और IGRP distance vector routing protocols होते हैं। सभी distance vector routing protocols की कुछ characteristics होती है जो निचे दी जा रही है।

  • पूरी routing table की periodic updates सभी पड़ौसी routers को भेजी जाती है।
  • Distance vector protocols में convergence बहुत slow होता है और ये protocols loops के प्रति अतिसंवेदनशील होते है।
  • Route की metric calculate करने के लिए distance को यूज़ किया जाता है।
  • Shortest path तय करने के लिए Bellman ford algorithm यूज़ की जाती है।

Distance vector routing protocols सभी neighbors को directly connected networks के बारे में updates send करते है। ये update regularly भेजी जाती है। RIP में ये update हर 30 second में भेजी जाती है और IGRP में ये update हर 90 second में भेजी जाती है। इन updates से neighbors अपनी routing tables में route add कर लेते है। इसके बाद सभी neighbors अपनी पूरी routing table को सभी neighbors के साथ share करते हुए forward कर देते है।

इस तरह की process की कई disadvantages है। Routing information एक neighbor से दूसरे neighbor के pass periodic updates से जाती है इसलिए convergence बहुत slow होता है। साथ सभी neighbors एक दूसरे पर depend करते है इसलिए looping के chances भी बहुत अधिक होते है।

जैसा की मैने आपको पहले बताया distance vector protocols metric calculate करने के लिए distance को यूज़ करते है। RIP में metric hop counts के द्वारा calculate की जाती है। IGRP में bandwidth और delay के द्वारा metric calculate की जाती है।

Link state protocols को distance vector protocols में आने वाली looping और convergence problem को overcome करने के लिए develop किया गया था। Link state routing protocols 3 तरह की routing tables build करते है। इनके बारे में निचे दिया जा रहा है।

  • Neighbor table - इस table में सभी neighbors की list होती है और साथ ही ये भी होता है की कौनसा neighbor किस interface से connected है। Neighbor table hello packets भेज कर बनायीं जाती है।
  • Topology table - इसे link state table भी कहते है। इसमें एक area की सभी links का map stored रहता है। साथ ही हर link का status भी stored रहता है।
  • Shortest path table - इस table में हर destination के लिए best routes stored रहते है।

Link state routing protocols में routers directly connected networks के status के बारे में updates भेजते है। सभी routers ये information topology table में store करते है। एक area के अंदर जितने भी routers होते है उनकी topology table same होती है।

यदि किसी link में कोई change आता है तो केवल इस link से related update सभी routers को भेजी जाती है और सभी routers उसके अनुसार अपनी topology table को adjust कर लेते है।

केवल जिस link में change हुआ है उसी की update भेजी जाती है इस वजह से bandwidth पर भी ज्यादा प्रभाव नहीं पड़ता है। लेकिन 3 tables को manage करने की वजह से CPU बहुत अधिक utilize होता है।

Link state protocols में Dijkstra formula के द्वारा shortest path calculate किया जाता है।