اس لیب میں آپ BGP کے اہم path attributes (weight، local-preference، AS-path، MED) اور BGP best-path selection کا عمل سیکھیں گے۔
Is lab mein aap BGP ke ahem path attributes (weight, local-preference, AS-path, MED) aur BGP best-path selection ka amal seekhenge.
In this lab you will learn the key BGP path attributes (weight, local-preference, AS-path, MED) and the BGP best-path selection process.
BGP path selection ایسے ہے جیسے نوکری کے امیدوار چننا — پہلے اندرونی سفارش (weight)، پھر کمپنی کی پالیسی (local-pref)، پھر باہر کے حوالے (AS-path کی لمبائی)، پھر امیدوار کا اپنا دعویٰ (MED) دیکھا جاتا ہے۔ جو پہلے معیار پر جیت جائے، وہی منتخب۔
BGP path selection aise hai jaise naukri ke umeedwar chunna — pehle andaruni sifarish (weight), phir company ki policy (local-pref), phir bahar ke hawale (AS-path ki lambai), phir umeedwar ka apna dawa (MED) dekha jata hai. Jo pehle miyar par jeet jaye, wohi muntakhib.
BGP path selection is like hiring — first the internal recommendation (weight), then company policy (local-pref), then outside references (AS-path length), then the candidate's own claim (MED). Whoever wins at the earliest criterion is selected.

R1 (AS 65001) کے دو eBGP نیبرز ہیں: R2 (AS 65002) اور R3 (AS 65003)۔ دونوں ایک ہی prefix 10.99.0.0/16 advertise کرتے ہیں۔ مقصد: attributes بدل کر best path کو کنٹرول کرنا۔
R1 (AS 65001) ke do eBGP neighbors hain: R2 (AS 65002) aur R3 (AS 65003). Dono ek hi prefix 10.99.0.0/16 advertise karte hain. Maqsad: attributes badal kar best path ko control karna.
R1 (AS 65001) has two eBGP neighbors: R2 (AS 65002) and R3 (AS 65003). Both advertise the same prefix 10.99.0.0/16. Goal: control the best path by changing attributes.
بنیادی eBGP کنفیگر کریں۔ R1 پر دونوں نیبرز کے ساتھ eBGP پیئرنگ بنائیں۔ show ip bgp summary سے state Established چیک کریں۔
Bunyadi eBGP configure karein. R1 par dono neighbors ke saath eBGP peering banayein. show ip bgp summary se state Established check karein.
Configure basic eBGP. Build eBGP peering with both neighbors on R1. Check for Established state with show ip bgp summary.
configure terminalrouter bgp 65001neighbor 192.168.12.2 remote-as 65002neighbor 192.168.13.3 remote-as 65003exitWeight کا اثر دیکھیں۔ Weight صرف local راؤٹر پر اثر ڈالتی ہے (Cisco-specific)۔ R2 سے آنے والے راستے پر زیادہ weight لگائیں اور دیکھیں کہ best path بدل جاتا ہے۔
Weight ka asar dekhein. Weight sirf local router par asar dalti hai (Cisco-specific). R2 se aane wale raste par zyada weight lagayein aur dekhein ke best path badal jata hai.
See weight in action. Weight affects only the local router (Cisco-specific). Set a higher weight on the route from R2 and watch the best path change.
configure terminalrouter bgp 65001neighbor 192.168.12.2 weight 200exitclear ip bgp * softLocal-preference آزمائیں۔ Local-pref پورے AS میں پھیلتی ہے (iBGP)۔ Route-map سے R3 والے راستے پر local-pref 200 لگائیں — اب یہ weight کو پیچھے چھوڑ دے گا کیونکہ weight ہٹا دیں گے۔
Local-preference aazmayein. Local-pref poore AS mein phelti hai (iBGP). Route-map se R3 wale raste par local-pref 200 lagayein — ab ye weight ko peeche chhor dega kyunke weight hata denge.
Try local-preference. Local-pref propagates inside the whole AS (iBGP). Use a route-map to set local-pref 200 on the R3 path — it will beat weight once weight is removed.
configure terminalip prefix-list TEST seq 5 permit 10.99.0.0/16route-map SET-LP permit 10match ip address prefix-list TESTset local-preference 200exitrouter bgp 65001no neighbor 192.168.12.2 weight 200neighbor 192.168.13.3 route-map SET-LP inexitclear ip bgp * softBest path چیک کریں۔ show ip bgp 10.99.0.0 میں > نشان والا راستہ best path ہے۔ Attributes (LocPrf، Weight) کالم میں نظر آئیں گے۔
Best path check karein. show ip bgp 10.99.0.0 mein > nishan wala rasta best path hai. Attributes (LocPrf, Weight) column mein nazar aayenge.
Check the best path. In show ip bgp 10.99.0.0 the route marked > is the best path. Attributes appear in the LocPrf and Weight columns.
show ip bgp 10.99.0.0AS-path prepending سمجھیں۔ AS-path جتنا لمبا، راستہ اتنا کم پسندیدہ۔ اپنے AS کو راستے میں کئی بار شامل (prepend) کر کے outbound ٹریفک کو متاثر کیا جا سکتا ہے۔
AS-path prepending samjhein. AS-path jitna lamba, rasta utna kam pasandeeda. Apne AS ko raste mein kai baar shamil (prepend) kar ke outbound traffic ko mutasir kiya ja sakta hai.
Understand AS-path prepending. The longer the AS-path, the less preferred the route. Prepending your own AS multiple times influences outbound traffic.
configure terminalroute-map PREPEND permit 10set as-path prepend 65001 65001 65001exitMED کا کردار دیکھیں۔ MED (multi-exit discriminator) پڑوسی AS کو بتاتا ہے کہ ہمارے کئی لنکس میں سے کون سا بہتر ہے۔ کم MED جیتتا ہے، مگر صرف ایک ہی پڑوسی AS کے راستوں کا موازنہ ہوتا ہے۔
MED ka kirdar dekhein. MED (multi-exit discriminator) parosi AS ko batata hai ke hamare kai links mein se kaun sa behtar hai. Kam MED jeet-ta hai, magar sirf ek hi parosi AS ke raston ka mawazna hota hai.
See MED's role. MED (multi-exit discriminator) tells the neighboring AS which of our multiple links is better. Lowest MED wins, but only routes from the same neighboring AS are compared.
configure terminalroute-map SET-MED permit 10set metric 50exitshow ip bgp 10.99.0.0Best-path ترتیب دہرائیں۔ یاد رکھیں: Weight → Local-pref → locally originated → AS-path length → origin → MED → eBGP over iBGP → IGP metric → router-ID۔ یہ ترتیب انٹرویو میں ضرور پوچھی جاتی ہے۔
Best-path tarteeb dohraein. Yaad rakhein: Weight → Local-pref → locally originated → AS-path length → origin → MED → eBGP over iBGP → IGP metric → router-ID. Ye tarteeb interview mein zaroor poochi jati hai.
Recap the best-path order. Remember: Weight → Local-pref → locally originated → AS-path length → origin → MED → eBGP over iBGP → IGP metric → router-ID. This order is always asked in interviews.
show ip bgp 10.99.0.0show ip bgp میں best path (>) وہی ہو جو آپ نے attribute سے منتخب کیا۔ ہر attribute بدلنے کے بعد soft clear کرنا نہ بھولیں۔
show ip bgp mein best path (>) wohi ho jo aap ne attribute se muntakhib kiya. Har attribute badalne ke baad soft clear karna na bhoolein.
In show ip bgp the best path (>) should be the one you selected via attributes. Don't forget a soft clear after each attribute change.
show ip bgpshow ip bgp 10.99.0.0show ip bgp summary