Está en la página 1de 14

Nhng kin thc c bn v BGP

S cn thit ca BGP BGP l mt giao thc kh phc tp c dng nhiu trn Internet v trong cc cng ty a quc gia. Mc ch chnh ca BGP l kt ni cc mng rt ln hoc cc Autonomous-System. Cc cng ty ln c th dng BGP nh l mt kt ni gia cc mng cc quc gia khc nhau. Mc ch ca cc giao thc ngoi nh BGP l khng ch tm ra mt ng i v mt mng no m cn cho php ngi qun tr tm ra cc AS ca cc network. Cc giao thc ni nh EIGRP, RIP, OSPF v ISIS s tm ra network m ngi qun tr cn. Mt s tnh cht ca BGP BGP l mt giao thc nh tuyn dng path-vector nn vic chn la ng i tt nht thng thng da trn mt tp hp cc thuc tnh c gi l ATTRIBUTE. Do s dng metric kh phc tp, BGP c xem l mt giao thc kh phc tp. Nhim v ca BGP l m bo thng tin lin lc gia cc AS, trao i thng tin nh tuyn gia cc AS, cung cp thng tin v trm k cho mi ch n. BGP s dng giao thc TCP cng 179. Nh cc chng trc cp, cc giao thc nhm distance vector thng qung b thng tin hin c n cc router lng ging, cn path vector ch ra chnh xc danh sch ton b ng dn n ch. Ngoi ra cc giao thc nh tuyn hot ng dng path vector gip vic xc nh vng lp trn mng rt tt bng cch xem xt cc con ng m cc router khc gi v xem c chnh bn thn AS trong hay khng, nu c s bit c ngay l lp, v s loi b. BGP h tr cho cc a ch CIDR (Classless Interdomain Routing). BGP cho php dng xc thc v BGP c cc c ch keepalive nh k nhm duy tr quan h gia cc BGP peers. Trong giai on ban u ca ca phin thit lp quan h BGP, ton b cc thng tin routingupdate s c gi. Sau , BGP s chuyn sang c ch dng trigger-update. Bt k mt thay i no trong h thng mng cng s l nguyn nhn gy ra trigger-update. Mt trong cc c im khc bit nht ca BGP l trong cc routing-update ca n. Khi ta xem xt cc BGP update, ta s nhn thy cc routing update ny l kh chnh xc. BGP khng quan tm n vic giao tip c y kin thc ca tt c cc subnet bn trong mt cng ty m BGP quan tm n vic chuyn ti y thng tin tm mt AS khc. Cc BGP update thc hin qu trnh summarization n mt mc ti a bng cch cho php mt s AS, cho php mt s prefix v mt vi thng tin nh tuyn. Tuy nhin, mt phn nh ca BGP update l kh quan trng. BGP m bo rng lp transport truyn cc update v cc c s d liu v ng i c ng b. BGP c th c hin thc bao gm gia cc AS khc nhau hay trong cng 1 AS. Khi dng BGP kt ni cc AS khc nhau, BGP c gi l eBGP. Giao thc ny cng c th c dng mang thng tin gia cc router eBGP trong mt AS. Khi BGP c gi l iBGP.

Trong mt AS ta s dng giao thc nh tuyn ni IGP (v d nh RIP, ISIS, EIGRP, OSPF) nhng khi ra ngoi mt AS th phi s dng mt giao thc khc. Vn y chnh l mc ch ca cc IGP v EGP khng ging nhau. Cc IGP thc hin nh tuyn gi i t ngun n ch m khng cn quan tm n chnh sch nh tuyn (policy). Trong khi ra khi phm vi mt AS th chnh sch nh tuyn li l vn quan trng . Xt v d sau: AS4---AS1---AS2---AS3---(C Company) |........................................| |........................................| B Company-----------A Company Gi s A mun truyn d liu n AS4. A v B l 2 i th ca nhau. B khng mun chuyn d liu cho cng ty A nn A ch c th chuyn d liu thng qua AS3, AS2, AS1 n c AS4, mc d con ng thng qua cng ty B c th l ti u nht. Gi s C thuc AS3 cng mun n AS4 nhng C l i tc ca B nn B sn sng cho qu giang. Nh vy A v C c cng mt ch n nhng phi i theo nhng cch khc nhau. Cc IGP khng th lm c iu ny v mt nguyn nhn ch yu chnh l cc giao thc u lin quan n metric hay l cost m hon ton khng quan tm n chnh sch nh tuyn. N ch bit c gng lm sao chuyn c cc gi d liu n ch mt cch hiu qu v ti u nht. Cc thut ng BGP 1 Aggregation

L qu trnh tm tt cc route (summarization) 2 Attribute Tng t nh metric. Cc bin ny s m t cc c im ca ng i ti mt a ch ch no . Khi c nh ngha, cc c im ny c th c dng ra quyt nh v nn i theo ng i no. 3 Autonomous System nh ngha mng ca mt t chc. Trong mt AS, cc router s c cng giao thc nh tuyn. Nu ta kt ni ra Internet, ch s AS ny phi l duy nht v c cung cp bi cc y ban Internet. 4 Exterior Gateway Protocol (EGP) Thut ng chung cho mt giao thc c chy gia cc AS khc nhau. Cng c mt giao thc c tn l EGP l tin thn ca BGP 5 EBGP Gi thng tin nh tuyn gia cc AS khc nhau 6 Interior Gateway Protocol (IGP) y l cc giao thc nh tuyn chy bn trong mt AS. Trong qu kh, thut ng gateway thng c dng nh ngha mt router. 7 IBGP Giao thc ny c dng bn trong mt AS. Cc router khng yu cu phi l lng ging ca nhau v phng din kt ni vt l v thng ngoi ra ca mt AS. IBGP c dng gia cc router chy BGP trong cng mt AS. 8 Originator-ID y l thuc tnh ca BGP. N l mt thuc tnh ty chn. Thuc tnh ny s cha gi tr routerID ca router pht sinh ra ng i . Mc ch ca thuc tnh ny l ngn nga routing loop. Nu mt router nhn c mt update t chnh n, router s b qua update .

9 policy-based routing C ch ny cho php ngi qun tr lp trnh giao thc nh tuyn bng cch nh ngha traffic s c route nh th no. y l mt dng ca nh tuyn tnh. PBR c lp vi cc giao thc nh tuyn v dng route-map to ra cc qu trnh ring l p t cc quyt nh nh tuyn. 10 prefix list Prefix list c dng nh mt thay th cho distribute-list kim sot BGP hc hoc qung b cc cp nht nh th no. Prefix-list th nhanh hn, uyn chuyn hn v t tn ti nguyn ca h thng hn. 11 Route-reflector y l router c cu hnh chuyn cc routes t cc router iBGP khc. Khi cu hnh routereflector, cc iBGP khng cn phi fully-mesh na. Mt mng fully-mesh th khng c kh nng m rng. 12 Route-Reflector Client Mt client l mt router c mt TCP session vi mt router khc hot ng nh mt routereflector-server. Client khng cn thit phi thit lp peer vi cc client khc. 13 Route_reflector Clustor Mt cluster l mt nhm bao gm mt route-reflector v clients. C th c nhiu hn mt routereflector server trong mt cluster. 14 transit autonomous system L AS c dng mang cc BGP traffic qua cc AS khc.

Khi no th dng BGP? Khi mng ca mt cng ty kt ni n nhiu ISP hoc cc AS khc v ang dng cc kt ni ny. Nhiu cng ty dng cc kt ni khc nhau nhm mc ch d phng. Chi ph c th gim

thiu nu tt c cc kt ni u c dng. Trong trng hp ny, PBR c th cn thit trin khai trn tng kt ni. BGP cn c dng khi chnh sch nh tuyn ca nh cung cp dch v v ca cng ty khc nhau. Hoc traffic trong cng ty cn phi c phn bit vi traffic ca ISP. Mng ca hai t chc khng th xut hin nh mt AS. Mt trng hp khc phi dng BGP l khi mng ca ta l mt ISP. Nu l mt ISP, h thng mng ny phi cho php cc traffic khc i qua AS ca mnh. Lc ny n hot ng nh mt transit domain.

Khi no th khng dng BGP? Mt h thng mng n gin l mt h thng mng d dng qun l v bo tr. y l l do chnh trnh dng BGP trong mt h thng mng. V vy, nu h thng mng c cc c im sau, nn dng nhng cch thc khc, chng hn nh static hoc default-routing. - Mng ca ISP v mng ca cng ty c chung mt chnh sch nh tuyn - Mc d cng ty ca bn c nhiu kt ni n ISP, cc kt ni ny l d phng v v vy khng cn mt k hoch kch hot nhiu hn mt kt ni n Internet. - Ti nguyn mng l c gii hn, chng hn nh b nh v CPU ca router. - Bng thng gia cc AS l thp v cc ph tn cho nh tuyn s nh hng n qu trnh chuyn d liu.

Mt s thuc tnh quan trng ca BGP BGP nh tuyn traffic bng cch s dng cc thuc tnh. Vic s dng cc thuc tnh m ch n vic s dng cc bin trong qu trnh chn la ng i trong BGP. Cc thuc tnh ca BGP khng ch l danh sch cc bin m qua route c chn la. Mt vi thng tin c mang trong cc thng ip cp nht l quan trng hn cc thng tin khc. Mt s thng tin khc l rt quan trng cho hot ng ca BGP, v vy cc thng tin ny phI c mang n tt c cc router BGP trong mng. Qu trnh chn la ng i da trn nhng thuc tnh v cc gi tr ca n. Cc thuc tnh c chia thnh hai nhm: nhm nI ting (well-known) v nhm ty chn (optional). C hai nhm ny s c tip tc chia ra lm cc nhm con.

Nhm M t Well-known mandatory Cc thuc tnh ny l bt buc v c cng nhn bi tt c cc router BGP Well-known Discretionary

Khng yu cu cc thuc tnh ny tn ti trong cc cp nht nhng nu chng tn ti, tt c cc router s cng nhn v s c hnh ng tng ng da trn thng tin c cha bn trong thuc tnh ny. Optional Transitive Router c th khng cng nhn cc thuc tnh ny nhng nu router nhn c thuc tnh ny, n s nh du v gi y cp nht ny n router k tip. Cc thuc tnh s khng thay i khi i qua router nu thuc tnh ny khng c cng nhn bi router. Optional Nontransitive Cc thuc tnh ny b loi b nu cp nht mang thuc tnh ny i vo router m router khng hiu hoc khng cng nhn thuc tnh. Cc thuc tnh ny s khng truyn ti cc BGP.

1. Thuc tnh AS_PATH: y l thuc tnh quan trng trong vic xc nh ng i ti u, mang 2 chc nng. Th nht, AS_PATH cng ngn cng c router u tin hn. (v d t AS3 n AS4 c 2 con ng khc nhau: AS3 - B - AS4, hoc AS3 - AS2 - AS1 AS4 th router s u tin con ng ngn hn l qua B). Chc nng th hai l ngn nga vng lp. Bi v thuc tnh AS_PATH rt quan trng cho qu trnh hot ng ca BGP nn tt c cc nh cung cp phi h tr n v l mt thuc tnh mang tnh bt buc, ngha l tt c cc b nh tuyn phi chuyn thuc tnh ny n tt c cc lng ging trong mi thng ip cp nht ca BGP. 2. Thuc tnh ngun gc (Origin-attribute): l mt thuc tnh xc nh ngun gc ca cc routing thng tin cp nht nh tuyn. Nu l i th ch rng routing thng tin cp nht nh tuyn c bit thng qua mt IGP (RIP, OSPF). Nu gi tr e th routing thng tin cp nht nh tuyn c bit thng qua mt EGP. Nu gi tr ? (incomplete) th ch rng khng bit ngun gc ca routing thng tin cp nht nh tuyn. (iu ny c th xut hin nu routing thng tin cp nht nh tuyn c bit thng qua IGP ri sau li c thng bo qua EGP.). Khi n hc ng bng lnh network th n thuc tnh ny l: i. Khi n hc ng qua cc lnh nh redistribute v.v... th n thuc tnh l: ?.Cn sau cc mng ny c qung b ti cc EGP router lng ging th thuc tnh ny c i thnh e v router mi hc c cc tuyn ng ny nh EGP. Thuc tnh origin khng thay i qua giao thc EBGP m vn gi nguyn. Thuc tnh origin l e khi tuyn c hc t giao thc EGP (y l giao thc nh tuyn gia cc AS, c s dng nhiu trn Internet khi BGP cha ra i nhng hin nay hu nh khng cn c s dng)

Next-Hop attribute:

Trong eBGP, gi tr next-hop l a ch IP ca router t bn ngoi ca vng t tr AS qung b vo bn trong AS. a ch IP c ch ra bi lnh neighbor. Tuy nhin trong mi trng multiaccess, nu mt route n t mt router, s l khng khn ngoan nu mt router qung b a ch ca n nh l a ch ngun v iu ny s dn n vic cc packets b gi n vi router trn mng multiacess trc khi c th tm ra c ngun gc xut pht tht s. V vy, c mt lut rng, a ch ca router xut pht gi tin BGP s vn gi nh a ch ngun. Khi BGP khai bo mt mng, router t nh r bn thn router nh l Next Hop. Tuy nhin, nu router gi thng ip update cho mt router lng ging khc trong cng mt AS th n li tip tc dng router ngoi AS lm Next hop. Do ta phi cu hnh cho cc router cn li trong AS bit c chnh router bin cng AS vi n l router Next Hop ch khng phi l router khc AS.

Bc 1: Router A gi cp nht v mng 192.33.33.0 Bc 2: Router D nhn update v truyn. Tuy nhin nu routerD thay i a ch source-address thnh a ch a ch ca chnh n, s c mt s nhm ln xy ra v trong mi trng multiaccess, mi router s cng b n l next-hop. trnh tnh hung ny, a ch ngun ca update khng thay i. Bc 3: Router B bit routerA l next-hop ca mng 192.33.33.0

The Next-Hop Attribute and a Nonbroadcast Multiaccess Network Cng ging nh trong mi trng multiaccess, mt mng NBMS cng tun theo cng mt qui lut. Tuy nhin s c tim n mt vn v cc router khc s khng c kh nng kt ni trc tip vi router ngun nu m my NBMA c cu hnh hub-and-spoke.

Thuc tnh Nexthopself trong BGP 150.10.0.0 (AS 100) RouterA--------(150.10.3.1)---IBGP--------RouterB---| |(170.10.20.1) | | (170.10.20.2) RouterC |_ 170.10.0.0 (AS 300) Thuc tnh BGP nexthop l mt a ch next hop IP m n s c dng i n mt s mng ch. i vi EBGP, next hop lun lun l a ch IP ca router lng ging c khai bo trong cu lnh neighbor. Theo v d trn, RouterC s qung co network 170.10.0.0 cho RouterA vi mt next hop l 170.10.20.2 v ngc li RouterA s qung co li 150.10.0.0 cho RouterC vi mt next hop l 170.10.20.1. i vi IBGP, c mt nguyn tc l: the next hop advertised by EBGP should be carried into IBGP. Chnh v quy lut ny, nn Router A s qung co li 170.10.0.0 cho cc IBGP peer ca n, trong trng hp ny l RouterB vi mt next hop l 170.10.20.2. V th, lc ny RouterB s c next hop i n network 170.10.0.0 s l 170.10.20.2 ch KHNG phi l 150.10.30.1 Lc ny th bn phi m bo rng RouterB c th reach 170.10.20.2 thng qua IGP, nu khng RouterB s drop nhng packet c dest. l 170.10.0.0 v lc ny a ch next hop address tr nn inaccessible. n y th bn hy hnh dung nu nh trong mi trng NBMA, v c thm mt RouterD (network 180.20.0.0) c thm vo trong AS 300, m RouterA khng c PVC kt ni trc tip n RouterD th lc ny nexthop ca RouterD qung co cho RouterA m RouterA s khng reach c. Lc ny routing s fail. khc phc tnh trng ny th NEXT-HOPE-SELF c s dng. neighbor {ip-address| peer-group-name1 } next-hop-self Cu lnh ny s cho php p t BGP dng a ch mnh khai bo thnh next hop thay v BGP

t chn next hop. RouterC# router bgp 300 neighbor 170.10.20.1 remote-as 100 neighbor 170.10.20.1 next-hop-self RouterC s qang co 180.20.0.0 vi NextHop = 170.10.20.2. Next-hop-self ch c li trong mi trng nonmeshed. Local-Preference attribute: y l thuc tnh khng bt buc (tc l khng cn phi xut hin trong thng ip Update), ch mang ngha cc b trong phm vi AS m khng bao gi gi ra khi AS . N c truyn n cc local BGP neighbors. Thuc tnh Local-Preference cho php chng ta chn con ng mong mun nht ra khi mt AS. Weight attribute: y cng l thuc tnh khng bt buc, cc nh cung cp khng cn phi h tr cho n. Thc t thuc tnh ch c cung cp cho mt b nh tuyn n v khng gi trong bt k thng ip Update no. Thuc tnh Weight c dng iu khin hng truyn cc local packet n router khi router c hai route khc nhau ra khi AS(multihomed). Thuc tnh MULTI_EXIT_DISC (MED) y l thuc tnh c AS dng tham chiu cho vic nn chn router no i n cng mt ch trong mt AS. Trong BGP cng c mt ATTRIBUTE c gi l metric, l MED (Multiexit Discrimination). Tuy nhin MED ny c ngha hi khc so vi metric trong cc IGP. BGP dng MED (metric) hng dn cho cc router lng ging la chn ng i tt nht. MED(multiple-exit-discriminator) l 1 attribute ca BGP, n gii thiu v nhng router lng ging bn ngoi v 1 mng c chn vo 1 AS c nhiu exit point, ci no c MED thp hn s c chn (do c l n ging vi metric), khng ging nh Local Preference, MED c trao i gia cc AS nhng n s khng ra khi AS nu n vo (khi 1 thng tin cp nht nh tuyn vo 1 AS vi gi tr MEd xc nh th n s c s dng thc hin quyt nh trong ni b AS .Nu 1 route xut pht t chnh AS th MED s c tnh theo metric ca IBGP. MED l mt attribute yu (trong th t route-selection ca BGP), nn control c n cn phi care c cc thuc tnh c mc u tin cao hn (weight-localpreference-originateASpath-origin code). Hn na, originated AS khng th iu khin qu trnh t MED trn cc originating AS (neighbor AS), hoc ngc li, nn him khi c dng trong thc t. Ngoi ra, vi nhiu Customer vi cc yu cu chnh sch chn outgoing traffic khc nhau, MED khng hiu qu. Ngi ta hay s dng community attribute gii quyt vn chn incomming traffic thay cho as-path prepending hoc MED.

Communtity attribute: y l mt thuc tnh khng bt buc. Thuc tnh ny c dng cung cp chnh sch cho mt nhm cc router i qua cc AS. Do cc router ny c cng mt tnh cht v c chung

chnh sch. Nu mt router nhn c mt thng ip Thng tin cp nht nh tuyn vi thuc tnh Community c thit lp,n s x l thng ip ny mt cch hp l. Nu n khng hiu thng ip ny th s gi thuc tnh cho router lng ging router x l. (Tuy nhin, nu n hiu th s khng bao gi gi thuc tnh cho lng ging router tr khi c ch nh lm thm iu g ).

Tng quan hot ng ca BGP BGP l mt giao thc hng kt ni. Khi thit lp mt quan h neighbor, mt phin lm vic TCP s c thit lp v duy tr. BGP s gi ra cc thng ip keepalive kim tra ng truyn v duy tr phin lm vic TCP ny. Cc thng ip keepalive ny ch l nhng header c gi tr 19-bytes. Sau cc router s gi cc cp nht nh k ch khi c thay i xy ra. Sau khi iu chnh bng BGP, qu trnh BGP s truyn n tt c cc lng ging cc thay i.

C 4 kiu thng ip c dng trong BGP:

Thng ip Open: c dng thit lp kt ni vi cc router BGP khc. Thng ip keepalive: c gi nh k gia cc BGP peers duy tr kt nI v kim tra ng i. Cc thng ip keepalive ny c gi theo c ch khng tin cy. Nu khong thi gian nh k c gn v bng 0, s khng c thng ip keepalive no c gi. Thng ip cp nht: cha cc ng i v cc a ch ch v cc thuc tnh ca ng i. Cc cp nht bao gm cc route khng cn tn ti. Thng tin cha trong cc cp nht bao gm cc thuc tnh v ng dn, bao gm thuc tnh origin, AS_PATH, neighbor. Thng ip Notification: c dng thng bo cho cc router khc v nhng nguyn nhn gy ra kt ni b ngt.

CIDR v Route Aggregation

BGP cn phi truyn mt s thng tin gia cc AS nhng c l khng phi tt c cc thng tin l cn thit. Nu h thng mng c thit k h tr qu trnh summarization, tng s ti nguyn mng s c gim i bi v c rt t b nh, bng thng v CPU c dng gi bng nh tuyn. Tht ra, bng cch tm tt cc lp a ch IANA, mng Internet s tr thnh mt mt mi trng nhanh hn v tin cy hn. Cch dng CIDR l mt trong nhng gii php c dng

nhiu trong nhng nm gn y. Cc a ch s c hp nht li thnh mt s a ch dng summary. Thay v mt a ch c mt gi tr netmask nhn ra phn a ch network, n s c mt gi tr prefix mask. Gi tr ny n gin l mt con s ch ra s bit dnh cho phn network. Qu trnh summarization s gim thiu s prefix. Nu mt mng c cp tm a ch lp C, n c th c qung b nh mt network.

BGP s truyn cc prefix v cc prefix mask. Mt router c th truyn route c tm tt, cc route ring l cha c summarize hoc truyn c hai.

C ch hot ng ca IBGP

IBGP khng thay i thuc tnh AS-PATH ca mt tuyn do chng loop, s dng qui lut split-horizon: mt BGP peer s khng gi cc tuyn c hc t IBGP n mt BGP peer khc.

Nh vy, c th forward d liu cho cc AS khc, cc router ca transit AS phi thc hin: - Gii php th nht: phn phi li cc tuyn BGP vo IGP tha mn qui lut ng b, nhng phng php ny khng nn s dng trong cc mng core ca ISP do s tuyn trn Internet rt ln, cc IGP c thit k khng phi c th qun l s tuyn qu ln nh vy, ngoi ra, nu dng phng php ny th khi c s thay i v 1 tuyn trn Internet s lm cc IGP phi thc hin gii thut tm ng -> chim nhiu CPU v b nh gy mt n nh. - Gii php th hai: cc BGP peer c full-mesh m bo cc router u c thng tin nh tuyn forward packet. Khi ny c th tt chc nng ng b ca IBGP. Nhng full-mesh dn n vic kh qun l, tn bng thng cp nht nh tuyn, tn CPU,mem. C 2 cch gii quyt vn ny. S dng Route Reflector: thay i qui lut split-horizon ca IBGP. Cc RR c th gi cc tuyn IBGP n cc BGP peer khc. chng lp vng, cc RR thm vo cc thuc tnh: cluster-id v originator. S dng Confederation: thay i cch x l AS-PATH ca IBGP: Chia mt AS thnh nhiu member-AS. BGP gia cc BGP peer thuc cc member-AS khc nhau s l EBGP (tc l s thm member-AS vo AS-PATH chng loop) nhng cc thuc tnh khc nh Local Preference, MED, Next-hop s khng thay i. u im ca gii php ny l cc member-AS c th c qun l c lp, tng kh nng chnh sch nh tuyn routing. Cc member-AS c th s dng cc IGP khc nhau. Nhng qun l mt Confederation th c th s rt phc tp do n ch thch hp cho cc ISP cc ln (cc ISP kt ni trc tip vo cc im trung chuyn quc t nh NAP,...) hoc cc cng ty a quc gia cn c s linh ng v c lp gia cc thnh phn ca h thng. la chn tuyn cho cc Incoming traffic, c th s dng cc cch sau. S dng thuc tnh MED: cch ny t s dng do MED l mt thuc tnh yu v non-transitive. S dng community: phng php ny i hi phi c upstream ISP h tr, ch nh hng n ISP trc tip, trong nhiu trng hp khng lm vic tt. S dng ASPrepend: phng php ny c s dng thng dng hn do c th lm vic tt trong tt c cc m hnh. Nhng mt iu cn phi nh, quyt nh tuyn cho Incoming traffic rt kh thc hin chnh xc do cc AS khc c th thay i cc attribute.

set metric, bn c th dng lnh default-metric Router(config-router)#default-metric number hoc c th dng route-map: router bgp 100 neighbor 1.1.1.1 route-map freddy out ! ip as-path access-list 1 permit ^690_ ip as-path access-list 2 permit .* ! route-map freddy permit 10 match as-path 1 set metric 127 !

route-map freddy permit 20 match as-path 2 trong v d trn, cc route as 690 s c set metric l 127.

Tm tt gii thut tm ng i tt nht ca BGP.

BGP s gn ng i hp l u tin nh l ng i tt nht hin c. Sau BGP s so snh ng i tt nht ny vI ng i k tip trong danh sch cho n khi no hon tt tt c cc ng trong danh sch cc ng i hp l. DI y l danh sch cc lut c dng xc nh ng i tt nht. * u tin ng i c trng s WEIGHT cao nht. WEIGHT l mt thng s do Cisco a ra. Thng s ny ch c nh hng trong phm vi ni b ca router c cu hnh dng thng s ny. * u tin ng i c LOCAL_PREF cao nht. Nhng ng i khng c thuc tnh LOCAL_PREF s c gi tr mc nh l 100. * u tin nhng ng i c ngun gc t lnh network hoc lnh aggregate hoc thng qua qu trnh redistribution t mt IGP. Cc ng i c ngun gc t lnh network hoc lnh redistribution c u tin hn nhng ng i c ngun gc t lnh aggregate. * u tin nhng ng i c thuc tnh AS_PATH ngn nht. Bc ny s b b qua nu bin bgp bestpath as-path c cu hnh. Mt tp hp AS_SET s c m t 1, bt chp c bao nhiu AS bn trong tp hp. Cc bin AS_CONFED_SEQUENCE v AS_CONFED_SET s khng bao gm trong AS_PATH. * u tin cc ng i c ngun gc thp nht. IGP th thp hp EGP v EGP th thp hn INCOMPLETE. * u tin nhng ng i c gi tr MED nh nht. S so snh ny ch c thc hin nu AS u tin l ging nhau cho c hai ng i. Bt c mt AS con no ca confederation s b b qua. Ni cch khc, MED c so snh ch nu gi tr AS u tin trong AS_SEQUENCE l ging nhau. Nu lnh bgp always-compare-med c cu hnh, MED c so snh cho tt c cc ng i c th. Nu dng chn la ny, tt c cc router trong AS phI c cu hnh vI chn la bgp always-compare-med, nu khng routing loop s xy ra. Nu thng s bgp bestpath med-confed c cu hnh, MED s c so snh trn tt c cc ng i m ch cha bin AS_CONFED_SEQUENCE ( l nhng ng i xut pht t local confederation). Nhng ng i c nhn t mt router lng ging c gi tr MED l 4,294,967,295 s c gi tr MED thay I n 4,294,967,294 trc khi c chn vo bng BGP. Nhng ng i c nhn m khng c MED c cu hnh s c gn gi tr MED bng 0.

* u tin nhng ng i eBGP so vI iBGP. Nu ng i tt nht c chn la, qua bc 9. * u tin nhng ng i c IGP metric thp nht n BGP next-hop. * Kim tra xem c nhiu ng i d phng cn phi ci t vo bng routing hay khng. Nu c hai ng i l t bn ngoi, u tin ng i c nhn trc (ng i c nht). Bc ny s b b qua nu -Lnh bgp best path compare-routerid c dng -RouterID l ging nhau cho nhiu ng i v cc routes c nhn t cng 1 router. -Hin ti khng c mt ng i tt nht. * u tin nhng ng i n t BGP router c routerID nh nht. Gi tr routerID l a ch IP cao nht trn router. Gi tr ny cng c th c gn bng lnh bgp router-id. Nu mt ng i cha 1 route-reflector, thuc tnh Originator ID ca Route-Reflector s thay th cho routerID. * Nu RouterID l ging nhau cho nhiu ng i, u tin ng i c s cluster l t nht. iu ny ch ng trong mi trng BGP route-reflector. N cho php nhng thnh vin trong RouteReflector thit lp quan h peer vI cc thnh vin trong cc RR khc. * u tin nhng ng i n t nhng lng ging c a ch thp nht. a ch ny l a ch c dng trong lnh neighbor.