Advanced BGP: Best-Path Deep-Dive & Convergence
CCIE Enterprise Infrastructure EVE-NG / GNS3
مقصدObjectiveObjective
اس سبق کے بعد آپ BGP کا مکمل best-path الگورتھم سمجھ جائیں گے، پاتھ attributes ٹیون کرنا سیکھیں گے اور BGP convergence تیز کرنے کے طریقے جان جائیں گے۔Is lesson ke baad aap BGP ka mukammal best-path algorithm samajh jayenge, path attributes tune karna seekhenge aur BGP convergence tez karne ke tareeqay jaan jayenge.After this lesson you will understand the full BGP best-path algorithm, tune path attributes, and know how to speed up BGP convergence.
آسان مثالSimple AnalogySimple Analogy
BGP ایسا ہے جیسے ہوائی جہاز کا روٹ چننا — سب سے پہلے براہ راست فلائٹ (weight/local-pref)، پھر سب سے چھوٹی فاصلہ، پھر سستی ایئر لائن۔ ہر مرحلہ ایک tie-breaker ہے۔BGP aisa hai jaise hawai jahaz ka route chunna — sab se pehle direct flight (weight/local-pref), phir sab se chhota fasla, phir sasti airline. Har marhala ek tie-breaker hai.BGP is like picking a flight — first the direct flight (weight/local-pref), then shortest distance, then cheapest airline. Each step is a tie-breaker.
سیٹ اپLab SetupLab Setup
چار روٹرز لیں: R1 اور R2 ایک AS میں (iBGP)، R3 اور R4 دوسرے AS میں (eBGP)۔ ہر AS کے اندر loopback نیٹ ورکس بنائیں تاکہ best-path فیصلے دیکھ سکیں۔Chaar routers lein: R1 aur R2 ek AS mein (iBGP), R3 aur R4 doosre AS mein (eBGP). Har AS ke andar loopback networks banayein taake best-path decisions dekh sakein.Use four routers: R1 and R2 in one AS (iBGP), R3 and R4 in another AS (eBGP). Create loopback networks in each AS to observe best-path decisions.
اقداماتStepsSteps
Step 1
بنیادی BGP peers بنائیں۔ eBGP کے لیے directly connected نیبرز اور iBGP کے لیے loopback پر مبنی peers استعمال کریں۔Bunyadi BGP peers banayein. eBGP ke liye directly connected neighbors aur iBGP ke liye loopback par based peers use karein.Build basic BGP peers. Use directly connected neighbors for eBGP and loopback-based peers for iBGP.
router bgp 65001 neighbor 10.0.0.2 remote-as 65002 network 192.168.1.0 mask 255.255.255.0
Step 2
Best-path ترتیب: Weight (سب سے زیادہ) → Local Preference → Locally originated → AS-path (سب سے چھوٹا) → Origin → MED → eBGP over iBGP → IGP metric → Router-ID۔Best-path order: Weight (sab se zyada) → Local Preference → Locally originated → AS-path (sab se chhota) → Origin → MED → eBGP over iBGP → IGP metric → Router-ID.Best-path order: Weight (highest) → Local Preference → Locally originated → AS-path (shortest) → Origin → MED → eBGP over iBGP → IGP metric → Router-ID.
show ip bgp 192.168.1.0
Step 3
Weight صرف لوکل روٹر پر اثر ڈالتا ہے، جبکہ Local Preference پورے AS میں پھیلتا ہے۔ outbound ٹریفک کنٹرول کے لیے local-pref استعمال کریں۔Weight sirf local router par asar dalta hai, jabke Local Preference puray AS mein phailta hai. Outbound traffic control ke liye local-pref use karein.Weight affects only the local router; Local Preference propagates across the AS. Use local-pref to control outbound traffic.
route-map SET-PREF permit 10 set local-preference 200 neighbor 10.0.0.2 route-map SET-PREF in
Step 4
AS-path prepending سے inbound ٹریفک متاثر کریں — اپنا AS نمبر بار بار جوڑنے سے راستہ لمبا لگتا ہے اور دوسرے اسے کم ترجیح دیتے ہیں۔AS-path prepending se inbound traffic affect karein — apna AS number baar baar jorne se rasta lamba lagta hai aur doosre use kam tarjeeh dete hain.Use AS-path prepending to influence inbound traffic — repeating your AS number makes the path look longer so others prefer alternatives.
route-map PREPEND permit 10 set as-path prepend 65001 65001 neighbor 10.0.0.2 route-map PREPEND out
Step 5
BGP timers ڈیفالٹ 60/180 سیکنڈ ہوتے ہیں۔ کنورجنس تیز کرنے کے لیے انہیں کم کریں، اور BFD شامل کریں تاکہ لنک فیل فوری پکڑا جائے۔BGP timers default 60/180 seconds hote hain. Convergence tez karne ke liye inhen kam karein, aur BFD shamil karein taake link fail fori pakra jaye.BGP timers default to 60/180 seconds. Lower them for faster convergence, and add BFD so link failures are detected instantly.
neighbor 10.0.0.2 timers 10 30 neighbor 10.0.0.2 fall-over bfd
Step 6
Advertisement interval ڈیفالٹ eBGP کے لیے 30 سیکنڈ ہے — اسے 0 پر سیٹ کریں تاکہ اپڈیٹس فوری بھیجی جائیں۔ iBGP پر یہ پہلے سے 0 ہوتا ہے۔Advertisement interval default eBGP ke liye 30 seconds hai — use 0 par set karein taake updates fori bheji jayen. iBGP par ye pehle se 0 hota hai.The advertisement interval defaults to 30s for eBGP — set it to 0 so updates go out immediately. It's already 0 for iBGP.
neighbor 10.0.0.2 advertisement-interval 0
Step 7
ایک لنک بند کر کے failover وقت ناپیں۔ بہترین راستہ بدلنے پر 'show ip bgp' میں next-hop اور path attributes کی تبدیلی دیکھیں۔Ek link band kar ke failover waqt napein. Behtareen rasta badalne par 'show ip bgp' mein next-hop aur path attributes ki tabdeeli dekhen.Shut a link and measure failover time. When the best path changes, observe the next-hop and path attribute changes in show ip bgp.
shutdown show ip bgp summary no shutdown
تصدیقVerifyVerify
یقین کریں کہ ہر prefix کے لیے best path نشان زد ہے (> کا نشان)، ٹائمرز نئے values پر ہیں، اور BFD sessions up ہیں۔Yaqeen karein ke har prefix ke liye best path marked hai (> ka nishan), timers naye values par hain, aur BFD sessions up hain.Confirm every prefix has a marked best path (the > symbol), timers show new values, and BFD sessions are up.
show ip bgp show ip bgp summary show bfd neighbors
خرابی دور کرناTroubleshootingTroubleshooting
⚠️ BGP neighbor 'Active' حالت میں پھنسا ہے۔BGP neighbor 'Active' state mein phansa hai.BGP neighbor stuck in Active state.
✅ TCP 179 کنیکٹیویٹی چیک کریں (ping/telnet)، AS نمبرز اور source-interface درست کریں۔TCP 179 connectivity check karein (ping/telnet), AS numbers aur source-interface durust karein.Check TCP 179 reachability (ping/telnet) and verify AS numbers and source-interface.
⚠️ روٹ BGP table میں ہے لیکن best path منتخب نہیں ہو رہا۔Route BGP table mein hai lekin best path select nahi ho raha.Route is in the BGP table but not selected as best path.
✅ 'show ip bgp <prefix>' میں attributes کا موازنہ کریں — اکثر next-hop unreachable یا synchronization کا مسئلہ ہوتا ہے۔ next-hop-self لگائیں۔'show ip bgp <prefix>' mein attributes ka muqabla karein — aksar next-hop unreachable ya synchronization ka masla hota hai. next-hop-self lagayein.Compare attributes in show ip bgp <prefix> — usually an unreachable next-hop. Apply next-hop-self.
انٹرویو سوالاتInterview Q&AInterview Q&A
❓ Weight اور Local Preference میں کیا فرق ہے؟Weight aur Local Preference mein kya farq hai?What is the difference between Weight and Local Preference?
Weight Cisco-proprietary ہے اور صرف اسی روٹر پر لاگو ہوتا ہے، نیبرز کو نہیں بھیجا جاتا۔ Local Preference پورے AS میں iBGP اپڈیٹس کے ذریعے پھیلتا ہے۔Weight Cisco-proprietary hai aur sirf usi router par apply hota hai, neighbors ko nahi bheja jata. Local Preference puray AS mein iBGP updates ke zariye phailta hai.Weight is Cisco-proprietary and local to one router — never advertised. Local Preference propagates across the AS via iBGP updates.
❓ BGP convergence تیز کرنے کے تین طریقے بتائیں۔BGP convergence tez karne ke teen tareeqay batayen.Name three ways to speed up BGP convergence.
کم keepalive/hold timers، BFD برائے فوری failure detection، اور advertisement-interval 0 کرنا۔Kam keepalive/hold timers, BFD for fori failure detection, aur advertisement-interval 0 karna.Lower keepalive/hold timers, BFD for instant failure detection, and setting advertisement-interval to 0.