Está en la página 1de 67

LI CM N Trc ht ti xin by t lng bit n chn thnh n Th.s..

, ngi tn tnh hng dn, gip v to iu kin thun li cho ti trong thi gian thc hin ti. Xin gi li cm n chn thnh, lng bit n su sc ti cc thy c, b m v tt c cc bn trong khoa .. tn tnh gip , ng vin v to iu kin ti thc hin tt ti ny. Mc d ht sc c gng xong chc chn khng trnh khi nhng thiu st. Em rt mong nhn c s thng cm v ch bo tn tnh ca qu thy c, cc anh ch v tt c cc bn.

MC LC

LI CM N....................................................................................................................1 CC THUT NG TING ANH....................................................................................3 Li gii thiu.....................................................................................................................4 CHNG 1.......................................................................................................................5 GII THIU TNG QUAN V GIAO THC BGP.......................................................5 1.1 Gii thiu. .............................................................................................5 1.2 S dng BGP trong nh tuyn................................................................................5 CHNG 2.......................................................................................................................7 CC THUC TNH V THUT NG S DNG TRONG BGP................................7 2.1 nh ngha Autonomous System (AS) .................................................................8 2.2 Thuc tnh Autonomous system path (AS_PATH).................................................9 2.3 Thuc tnh WEIGHT.............................................................................................11 2.4 Thuc tnh Local Preference (LOCAL_PREF).....................................................13 2.5 Thuc tnh Metric hay MULTI_EXIT_DISC (MED)...........................................14 2.6 Thuc tnh ORIGIN...............................................................................................15 2.7 Thuc tnh NEXT_HOP........................................................................................15 2.8 Thuc tnh Community..........................................................................................17 CHNG 3.....................................................................................................................18 HOT NG CA BGP...............................................................................................18 3.1 Hot ng ca EBGP ..........................................................................................18 3.1.1 Kho st hot ng ca EBGP......................................................................18 3.1.2 Cu trc thng bo ca BGP..........................................................................19 3.2 Qung b tuyn trong BGP...................................................................................25 3.2.1 Qung b tuyn s dng cu lnh Network....................................................26 3.2.2 Qung b tuyn s dng redistribute..............................................................32 3.3 Hot ng ca IBGP .............................................................................................36 3.3.1 Kho st hot ng ca IBGP....................................................................36 3.3.2 Giao din loopback trong IBGP..............................................................45 3.3.3 Route-Reflector (RR)......................................................................................49 3.3.4 Phn cp nh tuyn trong cc AS (Confederations)....................................54 3.4 Gii thut nh tuyn trong BGP...........................................................................56 3.5 S tm tt tuyn trong BGP...................................................................................58 3.6 Qun l lu lng trong BGP ................................................................................63 KT LUN.....................................................................................................................65 TI LIU THAM KHO...............................................................................................67

CC THUT NG TING ANH AGGREGATE AS_PATH ATTRIBUTE AUTONOMOUS SYSTEM BORDER GATEWAY PROTOCOL COMMUNITY CONFEDERATION EBGP EGPs IBGP IGPs LOCAL_PREF MED NEXT_HOP ORIGIN OSPF RIP ROUTE_REFLECTOR ROUTE_REFLECTOR_CLIENT ROUTE_REFLECTOR_CLUSTER WEIGHT Qu trnh tm tt tuyn Thuc tnh AS_PATH Thuc tnh Vng t tr Giao thc BGP Thuc tnh COMMUNITY S phn chia AS nhm gim s tuyn Giao thc BGP chy gia cc AS Cc giao thc s dng gia cc AS Giao thc BGP chy trn mt AS Cc giao thc s dng trong mt AS Thuc tnh LOCAL_PREF Thuc tnh MED Thuc tnh NEXT_HOP Thuc tnh ORIGIN Giao thc nh tuyn OSPF Giao thc nh tuyn RIP Phn x tuyn nhm lm gim s tuyn trong BGP Router c mt phin TCP vi mt router khc hot ng nh mt route-reflectorserver Mt cluster l mt nhm bao gm routereflector v clients Thuc tnh WEIGHT

Li gii thiu Chng ta ang sng trong th k 21, k nguyn ca khoa hc k thut v cng ngh hin i. Vo thi im ny, ngnh cng nghip cng ngh thng tin v chic my vi tnh nm gi mt vai tr khng th thiu trong mi lnh vc hot ng ca con ngi. Mt chic my tnh bn hot ng c lp l khng , con ngi mun lin kt cc my tnh li vi nhau thnh mng my tnh tn dng sc mnh x l, trao i thng tin v chia s ti nguyn. Khi mng my tnh tng ln c v quy m v s lng, con ngi li mun lin kt cc mng my tnh ny li vi nhau. Lm th no lin kt cc my tnh li vi nhau? Lm th no thng tin c th c trao i gia cc mng my tnh cch nhau hng trm cy s? Mt bi ton cn c gii tr li nhng cu hi trn, l bi ton nh tuyn. nh tuyn hiu n gin l tm ng i. Trong truyn thng my tnh nh tuyn ngha l ch ra ng i thng tin c th di chuyn t ngun n ch theo cch tt nht. Khng th ph nhn tm quan trng ca nh tuyn trong truyn thng my tnh. Khng c nh tuyn, cc my tnh khng th trao i thng tin vi cc mng khc. Thit b thc hin chc nng nh tuyn trn mng ch yu l cc Router. c th thc hin chc nng nh tuyn, cc Router phi trao i thng tin v tuyn vi nhau xy dng nn cc tuyn ng. Tp hp cc qui tc trao i thng tin nh tuyn gia cc thit b nh tuyn vi nhau gi l giao thc nh tuyn. i tng nghin cu ca ti ny l giao thc nh tuyn BGP (Border Gateway Protocol) giao thc c s dng ht sc rng ri trn mng Internet hin nay. Mc ch ca ti l tm hiu hot ng ca giao thc nh tuyn BGP v cch thc trin khai giao thc nh tuyn BGP trn cc Router. Do nhng hn ch v mt thi gian v thit b, mt s ni dung lin quan khng c a vo ti nh: S hot ng v trin khai BGP trn IPv6. Mc d ht sc c gng xong ti khng trnh khi nhng thiu st v vy rt mong nhn c kin ng gp, s ch bo tn tnh ca cc thy c v tt c cc bn.

CHNG 1 GII THIU TNG QUAN V GIAO THC BGP 1.1 Gii thiu. BGP, vit tt ca t ting Anh Border Gateway Protocol, l giao thc nh tuyn nng ct trn Internet. N hot ng da trn vic cp nht mt bng cha cc a ch mng v cho bit mi lin kt gia cc h t tr. BGP l giao thc vector ng i (path vector). Khc vi cc giao thc nh tuyn khc nh RIP (vector di), OSPF (trng thi lin kt), BGP nh tuyn bng mt tp cc chnh sch v lut. Phin bn BGP hin nay l phin bn 4, da trn RFC 4271. BGP h tr nh tuyn lin vng phi lp (CIDR Classless Inter-Domain Routing) v dng k thut kt hp tuyn gim kch thc bng nh tuyn (v d nu mt mng chim 255 a ch lp C t 203.162.0.0/24 203.162.254.0/24 th ch dng 1 a ch 203.162.0.0/16 nh danh mng). Ngoi vic s dng BGP gia cc AS, BGP cng c th c s dng trong cc mng ring quy m ln do OSPF khng p ng c. Mt l do khc l dng BGP h tr kt ni n nhiu nh cung cp dch v. a s ngi s dng Internet thng khng s dng BGP mt cch trc tip. Ch c cc nh cung cp dch v Internet s dng BGP trao i ng i. BGP l mt trong nhng giao thc quan trng nht m bo tnh kt ni ca Internet. Nh ni trn 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. BGP l giao thc khng ch tm ra mt tuyn i v mt mng no m cn cho php ngi qun tr tm ra cc AS ca cc mng. Cc giao thc nh EIGRP, RIP, OSPF v ISIS s tm ra tuyn m ngi qun tr cn. 1.2 S dng BGP trong nh tuyn La chn giao thc nh tuyn ph hp cho mt mng l vic quan trng v ng gp vo s n nh ca h thng. Khi quyt nh s dng BGP cho vic nh tuyn ngi qun tr cn gii p c mt s cu hi ht sc cn thit

Cu hi u tin cn c cc nh qun tr t ra l: S dng BGP cho vic nh tuyn khi no ? Mt h thng mng n gin l mt h thng mng d dng qun l v bo tr. Mc d BGP l giao thc phc tp tuy nhin cc trng hp di y c khuyn co cho vic s dng giao thc BGP nh tuyn : - Mt AS cho php chuyn tip gi tin qua n n cc AS khc - Mt AS c nhiu kt ni n AS khc - Lu lng thng tin vo ra trn AS cn c x l Cc khuyn co trn c rt ra t cc c tnh m BGP s dng nh tuyn. Cc c tnh s c trnh by k chng sau. trnh vic s dng khng hiu qu giao thc nh tuyn BGP cu hi th hai m cc nh qun tr cn quan tm l: Khng nn s dng BGP cho vic nh tuyn khi no? BGP l mt giao thc kh phc tp v c s dng trn internet v trong cc cng ty ln. V l d BGP c khuyn co l khng nn s dng khi tn ti mt trong cc iu kin di y : - Ch c mt kt ni n n Internet hoc n AS khc - Chnh sch nh tuyn v la chn tuyn khng lin quan g n AS ca ngi s dng - Ti nguyn mng l c gii hn: ti nguyn v b nh v kh nng x l ca CPU trn router. - Qun tr mng thiu kinh nghim, hiu bit i vi giao thc BGP trong vic chn, lc tuyn - Bng thng gia cc AS l thp v cc ph tn cho nh tuyn s nh hng n qu trnh chuyn d liu. Gii php x l vn khi khng s dng BGP nh tuyn l s dng tuyn tnh (static route) Vic tr li tt hai cu hi trn s gp phn gip cho cc nh qun tr la chn v s dng hiu qu giao thc BGP trong vic nh tuyn cho h thng mng ca mnh

CHNG 2 CC THUC TNH V THUT NG S DNG TRONG BGP Cc giao thc nh tuyn IGPs qung b mt mng vi cc tham s nh tuyn: metric,cost. Mi giao thc IGPs c mt tham s la chn tuyn ng ti ch khc nhau (RIP s dng m s hop, OSPF s dng tham s cost = 100000000/BW). Nu c nhiu ng dn n ch vi metric hoc cost khc nhau th ng dn vi metric hoc cost thp nht phi c la chn. BGP khng phi l giao thc ngoi l v cng cn cc tham s la chn tuyn tt nht n ch. Cc tham s trong BGP c gi l thuc tnh (Attributes). BGP nh tuyn 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 tuyn 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 nh tuyn da trn nhng thuc tnh v cc gi tr ca n. Cc thuc tnh c chia thnh 4 nhm: nhm well-known mandatory , well-known discretionary, optional transitive v optional nontrasitive. Cc thuc tnh c m t k trong bng di y : M T Cc thuc tnh ny l bt buc v c cng nhn bi tt c Well-known mandatory cc router BGP Khng yu cu cc thuc tnh ny tn ti trong cc cp nht Well-known Discretionary 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. 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 Optional Transitive 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. Cc thuc tnh ny b loi b nu cp nht mang thuc tnh ny i vo router m router khng hiu hoc khng cng Optional Nontransitive nhn thuc tnh. Cc thuc tnh ny s khng truyn ti cc BGP. Nhm

Bn nhm trn m t mt cch tng qut cc thuc tnh ca BGP. ng vi mi nhm ta s i su nghin cu cc c tnh c th ca tng loi thuc tnh trong nhm .
Attribute Name Attribute Type Description

AS_PATH WEIGHT LOCAL_PREF MULTI_EXIT_DISC ORIGIN

Well-known mandatory Cisco defined attribute Well-known discretionary Optional nontransitive Well-known mandatory

Danh sch cc AS m tuyn c qung b thng qua n c s dng nh tuyn trong BGP c s dng chn tuyn, thng c s dng trong mt AS c s dng chn tuyn, thng c s dng gia cc AS Ch ra cc tuyn BGP c hc nh th no IGP T cu lnh Network EGP T EBGP hng xm Incomplete T redistribution
EBGP a ch

NEXT_HOP

Well-known mandatory

ca giao din c s dng truyn thng vi hng xm bn khc IBGP EBGP next hop c gi v khng thay i khi ti cc IBGP hng xm.

Community

Optional transitive Mt s c s dng cho vic p mt chnh sch n mt nhm cc tuyn.

2.1 nh ngha Autonomous System (AS) L mt tp hp cc mng c cng chnh sch nh tuyn v thng thuc quyn qun l, khai thc ca mt ch th. Mi nh cung cp dch v internet (ISP) c th coi l mt AS. Vic kt ni gia cc AS ny thng c s dng BGP

Hnh 1: Kt ni gia cc AS 2.2 Thuc tnh Autonomous system path (AS_PATH) Thuc tnh ny c s dng cho vic chn tuyn v chng loop trong BGP. AS_PATH thuc vo nhm well-known mandatory, cn c qung b v hiu bi tt c cc router hng xm. Mi nh cung cp dch v u c gn mt s nh danh duy nht autonomous system (AS) trong khong t 1 n 64511. Cc s AS ny c ng k v gn tng t nh vic cung cp cc di a ch IP . Cc nh cung cp dch v cng c th nh ngha cc vng t tr AS bng cch s dng cc s AS ring c phm vi cho php trong khong 64512 n 65534. Tuy nhin cc s AS ring ny khng c qung b ra internet v ch c s dng trong vng AS to ra n. Cc AS ring tng t nh a ch IP ring Chng ta xt mt v d di y vi cc nh cung cp dch v c gn cc s AS 1, 2, 3 v 4. Nh cung cp dch v vi AS bng 1 qung b mng v netmask ca mng 156.26.32.0/24 n nh cung cp dch v 2 vi AS l 2.

Hnh 2: thuc tnh AS_PATH

Khi tuyn c qung b c nhn bi AS 2, AS 2 bit mng 156.26.32.0 nm trong AS 1 bi v ch c 1 s AS duy nht nm trong thuc tnh AS_PATH v c t bng 1. Khi AS 2 qung b tuyn 156.26.32.0/24 n AS 3, AS 2 s c b xung v c t vo AS_PATH. Kt qu sau khi nhn c qung b t AS 2 thuc tnh AS_PATH s c gi tr l 2 1 vi du cch gia cc s AS. AS 3 cng bit rng mng c qung b nm trong AS 1 (do s cui trong thuc tnh AS_PATH c t bng 1 ) v mng c qung b thng qua AS 2. AS 3 b xung s AS ca n vo thuc tnh AS_PATH v qung b tuyn n AS 4. AS 4 nhn thuc tnh qung b vi AS_PATH l 3 2 1 cho mng 156.26.32.0/24 Nu tt c c thuc tnh khc ca BGP l bng nhau, router vi AS_PATH ngn nht s c s dng lm tham s la chn tuyn. Trong v d trn ta ch qung b cho mng 156.26.32.0/24 v mc nh n s c ng dn ti u n ch. Nu c nhiu tuyn, thuc tnh AS_PATH s c s dng la chn tuyn tt nht ti ch. Di y l mt v d. Trong hnh 3, AS 4 nhn 2 s qung b cho mng 156.26.32.0/24. Qung b t AS 3 c di AS l 3 v t AS 5 c di l 2. V th AS 4 ch quan tm n tuyn thng qua AS 5 v la chn n l tuyn tt nht n ch. Tuyn tt nht ny s c t trong bng nh tuyn.

Hnh 3: La chn tuyn thng qua thuc tnh AS_PATH AS_PATH l danh sch cc s AS c qung b . Tham s ny tng t vic m s hop trong RIP v s AS cng c s dng quyt nh tuyn tt nht n ch (tng t nh hop count). Ngoi vic AS_PATH c s dng cho vic la chn tuyn tt nht n ch. BGP cn s dng thuc tnh AS_PATH chng loop.

10

Trong hnh 4, AS 4 qung b tuyn tt nht cho mng 156.26.32.0/24 n AS 6. AS 6 qung b tuyn ny n AS 1 vi AS_PATH l 6 4 5 1 . Khi AS 1 nhn qung b t AS 6 tuyn ny s b t chi v AS 1 nm trong AS_PATH. Cc BGP routers t chi bt k s qung b no m cha ng s AS ca chng.

Hnh 4: BGP chng loop s dng thuc tinh AS_PATH 2.3 Thuc tnh WEIGHT Weight l thuc tnh khng c ch nh trong BGP . N l thuc tnh c bit c pht trin trn cc thit b ca cisco v l thuc tnh do cisco nh ngha. Tham s ny cng l mt trong cc thuc tnh c s dng quyt nh tuyn tt nht ti ch. Trong hnh 5, AS 2 nhn 2 s qung b cho mng 156.26.32.0/24. Qung b t AS 3 c AS_PATH di l 3 v qung b t AS 1 c di l 2. AS 2 s la chn tuyn thng qua AS 1 v qua AS_PATH s l ngn nht.

11

Hnh 5 : AS 2 la chn ng n 156.26.32.0/24 thng qua AS 1 v n c thuc tnh AS_PATH tt nht Tuy nhin nu mun router trong AS 2 s dng tuyn thng qua AS 3 thay th cho AS 1 ta s dng thuc tnh weight. Weight l thuc tnh c biu din bng 16 bit v gi tr trong khong 0 n 65535. Router c s dng thuc tnh Weight ch nh tuyn ti ch. Vic la chn ny thng c s dng khi c nhiu ng dn tt nht n cng 1 ch. Trng s Weight s c u tin hn

Hinh 6 : Chn tuyn thng qua thuc tnh weight

12

Thuc tnh weight ch c gi tr trn router v khng qung b ra cc router hng xm chy BGP. Cc tuyn BGP c weight mc nh l 32768 2.4 Thuc tnh Local Preference (LOCAL_PREF) LOCAL_PREF l thuc tnh tng t nh weight. Khi c nhiu hn mt tuyn ti mt ch, tuyn c thuc tnh LOCAL_PREF cao nht (khi cc weight bng nhau) s c la chn l tuyn tt nht. Mc nh LOCAL_PREF c gi tr 100 v gi tr cao hn s c u tin s dng l tham s quyt nh tuyn ti ch (khi weight bng nhau). LOCAL_PREF l mt s 32 bit c gi tr t 0 4294967295. Trong hnh 7, Router A v Router B c 2 ng n mng 156.26.32.0/24. Router A s dng gi tr LOCAL_PREF mc nh l 100. Router B c thit lp gi tr LOCAL_PREF l 200 v th Router B s la chn tuyn qua AS 3. Khng ging nh thuc tnh weight LOCAL_PREF c qung b trong 1 AS. Router A nhn qung b cho mng 156.26.32.0/24 t Router B vi LOCAL_PREF l 200. V th Router A s dng tuyn thng qua AS 3 t ti mng 156.26.32.0/24

Hnh 7: Thuc tnh LOCAL_PREF

13

2.5 Thuc tnh Metric hay MULTI_EXIT_DISC (MED) Thuc tnh Weight c s dng quyt nh tuyn t mt router. LOCAL_PREF c s dng la chn tuyn ri khi 1 autonomous system. Thuc tnh MULTI_EXIT_DISC (Multi-exit discriminator hay MED) c s dng quyt nh tuyn gia cc AS. MED cng l mt s c gi tr 32 bit tuy nhin thuc tnh ny c mt im khc bit vi thuc tnh LOCAL_PREF l gi tr thp hn s c u tin thay v gi tr cao s c u tin chn tuyn nh trong LOCAL_PREF. Di y l mt v d ch ra vic la chn tuyn dng MED. Trong Hnh 8, AS 5 qung b mng 156.26.32.0/24 v c 2 ng ti c mng 156.26.32.0/24 t AS 1. AS 5 mun AS 1 s dng tuyn bn phi cho lu lng t AS 1 n AS 5. AS 5 thit lp MED bn tri c gi tr cao hn gi tr mc nh l 0 v qung b gi tr ny n AS 1

Hnh 8 : S dng thuc tnh MED chn tuyn Nu tt c cc thuc tnh khc ca BGP l bng nhau. AS 1 s la chn tuyn bn phi n AS 5 v n c gi tr MED thp hn. u tin ca cc thuc tnh trong BGP c quyt nh ln lt l WEIGHT, LOCAL_PREF,AS_PATH v cui cng l MED. Khi 3 tham s trn l bng nhau MED s c s dng chn tuyn tt nht n ch

14

2.6 Thuc tnh ORIGIN Thuc tnh ORIGIN ch ra kiu ti nguyn ca BGP trong bng BGP routing. C ba cch gip cho BGP c th hc tuyn, trong cc thit b ca cisco ba cch l : S dng cu lnh network T EBGP hng xm Thng qua redistribution Cu lnh network c s dng qung b tuyn trong bng nh tuyn n cc BGP hng xm. Cc tuyn hc c thng qua cu lnh network c thuc tnh ORIGIN t l IGP v ch ra rng tuyn l tuyn nm trong cng AS. C hai kiu kt ni BGP. Kiu th nht l kiu kt ni gia c router chy BGP trong cng 1 AS. Kiu ny c gi l Internal BGP (IBGP). Kiu kt ni th 2 l kiu kt ni gia cc autonomous-system khc nhau. Kiu ny c gi l External BGP (EBGP)

Hnh 9 : Cc tuyn IBGP v EBGP Cc tuyn c hc t EBGP hng xm c thuc tnh ORIGIN l EGP. Cc tuyn redistributed trong BGP c thuc tnh ORIGIN l incomplete. Cc tuyn IGP c u tin thng qua cc tuyn EGP v cc tuyn EGP c u tin thng cc cc tuyn incomplete. Ni cch khc cc tuyn EBGP c u tin, s dng thng qua cc tuyn IBGP 2.7 Thuc tnh NEXT_HOP Khi mt router qung b mt tuyn n router EBGP hng xm, thuc tnh NEXT_HOP c t l a ch IP ca giao din kt ni n hng xm . c bit nu router qung b mt tuyn c hc thng qua EBGP n IBGP hng xm, thuc tnh NEXT_HOP s khng c thay i.

15

Hnh 10 : Thuc tnh NEXT_HOP Khi mt router nhn mt tuyn t mt BGP hng xm, thuc tnh u tin n kiu tra l NEXT_HOP. Nu NEXT_HOP khng t c ( khng nm trong bng nh tuyn), tuyn s b t chi. EBGP s dng kt ni vt l trc tip trn cc giao din vt l v th NEXT_HOP s c t trong bng routing ging nh giao din kt ni trc tip. Cc IBGP hng xm khng c kt ni trc tip. Trong v d hnh 10 router B chp nhn tuyn t router A v NEXT_HOP l mng kt ni trc tip vi n. Router C s chp nhn tuyn t router B nu mng NEXT_HOP c trong bng nh tuyn ca router C. 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 hng xm 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.

Hnh 11: Hot ng ca router vi thuc tnh NEXT_HOP

16

Xt v d hot ng ca router vi thuc tnh NEXT_HOP trong hnh 11 Bc 1: Router A gi cp nht v mng 192.33.33.0 Bc 2: Router D nhn update v truyn. Tuy nhin nu router D thay i a ch ngun thnh a ch ca chnh n, s c mt s nhm ln xy ra v trong mi trng a truy cp, mi router s cng b n l NEXT_HOP. trnh tnh hung ny, a ch ngun ca thng tin cp nht tuyn khng thay i. Bc 3: Router B bit router A l NEXT_HOP ca mng 192.33.33.0 Do tnh cht ny m bt buc cc IBGP hng xm phi c tuyn n mng NEXT_HOP trong bng nh tuyn 2.8 Thuc tnh Community 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 hng xm x l. (Tuy nhin, nu n hiu th s khng bao gi gi thuc tnh cho router hng xm tr khi c ch nh lm thm iu g ).

17

CHNG 3 HOT NG CA BGP 3.1 Hot ng ca EBGP 3.1.1 Kho st hot ng ca EBGP Cc router BGP ( EBGP ) l hng xm ca nhau c kt ni trc tip. Chng ta c th thit lp cu hnh gia cc router A v B v kim tra s hot ng gia cc router . Xt s hot ng ca 2 router di y :

Hnh 12: Cu hnh hot ng EBGP Trc tin chng ta s thit lp cc giao din loopback trn cc router. Ging nh trong OSPF a ch IP c gn trn giao din loopback c s dng nh l ID ca cc router chy BGP
Router A interface Loopback0 ip address 172.16.15.254 255.255.255.255 Router B interface Loopback0 ip address 172.16.16.254 255.255.255.255

Cc cu lnh trn gip thit lp a ch IP trn giao din loopback. Bc tip theo l
bc quan trng v cho php khi to mt qu trnh BGP trn cc router.

18

Router A router bgp 1 neighbor 172.16.15.162 remote-as 2 Router B router bgp 2 neighbor 172.16.15.161 remote-as 1

Cc cu lnh router bgp as-number cho php thc thi mt tin trnh BGP trn router. Ch mt s AS c th c gn ti nh cung cp dch v, v th ch mt tin trnh BGP c thit lp trn mt router. Cu lnh neighbor neighbor-ip-address cho php BGP hot ng trn giao din . Giao din chy BGP c quyt nh bi bng IP routing. Bng ny quyt nh giao din c s dng c th t ti c a ch IP ca hng xm. Vi EBGP cc hng xm c kt ni trc tip vi nhau v th giao din c s dng ch c mt kt ni trc tip n hng xm ca n. 3.1.2 Cu trc thng bo ca BGP Cc giao thc RIP, IGRP, EIGRP v OSPF s dng cu lnh network thc hin cu hnh cho php nh tuyn, qung b mng, netmask. Ngoi ra n cn cho php cc giao thc IGPs khm ph, nhn bit cc router hng xm. Tuy nhin vi EBGP do ch r cc router hng xm nn khng cn phi c bc tm, nhn bit hng xm nh cc giao thc IGPs na. V th c th thit lp mt mi quan h hng xm m khng cn qung b bt k tuyn no . Khi EBGP c cho php chy trn mt giao din, cc router s c gng thc hin mt tin trnh thit lp mi quan h theo cc bc di y : Idle State: trng thi ny router s khi to mt kt ni TCP vi BGP hng xm Connect State : Giai on ny router khi to s ch cho kt ni TCP c thc hin vi router BGP hng xm. Nu mt kt ni TCP c thc hin , router s gi mt thng bo OPEN v chuyn sang trng thi OpenSent. Nu ht thi gian ch router vn khng thit lp c kt ni n s chuyn tip sang trng thi Active

Active State: giai on ny router vn ch cho mt kt ni c thc hin vi router hng xm. Nu kt ni c thc hin n s chuyn sang trng thi Connect

19

OpenSent State : giai on ny router s ch mt thng bo OPEN t BGP hng xm. Nu xy ra li n s chuyn sang ch Idle State. Nu mt thng bo OPEN c nhn t router BGP hng xm th n s chuyn sang trng thi OpenConfirm.

OpenConfirm State: Giai on ny router ch mt thng bo KEEPALIVE t BGP hng xm. Khi mt KEEPALIVE c nhn n s chuyn sang trng thi Established.

Established State: Giai on ny cc router s trao i thng tin nh tuyn vi nhau nh dng chung phn tiu ca thng bo BGP bao gm cc trng thng tin sau : trng nh du 16 byte, trng di 2 byte v trng kiu 1 byte.

Hnh 13: nh dng chung phn tiu ca thng boBGP Ty tng kiu thng bo m c th c hoc khng c phn d liu sau phn tiu . V d thng bo KEEPALIVE khng cha d liu m ch cha phn tiu - Trng nh du (Marker field): Trng ny c di 16 byte c s dng cho mc ch chng thc cc thng bo BGP n hoc d tm s mt ng b gia 2 hng xm. Trng ny c th c 1 hoc 2 dng : + Nu kiu thng bo ca BGP l OPEN hoc OPEN khng s dng chng thc th trng nh du ny phi c t tt c bng 1 + Ngc li trng ny s c t da vo vic tnh ton cc k thut s dng chng thc

20

- Trng di length (length field): Trng ny c di 2 byte ch ra tng di ca thng bo BGP bao gm c phn tiu . V th trong BGP di ti thiu ca 1 thng bo l 19 byte (16 + 2 + 1) v ti a khng ln hn 4096 byte. - Trng kiu : Trng ny c di mt byte cho php biu din cc kiu thng bo trong giao thc BGP. Cc kiu thng bo l OPEN, UPDATE, KEEPALIVE, NOTIFICATION. Cc thng bo c th trong cc giai on nh sau : Trong giai on Connection, mt router BGP gi mt thng bo OPEN n router hng xm. Thng bo OPEN nh danh router vi hng xm. Ngoi ra thng bo OPEN cn gip cho cc router thc hin qu trao i cc tham s di y :
-

S phin bn (version number): Phin bn BGP hin ti l 4 S AS (AS number)

Hold time :thi gian mt BGP router s ch trc khi khai bo rng hng xm mt lin kt
-

BGP router ID Opt parm len: Trng ny ch ra di ca trng Optional parameters

Trng Optional parameters: Trng ny ch ra danh sch cc tham s c s dng cc hng xm tha thun phin BGP vi nhau

Hnh 14: Thng bo OPEN Sau khi BGP router gi mt thng bo OPEN ti hng xm ca n, router s chuyn sang trng thi OpenSent v ch nhn mt thng bo OPEN t hng xm. Khi

21

router nhn c thng bo OPEN t hng xm Router s chuyn tip sang trng thi OpenConfirm State, v ch mt thng bo KEEPALIVE . Mc nh KEEPALIVE c gi 60s v c s dng xc nhn trng thi ca router. Sau khi nhn c KEEPALIVE router s chuyn sang trng thi Established v trao i KEEPALIVE, UPDATE v thng bo NOTIFICATION. Mt thng bo NOTIFICATION c s dng khi c li xut hin khin cho phin BGP kt thc. Trong qu trnh thc hin BGP c th c nhiu li xy ra Thng bo NOTIFICATION c nh dng nh sau:

Hnh 15 : Thng bo NOTIFICATION Trong cc trng c m t trong bng di y : Error Code 1Message header error Cc m li ca BGP Error Subcode 1Connection Not Synchronized 2Bad Message Length 3Bad Message Type

2OPEN message error

1Unsupported Version Number 2Bad Peer AS 3Bad BGP Identifier 4Unsupported Optional Parameter 5Authentication Failure 6Unacceptable Hold Timer 7Unsupported Capability

22

3UPDATE message error

1Malformed Attribute List 2Unrecognized Well-Known Attribute 3Missing Well-Known Attribute 4Attribute Flags Error 5Attribute Length Error 6Invalid Origin Attribute 7AS Routing Loop 8Invalid NEXT_HOP Attribute 9Optional Attribute Error 10Invalid Network Field 11Malformed AS_PATH

4Hold Timer expired 5Finite State Machine error 6Cease (for fatal errors

N/A N/A N/A

Mt thng bo UPDATE qung b mng ang c. Thng bo UPDATE s qung b: - Cc thng tin lin quan n mng ch: a ch, netmask..
-

Cc thuc tnh BGP Cc tuyn khng c kh nng thc hin nh tuyn v b loi b trong bng

routing

Thng bo UPDATE c cu trc nh sau :

23

Hinh 16: Thng bo UPDATE Khi cc EBGP hng xm t c trng thi Established qu trnh trao i thng tin nh tuyn s c thc hin. Khi ta s thy c trng thi ca router c dng nh sau :
A#show ip bgp neighbors BGP neighbor is 172.16.15.162, remote AS 2, external link BGP version 4, remote router ID 172.16.16.254 BGP state = Established, up for 02:02:11 !Output omitted for brevity

24

3.2 Qung b tuyn trong BGP Cc EBGP hng xm khi t c trng thi Estabished cng c th khng qung b tuyn. iu ny hi khc so vi cc giao thc IGPs khi vic qung b v nhn din hng xm c mi lin h rng buc ln nhau v u s dng cu lnh network. Vi giao thc BGP chy trn cc thit b ca Cisco c ba cch a ch mng c th c qung b vo trong bng nh tuyn BGP (BGP routing table). Ba phng thc c s dng l : - Cu lnh Network - Qua s phn phi tuyn (Route redistribution) - T mt BGP hng xm Hnh 17 minh ha cc phng thc c s dng qung b tuyn BGP

Hnh 17 : Cc phng thc qung b tuyn trong BGP Tip theo chng ta s i nghin cu c th tng phng thc c s dng qung b cc tuyn BGP

25

3.2.1 Qung b tuyn s dng cu lnh Network y l phng thc u tin mt tuyn c th c qung b vo trong bng nh tuyn BGP. Cu lnh Network c s dng chuyn cc tuyn t bng nh tuyn (routing table) ti bng nh tuyn BGP ging nh l cc tuyn chy BGP. Cc tuyn trong bng routing table c hc t cc giao thc nh tuyn ni nh RIP, IGRP, EIGRP, OSPF hoc IS-IS. Hay cc tuyn tnh, cc tuyn c kt ni trc tip. Di y l bng nh tuyn ch c cc tuyn kt ni trc tip ca router A
A#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks C C C C 172.16.15.160/30 is directly connected, Serial0/0 172.16.15.128/27 is directly connected, Ethernet0/0 172.16.15.254/32 is directly connected, Loopback0 172.16.15.64/27 is directly connected, Ethernet0/1

S hot ng ca cu lnh Network ph thuc vo vic t tm tt tuyn trong cc tin trnh BGP. Mc nh qu trnh t tm tt (autosummariztion) tuyn c cho php hot ng v th ta phi kho st trng hp ny . nh dng ca cu lnh network nh sau: network prefix mask subnet-mask

26

Tham s subnet-mask l tham s la chn. Nu subnet-mask khng s dng BGP s gi thit s dng tham s vi cc ch mc nh ty thuc lp mng . Vi vic mc nh qu trnh t tm tt c hot ng. Cu lnh network c s dng qung b cc tuyn vi tham s subnet-mask mc nh trong bng nh tuyn BGP. V th cn phi c t nht mt tuyn vi tuyn subnet dng classful trong bng nh tuyn. Bng nh tuyn trn router A cha subnets 172.16.0.0/16 do vy qung b tuyn ny c th s dng cu lnh :
router bgp 1 network 172.16.0.0 neighbor 172.16.15.162 remote-as 2

Khi bng nh tuyn BGP ca router A s nh sau :


A#show ip bgp BGP table version is 8, local router ID is 172.16.15.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network *> 172.16.0.0 Next Hop 0.0.0.0 Metric LocPrf Weight Path 0 32768 i

Trong v d trn next hop l 0.0.0.0 v thuc tnh AS path l trng ch ra rng mng 172.16.0.0 bt ngun trn router A. Ta cng c th thy MED l 0 v thuc tnh Weight c gi tr mc nh l 32768. Sau khi mt tuyn hp l c t trong bng nh tuyn BGP , tuyn s c qung b ti router B . Kt qu trong bng nh tuyn BGP l :
B#show ip bgp BGP table version is 4, local router ID is 172.16.16.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete

27

Network *> 172.16.0.0

Next Hop

Metric LocPrf Weight Path 0 01i

172.16.15.161

Mng 172.16.0.0 c qung b thnh cng ti router B. Thuc tnh NEXT_HOP c t bng giao din c s dng qung b tuyn n router B. Thuc tnh AS_PATH c t bng 1, MED v Weight c gi tr bng 0. Sau mt tuyn BGP hp l s c chuyn ti bng nh tuyn trn router B.
B#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks C C C B 172.16.16.164/30 is directly connected, Serial0/1 172.16.15.160/30 is directly connected, Serial0/0 172.16.16.254/32 is directly connected, Loopback0 172.16.0.0/16 [20/0] via 172.16.15.161, 00:09:41

T bng nh tuyn ta c th nhn thy administrative distance (AD) ca EBGP l 20 v cost hoc metric ca tuyn BGP l 0. BGP khng s dng cost tnh ton ng i ngn nht m s dng cc thuc tnh BGP nh: Weight, LOCAL_PREF, AS_PATH, MED v ORIGIN thay th.

28

Mc nh trn cc thit b ca hng Cisco cho php t tm tt tuyn. Tuy nhin cisco khuyn ngh rng nn hy b ch ny khi s dng BGP. Vic hy b ny c thc hin bng cch s dng cu lnh: no auto-summary trong cu hnh BGP. Trn 2 router A v B ta c th cu hnh nh sau :
Router A router bgp 1 network 172.16.0.0 neighbor 172.16.15.162 remote-as 2 no auto-summary Router B router bgp 2 neighbor 172.16.15.161 remote-as 1 no auto-summary

Sau khi hy b ch t ng tm tt tuyn mt vn c t ra. l tuyn 172.16.0.0/16 c c qung b hay khng ? Nu kho st bng BGP ca hai router A v B cng vi bng nh tuyn ca chng th ta nhn thy rng tuyn trn khng c qung b
A#show ip bgp !no output B#show ip bgp !no output B#show ip route 172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks C C 172.16.16.164/30 is directly connected, Serial0/1 172.16.15.160/30 is directly connected, Serial0/0

29

172.16.16.254/32 is directly connected, Loopback0

S d tuyn 172.16.0.0/16 khng c qung b khi t ng tm tt tuyn c hy b l do n lm thay i cch hot ng ca cu lnh network. Qa trnh hy b t tm tt tuyn s to ra mt quy tc mi khin cho a ch mng v mask s dng trong cu lnh network phi chnh xc so vi trong bng nh tuyn. Cu lnh network 172.16.0.0 s ko theo vic router tm trong bng nh tuyn ca n mt a ch ph hp. Tuy nhin ch c cc mng con ca tuyn 172.16.0.0 trong bng nh tuyn trn router A m khng c tuyn 172.16.0.0 ch nh. V th xy ra trng hp khng qung b tuyn trn. Cc tuyn nm tn ti trong bng nh tuyn ca router A
A#show ip route | include directly connected C C C C 172.16.15.160/30 is directly connected, Serial0/0 172.16.15.128/27 is directly connected, Ethernet0/0 172.16.15.254/32 is directly connected, Loopback0 172.16.15.64/27 is directly connected, Ethernet0/1

V th cc tuyn c qung b khi hy b ch t ng tm tt tuyn ta phi ch r c a ch mng v mask sao cho ph hp vi bng nh tuyn. Khi tuyn mi c qung b
Router A router bgp 1 network 172.16.15.64 mask 255.255.255.224 network 172.16.15.128 mask 255.255.255.224 network 172.16.15.160 mask 255.255.255.252 network 172.16.15.254 mask 255.255.255.255 neighbor 172.16.15.162 remote-as 2

30

no auto-summary

Cc tuyn c qung b c th thy r khi quan st cc bng routing table trn router B v BGP table trn cc router A, B
A#show ip bgp BGP table version is 13, local router ID is 172.16.15.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 0 0 0 0 32768 i 32768 i 32768 i 32768 I

*> 172.16.15.64/27 0.0.0.0 *> 172.16.15.128/27 0.0.0.0 *> 172.16.15.160/30 0.0.0.0 *> 172.16.15.254/32 0.0.0.0

Di y l bng BGP ca router B


B#show ip bgp BGP table version is 9, local router ID is 172.16.16.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 0 0 0 0 01i 01i 01i 01i

*> 172.16.15.64/27 172.16.15.161 *> 172.16.15.128/27 172.16.15.161 *> 172.16.15.160/30 172.16.15.161 *> 172.16.15.254/32 172.16.15.161

Bng nh tuyn ca router B s cho ta thy c cc tuyn c qung b t router A


B#show ip route

31

172.16.0.0/16 is variably subnetted, 6 subnets, 3 masks C C B B C B 172.16.16.164/30 is directly connected, Serial0/1 172.16.15.160/30 is directly connected, Serial0/0 172.16.15.128/27 [20/0] via 172.16.15.161, 00:02:36 172.16.15.254/32 [20/0] via 172.16.15.161, 00:02:36 172.16.16.254/32 is directly connected, Loopback0 172.16.15.64/27 [20/0] via 172.16.15.161, 00:02:36

3.2.2 Qung b tuyn s dng redistribute y l phng thc th hai qung b tuyn t bng nh tuyn vo bng nh tuyn BGP. Phng thc ny cho php qung b cc tuyn kt ni trc tip trn router vo bng nh tuyn BGP. Tnh cht t ng tm tt tuyn tng t nh trong phn s dng cu lnh network tc l nu khng hy b ch ny cc tuyn s c tm tt thnh cc tuyn c a ch v mask mc nh. Vic phn phi, qung b quan vic redistribute ny c thc hin qua cu lnh redistribute connected. Trn Router A qu trnh c thc hin bi cc lnh :
Router A router bgp 1 redistribute connected neighbor 172.16.15.162 remote-as 2 no auto-summary

Tng t nh phn 2.1 ta s thy bng nh tuyn BGP v nh tuyn ca 2 router A v B (xt trng hp hy b ch t ng tm tt tuyn ) nh sau :
A#show ip bgp BGP table version is 7, local router ID is 172.16.15.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete

32

Network

Next Hop

Metric LocPrf Weight Path 0 0 0 0 32768 ? 32768 ? 32768 ? 32768 ?

*> 172.16.15.64/27 0.0.0.0 *> 172.16.15.128/27 0.0.0.0 *> 172.16.15.160/30 0.0.0.0 *> 172.16.15.254/32 0.0.0.0 B#show ip bgp

BGP table version is 21, local router ID is 172.16.16.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 0 0 0 0 01? 01? 01? 01?

*> 172.16.15.64/27 172.16.15.161 *> 172.16.15.128/27 172.16.15.161 *> 172.16.15.160/30 172.16.15.161 *> 172.16.15.254/32 172.16.15.161

B#show ip route 172.16.0.0/16 is variably subnetted, 6 subnets, 3 masks C C B B C B 172.16.16.164/30 is directly connected, Serial0/1 172.16.15.160/30 is directly connected, Serial0/0 172.16.15.128/27 [20/0] via 172.16.15.161, 00:01:44 172.16.15.254/32 [20/0] via 172.16.15.161, 00:01:44 172.16.16.254/32 is directly connected, Loopback0 172.16.15.64/27 [20/0] via 172.16.15.161, 00:01:44

33

Ta ch rng khi s dng phng thc ny cc tuyn redistribute c thuc tnh ORIGIN c t du ? trong bng BGP ca cc router 3.2.3 S dng EBGP qung b tuyn Phng thc cui cng qung b tuyn BGP vo bng BGP l t BGP chnh n. Xt topo mng di y

Hnh 18 : Qa trnh s dng EBGP qung b tuyn

Bng vic s dng cc cu lnh


Router B router bgp 2 neighbor 172.16.15.161 remote-as 1 neighbor 172.16.16.166 remote-as 3 no auto-summary

34

Router C router bgp 3 neighbor 172.16.16.165 remote-as 2

Cho php router mi thm vo nhn din c hng xm vi n l router B v router B cng nhn din c hng xm ca n l router C. Qu trnh qung b tuyn din ra gia router B, C cho php router B qung b cc tuyn c trn router A . Kt qu trong bng nh tuyn v BGP routing ca router C c cc tuyn cn t ti trn router A
C#show ip bgp BGP table version is 5, local router ID is 172.16.17.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 021? 021? 021? 021?

*> 172.16.15.64/27 172.16.16.165 *> 172.16.15.128/27 172.16.16.165 *> 172.16.15.160/30 172.16.16.165 *> 172.16.15.254/32 172.16.16.165 C#show ip route

172.16.0.0/16 is variably subnetted, 7 subnets, 3 masks C B B B C C B 172.16.16.164/30 is directly connected, Serial0/1 172.16.15.160/30 [20/0] via 172.16.16.165, 00:12:21 172.16.15.128/27 [20/0] via 172.16.16.165, 00:12:21 172.16.15.254/32 [20/0] via 172.16.16.165, 00:12:21 172.16.17.254/32 is directly connected, Loopback0 172.16.17.32/27 is directly connected, Ethernet0/0 172.16.15.64/27 [20/0] via 172.16.16.165, 00:12:21

35

Thuc tnh AS_PATH trn router C c gi tr 2 1 l cc AS phi i qua t ti cc tuyn trn router A. V d ny chng minh rng router EBGP qung b tuyn hc c t mt EBGP hng xm ti mt hng xm khc 3.3 Hot ng ca IBGP 3.3.1 Kho st hot ng ca IBGP kho st s hot ng ca IBGP ta kho st topo di y

Hnh 19 : Kt ni IBGP v EBGP Vic cu hnh EBGP v IBGP cho vic qung b tuyn tng i ging nhau trn cc thit b ca cisco. Tuy nhin s hot ng ca EBGP v IBGP c phn khc nhau. kho st ta xem xt cc thng tin trn router D v E khi E qung b cc tuyn kt ni trc tip vi n:
Router D router bgp 1 neighbor 172.16.15.162 remote-as 2 no auto-summary Router E router bgp 2 redistribute connected neighbor 172.16.15.161 remote-as 1

36

no auto-summary

Kho st bng routing table v bng BGP routing table ca router D ta thu c kt qu
D#show ip bgp BGP table version is 4, local router ID is 172.16.15.254 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 172.16.15.160/30 172.16.15.162 *> 172.16.16.164/30 172.16.15.162 *> 172.16.16.254/32 172.16.15.162 D#show ip route 172.16.0.0/16 is variably subnetted, 6 subnets, 3 masks B C C C B C 172.16.16.164/30 [20/0] via 172.16.15.162, 00:27:23 172.16.15.160/30 is directly connected, Serial0/0 172.16.15.128/27 is directly connected, Ethernet0/0 172.16.15.254/32 is directly connected, Loopback0 172.16.16.254/32 [20/0] via 172.16.15.162, 00:27:23 172.16.15.64/27 is directly connected, Ethernet0/1 0 0 0 02? 02? 02?

Vic thit lp s hot ng ca IBGP gia cc router trong AS 1 tng i ging so vi vic thit lp s hot ng ca EBGP ngoi tr vic thay i s AS. Trong topo trn thit lp s hot ng ca IBGP gia router C v D ta s dng cu hnh sau :
Router C router bgp 1 neighbor 172.16.15.130 remote-as 1 no auto-summary

37

Router D router bgp 1 neighbor 172.16.15.129 remote-as 1 neighbor 172.16.15.162 remote-as 2 no auto-summary

Sau khi thit lp c s hot ng ca IBGP trong AS 1 gia router D v C tao c th xc nhn quan h gia chng l IBGP. Cc thng tin ch ra bi router D cho chng ta thy r iu ny:
D#show ip bgp neighbors 172.16.15.129 BGP neighbor is 172.16.15.129, remote AS 1, internal link BGP version 4, remote router ID 172.16.15.253 BGP state = Established, up for 00:28:24 Last read 00:00:24, hold time is 180, keepalive interval is 60 seconds !Output omitted for brevity

Cc thng tin u ra trn cho thy router C v router D tn ti mi quan h IBGP hng xm. Thut ng internal link trong thng tin u ra ch r mi quan h ny. Cc tuyn c qung b t router E n router C qua router D nh sau :
C#show ip bgp BGP table version is 1, local router ID is 172.16.15.253 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 0 100 0 100 02? 02?

* i172.16.15.160/30 172.16.15.162 * i172.16.16.164/30 172.16.15.162

38

* i172.16.16.254/32 172.16.15.162

0 100

02?

Tip tc kho st bng nh tuyn trn router C ta nhn thy :


C#show ip route 172.16.0.0/16 is variably subnetted, 5 subnets, 3 masks C C C C C 172.16.15.128/27 is directly connected, Ethernet2/0 172.16.15.253/32 is directly connected, Loopback0 172.16.15.32/27 is directly connected, Ethernet0/0 172.16.9.0/30 is directly connected, Serial0/1 172.16.15.96/27 is directly connected, FastEthernet1/0

Da vo thng tin trong bng nh tuyn trn ta nhn thy mt s tuyn trong bng BGP trn router khng c chuyn vo bng nh tuyn trn router C. Tuy nhin kho st k bng nh tuyn BGP trn router C v D ta thy :
Router D *> 172.16.15.160/30 172.16.15.162 Router C * i172.16.15.160/30 172.16.15.162 0 100 02? 0 02?

Cc tuyn c cng next hop cho mng 172.16.15.160/30 nhng router D xem tuyn l mt tuyn hp l v l tuyn tt nht (* >) cn router C cng coi tuyn l tuyn hp l ( * ) nhng khng phi l tuyn tt nht. Cc thng tin u ra di y trn router C cho ta thy iu ny
C#show ip bgp 172.16.15.160 BGP routing table entry for 172.16.15.160/30, version 0 Paths: (1 available, no best path) Not advertised to any peer 2

172.16.15.162 (inaccessible) from 172.16.15.130 (172.16.15.254)

39

rigin incomplete, metric 0, localpref 100, valid, internal, not synchronized

a ch mng 172.16.15.160 v cc a ch khc c nhn t router D l khng th truy cp. iu ny c ngha l router C khng bit lm th no t c n NEXT_HOP do BGP khng thay i NEXT_HOP khi thng tin c nhn v qung b t cc EBGP hng xm ti mt IBGP router. Router D khng thay i NEXT_HOP 172.16.15.162 khi tuyn 172.16.15.160 c qung b ti router C. Tuyn c xem nh khng th truy cp v n khng tn ti trong bng routing table. gii quyt vn ny ta c th s dng mt giao thc IGP cho khng nhng cho vic qung b NEXT_HOP m cn qung b tt c cc mng thuc v AS 1. Trong v d ny ta c th s dng mt vng n trn router A, B, C, D. C th xy dng mt vng OSPF v nh danh vng AS 1 s dng cu hnh sau qung b NEXT_HOP :
router ospf 1 network 172.16.0.0 0.0.255.255 area 51

Sau khi gii quyt vn qung b NEXT_HOP. Cc thng tin trong bng nh tuyn, bng BGP s thay i nh sau :
C#show ip route | include 172.16.15.160 O 172.16.15.160/30 [110/74] via 172.16.15.130, 00:05:45, Ethernet2/0 C#show ip bgp 172.16.15.160 BGP routing table entry for 172.16.15.160/30, version 2 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer 2

172.16.15.162 (metric 74) from 172.16.15.130 (172.16.15.254) Origin incomplete, metric 0, localpref 100, valid, internal, synchronized, best

Tip cc tuyn BGP c chuyn vo bng routing table :


C#show ip route 172.16.0.0/16 is variably subnetted, 12 subnets, 3 masks O 172.16.15.160/30 [110/74] via 172.16.15.130, 00:08:45, Ethernet2/0

40

O C O O C O C O C C O

172.16.15.164/30 [110/50] via 172.16.15.97, 00:08:45, FastEthernet1/0 172.16.15.128/27 is directly connected, Ethernet2/0 172.16.15.251/32 [110/3] via 172.16.15.97, 00:08:45, FastEthernet1/0 172.16.15.254/32 [110/11] via 172.16.15.130, 00:08:45, Ethernet2/0 172.16.15.253/32 is directly connected, Loopback0 172.16.15.252/32 [110/2] via 172.16.15.97, 00:08:46, FastEthernet1/0 172.16.15.32/27 is directly connected, Ethernet0/0 172.16.15.0/27 [110/2] via 172.16.15.97, 00:08:46, FastEthernet1/0 172.16.9.0/30 is directly connected, Serial0/1 172.16.15.96/27 is directly connected, FastEthernet1/0 172.16.15.64/27 [110/12] via 172.16.15.97, 00:08:46, FastEthernet1/0

Mng 172.16.15.160 trong bng routing table l mt tuyn OSPF. Mt cu hi c t ra l ti sao tuyn khng phi l mt tuyn IBGP ? Cu tr li l do router C hc v tuyn 172.16.15.160 thng qua OSPF v IBGP tuy nhin OSPF c Administrative distance (AD) l 110 cn IBGP l 200 v th tuyn OSPF c s dng . Nhn vo bng routing table ta khng thy bt c tuyn BGP no tuy nhin khi quan st thng tin u ra trn bng BGP ca router C ta nhn thy :
C#show ip bgp BGP table version is 2, local router ID is 172.16.15.253 tatus codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 0 100 0 100 0 100 02? 02? 02?

*>i172.16.15.160/30 172.16.15.162 * i172.16.16.164/30 172.16.15.162 * i172.16.16.254/32 172.16.15.162

41

Tuyn 172.16.15.160, 172.16.16.164, 172.16.16.254 l cc tuyn hp l tuy nhin 2 tuyn 172.16.16.164 v 172.16.16.254 khng phi l cc tuyn c ng ti u. Nhn nh trn c kim chng vi tuyn 172.16.16.164 .

C#show ip bgp 172.16.16.164 BGP routing table entry for 172.16.16.164/30, version 0 Paths: (1 available, no best path) Not advertised to any peer 2 172.16.15.162 (metric 74) from 172.16.15.130 (172.16.15.254) Origin incomplete, metric 0, localpref 100, valid, internal, not synchronized

Cc tuyn khng hp l trn l cc tuyn khng c ng b. ng b l mt c tnh ca IBGP. Lut ng b qui nh mt tuyn BGP nhn t mt IBGP hng xm khng c coi l hp l nu nh tuyn khng nm trong bng nh tuyn. Tuyn 172.16.15.160 trong topo trn c ng b bi tuyn nm trong bng IP routing table vi vai tr ca mt tuyn OSPF. Cc tuyn BGP 172.16.16.164 v 172.16.16.254 khng nm trong bng nh tuyn v th chng c xem l khng ng b. ni r hn v lut ng b ny ta kho st topo di y

42

Hnh 20 : ng b trong IBGP Router A v B thc hin mt kt ni EBGP, Router A qung b tuyn 172.16.1.0/24 n router B. Trong AS 2 mt ng kt ni vt l tn ti gia router B v D thng qua router C. IBGP khng yu cu mt kt ni vt l v cc Router B, D thc hin c mt kt ni IBGP. Cc thng tin trao i gia router B v D c thc hin qua kt ni vt l vi router C tuy nhin router C khng bit c nhng ni dung ca thng tin trao i ny . Router B v D phi bit c lm cch no c th n c cc tuyn khc. AS 2 chy OSPF qung b tt c cc tuyn trong AS 2. Tt c nhng iu trn nhm thc hin mt kt ni IBGP gia cc hai router. Gi s ng b khng phi l c tnh ca IBGP chng ta kho st cc s kin sau : 1, Router A qung b tuyn 172.16.1.0/24 n router B thng qua EBGP 2, Router B chp nhn tuyn v n bit NEXT_HOP (NEXT_HOP c bit do tuyn c kt ni trc tip ). Tip tuyn c t vo trong bng routing trn router B. 3, Router B qung b tuyn n router D thng qua IBGP m khng thay i NEXT_HOP. 4, Router D chp nhn tuyn v NEXT_HOP c bit thong qua OSPF. 5, Router D qung b tuyn 172.16.1.0/24 n router E trong AS 3. 6, Router E chp nhn tuyn v bit NEXT_HOP v t tuyn ny vo bng routing table ca n. 7, Gi s mt host trong AS 3 gi mt gi tin n host trn mng 172.16.1.0/24. Host gi gi n router E v router E chuyn tip gi n router D sau khi n kho st bng nh tuyn ca n. 8, Router D nhn gi v kim tra a ch ch a ra quyt nh chuyn tip gi tin. Gi c chuyn ti router C. 9, Router C khng bit c tuyn 172.16.1.0/24 v tuyn khng c hc qua OSPF hay BGP v th router C hy gi.

43

Mc nh cc router Cisco cho php ng b, cu lnh no synchronization cho php tt ch ny. Khi cc tuyn qung b bi router D s c chuyn n bng IP routing table trn router C.
C#show ip bgp BGP table version is 4, local router ID is 172.16.15.253 tatus codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 0 100 0 100 0 100 02? 02? 02?

*>i172.16.15.160/30 172.16.15.162 *>i172.16.16.164/30 172.16.15.162 *>i172.16.16.254/32 172.16.15.162 C#show ip route | i B B B

172.16.16.164/30 [200/0] via 172.16.15.162, 00:02:28 172.16.16.254/32 [200/0] via 172.16.15.162, 00:02:28

Tip tc kho st vic qung b tuyn t router C n router B. qung b cc tuyn t router C n router B, 2 router cn thit lp mt tin trnh BGP, mi quan h hng xm gia chng :
Router C router bgp 1 no synchronization neighbor 172.16.15.97 remote-as 1 neighbor 172.16.15.130 remote-as 1 no auto-summary Router B router bgp 1 neighbor 172.16.15.98 remote-as 1

44

Kho st thng tin u ra v mi quan h gia cc router v bng nh tuyn ca router B


B#show ip bgp neighbors 172.16.15.98 | include Established BGP state = Established, up for 00:04:22 B#show ip bgp !no output

T cc thng tin u ra ta nhn thy router C khng qung b bt k tuyn BGP no ti router B. c tnh ny minh ha s hot ng khc nhau gia IBGP v EBGP. Tt c cc router chy IBGP khng c qung b cc tuyn hc c t mt IBGP hng xm n mt IBGP hng xm khc. S d IBGP hot ng nh vy l do c tnh chng loop ca BGP. Do Thuc tnh AS_PATH c s dng chng loop nn n khng qung b tuyn khi thy AS ca chnh n. V th cc tuyn IBGP khng c qung b. Chnh iu ny khin cc IBGP routers cn mt cu hnh full mesh , tt c cc routers chy IBGP u cn c kt ni n tt c cc router khc chy IBGP trong cng mt AS. Nh ni trn cc IBGP hng xm khng cn mt kt ni vt l thit lp mi quan h. Yu cu cn thit y ch l mt kt ni IP gia chng. Tuy nhin chng ta s dng a ch cc giao din vt l thit lp mi quan h hng xm gia cc router v th khi cc giao din vt l gp li cng s khin cho kt ni BGP li theo. gii quyt vn ny BGP cng nh cc giao thc IGPs a ra gii php v a ch loopback 3.3.2 Giao din loopback trong IBGP Vn t ra khi xy dng cu hnh cc router trong AS 1 l chuyn s g xut hin khi a ch vt l hoc tuyn gp s c.

45

Hnh 21 : IBGP khng yu cu kt ni vt l gia cc hng xm Trong topo trn router D c ba tuyn n c router C tuy nhin nu kt ni vt l gp s c nhng tuyn khc cng khng th c s dng nu nh mi quan h hng xm c nh ngha trn cc giao din vt l gp s c. Thay cho vic s dng a ch trn cc giao din vt l ngi ta s dng a ch loopback. Vi topo trn tuyn ng tt nht t router D ti C l kt ni trc tip thng qua giao din loopback. Tng t nu kt ni trc tip ny li router D s la chn cc tuyn qua A v n C hoc tuyn qua A, B v ti C. Vic khai bo v s dng a ch loopback cng tng i d dng
Router A router bgp 1 no synchronization neighbor 172.16.15.252 remote-as 1 neighbor 172.16.15.252 update-source Loopback0 neighbor 172.16.15.253 remote-as 1 neighbor 172.16.15.253 update-source Loopback0 neighbor 172.16.15.254 remote-as 1 neighbor 172.16.15.254 update-source Loopback0 no auto-summary Router B

46

router bgp 1 no synchronization neighbor 172.16.15.251 remote-as 1 neighbor 172.16.15.251 update-source Loopback0 neighbor 172.16.15.253 remote-as 1 neighbor 172.16.15.253 update-source Loopback0 neighbor 172.16.15.254 remote-as 1 neighbor 172.16.15.254 update-source Loopback0 no auto-summary Router C router bgp 1 no synchronization neighbor 172.16.15.251 remote-as 1 neighbor 172.16.15.251 update-source Loopback0 neighbor 172.16.15.252 remote-as 1 neighbor 172.16.15.252 update-source Loopback0 neighbor 172.16.15.254 remote-as 1 neighbor 172.16.15.254 update-source Loopback0 no auto-summary Router D router bgp 1 no synchronization neighbor 172.16.15.162 remote-as 2 neighbor 172.16.15.251 remote-as 1

47

neighbor 172.16.15.251 update-source Loopback0 neighbor 172.16.15.252 remote-as 1 neighbor 172.16.15.252 update-source Loopback0 neighbor 172.16.15.253 remote-as 1 neighbor 172.16.15.253 update-source Loopback0 no auto-summary

Mt vn na t ra khi s dng IBGP l vic thc hin mt cu hnh full mesh gia cc router. Cu hnh full mesh s to ra mt s lng cc kt ni ln . S kt ni IBGP cn thit cho mt full mesh da vo s lng IBGP router v c cho bi cng thc S kt ni = [(n)(n-1)]/2. BGP cng a ra cc phng n gii quyt vn ny

48

3.3.3 Route-Reflector (RR) Mt route reflector l mt router c cu hnh chuyn nhng cp nht nh tuyn n cc router hng xm hoc cc router chy BGP bn trong mt AS. Cc router IBGP cn phi c ch ra nh l client trong khi cu hnh. Khi mt client gi mt cp nht nh tuyn n route-reflector, n s chuyn update n cc router client khc. c bit, route-reflector nh ngha lut split horizon. Lt ny qui nh rng mt IBGP router s khng truyn mt tuyn c hc t mt router hng xm trong cng mt AS. Route Reflector v client s i hi mt quan h hng xm y bi v route reflector s gi cc cp nht t cc client khc nhng vic thit lp hng xm gia cc client l khng cn thit. Mt route-reflector s kt ni n cc hng xm m n khng y tuyn n. T quan im ca route-reflector, cc hng xm ny c gi l non-clients. Cc router non clients phi c kt ni full mesh vi cc route-reflector v vi cc non-client khc. Khi mt router cu hnh nh mt route-reflector, n s y nhng ng i c hc t cc IBGP khc ch n cc route-reflector clients v ti cc IBGP/EBGP hng xm. iu ny c ngha l mt thit k hub-and-spoke c th c trin khai trong mt AS gia cc IBGP hng xm, nh vy gim thiu s phin gia cc router. C routereflector v cc client ca n hnh thnh nn mt n v chia s thng tin. n v ny gi l cluster. Mt Autonomous System c th c chia ra thnh cc cluster, trong cc cluster s c cc route-reflector c ch nh v cu hnh. Phi c t nht mt route-reflector trong mi cluster. Nu mt route-reflector kt ni n cc route reflector khc, routereflector phi c full mesh. iu ny nhm m bo cc bng IBGP routing l y . Khi mt route-reflector chuyn i mt cp nht nh tuyn, thuc tnh Originator_ID s c thit lp. y l BGP routerID ca router to ra ng i. Nu router ny nhn li bn cp nht nh tuyn , router s thy ID ca chnh n v s b qua thng tin ny. iu ny nhm ngn nga v tng kh nng loop. Nu c nhiu route-reflector trong cluster, cc router s phn bit vi nhau bng clusterID. Thng s ny phc v cng mt mc ch nh thuc tnh Originator_ID ngn nga loop. Vi cch dng route-reflector, router ng vai tr route-reflector s tn nhiu ti nguyn hn. Nu cu hnh route-reflector khng chnh xc, n c th gy ra loop. C nhiu mc route-reflector c th c cu hnh bng cch to ra cc thit k theo th bc. Cc router khng l thnh phn ca route-reflector s khng b nh hng trong

49

nhng thay i v thit k v nhng thay i v qu trnh truyn cc cp nht. Thay vo , cc router ny s khng nhn bit c bt c thay i no v n vn nhn c cc cp nht m n cn. Bn thn cc cp nht nh tuyn cng khng b thay i bi v khng c s thay i no trong gi tr cc thuc tnh c mang trong cc cp nht nh tuyn. Chnh v cc c im trn, qu trnh chuyn i thit k mt h thng mng no sang dng dng route-reflector th rt d dng. Mt thit k quan trng l bn thn cc route-reflector trong mt AS cng phi full mesh. Ngoi ra, mt route-reflector ny c th l client cho mt route-reflector khc. Thit k nh vy kh phc tp v yu cu xem xt cn thn bi v khi cc route-reflector c cu hnh v split horizon b hy b, khng cn mt c ch no bo v v chng loop.

Hnh 22: Thit k Route-reflector

50

Cc li ch ca route-reflector bao gm - Kh nng m rng mng - Thit k mang tnh cu trc cao - Gim lu lng mng. - Gim b nh v CPU cn thit duy tr cc phin TCP trn cc IBGP hng xm. - Hi t nhanh hn v mng tr nn n gin hn bi v c n hai giao thc nh tuyn c dng: IBGP cho cc thng tin nh tuyn bn ngoi i qua AS; IGP cho cc router bn trong mt AS.

Hnh 23: Cu hnh cc route-reflector

51

Hot ng ca Route Reflector: Mt Route Reflector n gin ging nh mt tm gng phn hi cc bn cp nht nh tuyn t cc client n cc client khc m khng yu cu mt mng phi full mesh. Khi mt RR nhn c mt cp nht: - Client s chuyn cp nht tuyn cho router hng xm ca n, trong trng hp ny l RR - Mt cp nht tuyn t client c nhn t RR v cp nht s c chuyn n cc RR clients cng nh nonclients. Thng s originatorID ban u s b loi tr ra khi cp nht. - Nu c nhiu ng i nhn c t RR, ng i tt nht s c chn thng qua RR. - Mt nonclient router s chuyn cc cp nht ti cc lng ging ca n, c th l mt RR. - Mt RR nhn mt cp nht tuyn t mt router nonclient v cp nht tuyn ch c chuyn n clients - Khi cp nht tuyn n t EBGP c client v non-clients u nhn c thng tin nh tuyn t RR

Hnh 24: Phn x tuyn RR

52

Router C hot ng nh mt router reflector vi cc router A,B,D l cc client. Cu hnh ca cc router c cho di y
Router A router bgp 1 no synchronization neighbor 172.16.15.253 remote-as 1 neighbor 172.16.15.253 update-source Loopback0 no auto-summary Router B router bgp 1 no synchronization neighbor 172.16.15.253 remote-as 1 neighbor 172.16.15.253 update-source Loopback0 no auto-summary Router D router bgp 1 no synchronization neighbor 172.16.15.162 remote-as 2 neighbor 172.16.15.253 remote-as 1 neighbor 172.16.15.253 update-source Loopback0 no auto-summary Router C router bgp 1 no synchronization neighbor 172.16.15.251 remote-as 1

53

neighbor 172.16.15.251 update-source Loopback0 neighbor 172.16.15.251 route-reflector-client neighbor 172.16.15.252 remote-as 1 neighbor 172.16.15.252 update-source Loopback0 neighbor 172.16.15.252 route-reflector-client neighbor 172.16.15.254 remote-as 1 neighbor 172.16.15.254 update-source Loopback0 neighbor 172.16.15.254 route-reflector-client no auto-summary

3.3.4 Phn cp nh tuyn trong cc AS (Confederations) Confederations cng l mt cng ngh nhm gim s kt ni IBGP. Hot ng ca phng php ny da trn vic phn chia AS thnh cc AS con c nh s AS theo qui tc AS ring ( 64512 n 65534).

Hnh 25 : Phn chia AS trong confederations Trong topo v d hnh 25 AS 1 c phn chia ra lm hai AS khc v c nh s theo qui nh m bo lm mt AS ring ( private AS ). Hai router B v C c

54

nhm vo cng mt AS l 64555 , Hai router cn li trong AS 1 l A v D c nhm vo AS 64556. Cu hnh cc router c cho di y :
Router A router bgp 64556 no synchronization bgp confederation peers 64555 neighbor 172.16.15.34 remote-as 64555 neighbor 172.16.15.254 remote-as 64556 neighbor 172.16.15.254 update-source Loopback0 no auto-summary Router B router bgp 64555 no synchronization neighbor 172.16.15.253 remote-as 64555 neighbor 172.16.15.253 update-source Loopback0 no auto-summary Router C router bgp 64555 no synchronization bgp confederation peers 64556 neighbor 172.16.15.33 remote-as 64556 neighbor 172.16.15.252 remote-as 64555 neighbor 172.16.15.252 update-source Loopback0 no auto-summary

55

Router D router bgp 64556 no synchronization bgp confederation identifier 1 neighbor 172.16.15.162 remote-as 2 neighbor 172.16.15.251 remote-as 64556 neighbor 172.16.15.251 update-source Loopback0 no auto-summary

Trn y l hai phng php gim s kt ni trong IBGP. Hai phng php trn c th s dng ring r hoc c th kt hp vi nhau. Tuy nhin s kt hp gia hai phng php trn s ko theo mt cu hnh phc tp gy kh khn cho qun tr vin.

Hnh 26: S kt hp ca 2 phng php RR v Confederations 3.4 Gii thut nh tuyn trong BGP nh tuyn trong BGP nh ni trn da vo cc thuc tnh. Da vo u tin gia cc thuc tnh m BGP a ra quyt nh nh tuyn. Gii thut nh tuyn c th hin qua s di y :

56

Qu trnh chn tuyn c m t theo th t u tin gia cc thuc tnh nh sau : Khi cc tuyn c nhn bi cc BGP router vic u tin n lm l kim tra thuc tnh NEXT_HOP. Nu NEXT_HOP khng th t c (khng nm trong bng IP routing ) tuyn s b t chi. Vi cc tuyn c nhn t cc IBGP hng xm, ngoi vic kim tra thuc tnh NEXT_HOP router s kim tra lut ng b trn router. Nu lut ng b c cho php hot ng trn router th cc tuyn khng ng b s b t chi cp nht vo bng nh tuyn. Sau khi kim tra v tt c cc iu kin trn u tha mn qu trnh chn tuyn trong BGP s c thc hin da trn mc u tin gia cc thuc tnh v theo th t ln lt di y :

57

- u tin tuyn c thuc tnh WEIGHT cao nht (Ch c tc dng trn router) - u tin tuyn c thuc tnh LOCAL_PREF cao nht (Thuct tnh ny c tc dng trong mt AS). Nhng tuyn khng c thuc tnh LOCAL_PREF s c gi tr mc nh l 100. - u tin cc tuyn gc (c NEXT_HOP l 0.0.0.0) - u tin tuyn c thuc tnh AS_PATH thp nht - u tin cc tuyn c ngun gc thp nht theo th t u tin IGP, EGP v INCOMPLETE - u tin tuyn c thuc tnh MED (metric) thp nht (thuc tnh ny c gi tr gia cc AS khc nhau ). - u tin cc tuyn EBGP hn so vi IBGP - u tin nhng ng i c IGP metric thp nht n BGP NEXT_HOP - u tin nhng ng i n t BGP router c routerID nh nht 3.5 S tm tt tuyn trong BGP kho st qu trnh tm tt tuyn trong BGP ta xt topo mng di y :

Hnh 27 : Tm tt tuyn trong BGP Router A qung b 4 tuyn n cc router B v Router C thng qua EBGP. Thuc tnh AS_PATH cho tuyn 156.26.0.0 trn Router B bng 1 v trn Router C bng 2 1. Kho st thng tin v tuyn trn 2 router B v C ta thu c nh sau:

B#show ip bgp BGP table version is 5, local router ID is 172.16.15.252 tatus codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete

58

Network

Next Hop

Metric LocPrf Weight Path 0 0 0 0 01i 01i 01i 01I

*> 156.26.32.0/24 172.16.15.1 *> 156.26.33.0/24 172.16.15.1 *> 156.26.34.0/24 172.16.15.1 *> 156.26.35.0/24 172.16.15.1 C#show ip bgp

BGP table version is 5, local router ID is 172.16.15.253 tatus codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 021i 021i 021i 021i

*> 156.26.32.0/24 172.16.15.97 *> 156.26.33.0/24 172.16.15.97 *> 156.26.34.0/24 172.16.15.97 *> 156.26.35.0/24 172.16.15.97

Trn cc thit b ca Cisco qu trnh tm tt tuyn c thc hin bi cu lnh aggregate-address. BGP ch tm tt tuyn trong bng BGP routing table.

Hnh 28 : Tm tt tuyn trong BGP

59

Xt qu trnh tm tt bn tuyn ca router A trn router B. Qa trnh tm tt c thc hin nh sau :


Router B router bgp 2 aggregate-address 156.26.32.0 255.255.252.0 neighbor 172.16.15.1 remote-as 1 neighbor 172.16.15.98 remote-as 3

Kho st bng BGP routing trn router B ta thy xut hin tuyn tm tt.
B#show ip bgp BGP table version is 6, local router ID is 172.16.15.252 tatus codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 0 01i 32768 i 0 0 0 01i 01i 01i

*> 156.26.32.0/24 172.16.15.1 *> 156.26.32.0/22 0.0.0.0 *> 156.26.33.0/24 172.16.15.1 *> 156.26.34.0/24 172.16.15.1 *> 156.26.35.0/24 172.16.15.1

Tuyn tm tt ny c NEXT_HOP l 0.0.0.0 v n xut pht t chnh router B. Cng v th m thuc tnh AS_PATH khng c t y. Tip tc kho st bng BGP routing trn 2 router A v C :
A#show ip bgp BGP table version is 6, local router ID is 172.16.15.251 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete

60

Network

Next Hop

Metric LocPrf Weight Path 0 32768 i 02i 0 0 0 32768 i 32768 i 32768 I

*> 156.26.32.0/24 0.0.0.0 *> 156.26.32.0/22 172.16.15.2 *> 156.26.33.0/24 0.0.0.0 *> 156.26.34.0/24 0.0.0.0 *> 156.26.35.0/24 0.0.0.0 C#show ip bgp

BGP table version is 6, local router ID is 172.16.15.253 tatus codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 021i 02i 021i 021i 021i

*> 156.26.32.0/24 172.16.15.97 *> 156.26.32.0/22 172.16.15.97 *> 156.26.33.0/24 172.16.15.97 *> 156.26.34.0/24 172.16.15.97 *> 156.26.35.0/24 172.16.15.97

Tuyn tm tt c qung b ti hai router A v C ng thi cc tuyn nm trong tuyn tm tt cng c qung b. y l im khc ca BGP so vi cc giao thc IGPs v cc giao thc IGPs ch qung b cc tuyn tm tt m khng qung b cc tuyn con nm trong tuyn tm tt y. Tuy nhin cc thit b ca Cisco cng cho php ch qung b tuyn tm tt m khng qung b cc tuyn con bng cch thm t kha summary-only trong cu lnh aggregate-address. Cu hnh c th c cho di y :

61

Router B router bgp 2 aggregate-address 156.26.32.0 255.255.252.0 summary-only neighbor 172.16.15.1 remote-as 1 neighbor 172.16.15.98 remote-as 3

Kt qu thng tin thu c u ra


B#show ip bgp BGP table version is 10, local router ID is 172.16.15.252 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 0 01i 32768 i 0 0 0 01i 01i 01i

s> 156.26.32.0/24 172.16.15.1 *> 156.26.32.0/22 0.0.0.0 s> 156.26.33.0/24 172.16.15.1 s> 156.26.34.0/24 172.16.15.1 s> 156.26.35.0/24 172.16.15.1

Cc tuyn con u trong trng thi treo v khng c qung b. Vic khng qung b c th hin trong bng BGP routing ca router C
C#show ip bgp BGP table version is 10, local router ID is 172.16.15.253 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path 02i

*> 156.26.32.0/22 172.16.15.97

62

3.6 Qun l lu lng trong BGP Cc cp nht tuyn BGP c th c kim sot. Nhn chung, trong cc giao thc nh tuyn, kim sot cc cp nht tuyn l vic phi lm. Vic kim sot cc cp nht gip cho n gin ho h thng mng v d dng bo tr. Vic thit k cc thng tin nh tuyn c chuyn i nh th no cng c xem l mt tc v c bn ca bo mt mng v iu ny gip cho gim nguy c b routing-loop. C ba cch p t PBR (Policy Based Routing) trong BGP: - Ra quyt nh da trn thuc tnh AS_PATH, thuc tnh community hoc prefix - T chi hay chp nhn cc tuyn c chn - Thit lp cc thuc tnh nh hng n qu trnh chn la ng i. Qu trnh t chi hay chp nhn cc routes yu cu mt vi dng ca tc v lc tuyn thng qua cc ACL. Tc v lc tuyn khng ch c dng trong PBR m cn kim sot lu lng trong mng. C ba dng lc tuyn trong Cisco router:
- Access-list cho AS_PATH c dng lc cc AS. Mt ACL c dng trong BGP s lc cc cp nht tuyn gi t mt router hng xm da trn AS path. - Prefix list

c dng lc cc tuyn, c bit trong qu trnh redistribution. T Cisco IOS v.11.2, cc ISP s dng cc prefix-list l mt dng kh hiu qu ca lc tuyn. C ch dng prefix-list da trn a ch ca mt tuyn. - Distribute lists + Distribute-list c dng lc cc cp nht. Mc d distribute-list thng c dng trong redistribution, cng c ny khng ch dnh ring cho qu trnh redistribution. N c th p dng cho cc lu lng theo chiu vo v chiu ra t bt c cc hng xm no. C prefix-list v distribute-list u lc da trn a ch mng ch khng dng AS_PATH. + Route maps: Route map c dng nh ngha chnh sch nh tuyn. Mt route-map l mt access-list phc tp qua router hot ng khi mt match c nhn dng. Route map c dng trong BGP xc lp cc thuc tnh ca BGP chn ra ng i tt nht. Hot ng ca Prefix-list:

63

Prefix-list ch tm kim trn phn network ca mt a ch nn qu trnh tm kim l rt nhanh. iu ny c bit quan trng trong khi tm kim nhng bng nh tuyn kch thc ln trong BGP. Mt thun li khc ca prefix-list l kh nng son tho. Mc d trong ACL truyn thng vn cho php son tho ng (dng named ACL), prefix-list c th to v s dng d dng. iu ny khng ch ng vi tnh nng son tho m cn vi giao din ci tin. Trc khi p dng mt prefix-list vo mt qu trnh hay mt cng giao tip, ngi qun tr phi nh ngha cc tiu ch cho access-list. Mi dng trong prefix-list c kt hp vi mt ch s, tng t nh cc dng trong mt chng trnh my tnh. Nu ta khng nhp vo ch s th t (sequence-number), ch s ny s c t ng to ra, vi mi ln tng l 5. Cc s khng c dng, chng hn nh t 1 n 4 cho php cc dng thm vo v sau. Ta c th son tho prefix-list bng cch ch ra ch s dng hoc sequence-number. Kh nng ny l khng c trong ACL. Prefix-list hot ng bng cch tm cc prefix trong danh sch ph hp vi cc prefix ang kim tra. Nu mt iu kin kim tra ph hp xy ra, tuyn s c dng hay b loi b. C th, khi c mt prefix b t chi hoc c cho php, cc lut sau s c dng: - Nu mt tuyn c cho php, tuyn s c dng - Nu mt tuyn b t chi, tuyn s khng c dng - Kt thc ca mi prefix-list l mt pht biu ngm nh t chi tt c cc tuyn. Nh vy, nu cho trc mt tuyn m tuyn ny khng ph hp vi mt u vo trong prefix-list, prefix s b t chi theo lut mc nh. - Nu c nhiu u vo trong mt prefix list ph hp vi mt tuyn, u vo c ch s sequence number nh nht s c dng. - Router bt u tm kim nh ca prefix-list, vi ch s sequence-number bng 1. Khi mt thng tin lc tuyn ph hp c tm thy, qu trnh tm kim kt thc. Thi gian x l s c gim nu cc iu kin match/deny c t u ca danh sch. iu ny ngn nga vic phi x l cc iu kin him khi gp mi khi mt tuyn c kim tra. - Cc ch s sequence number t ng gia tng theo mc nh. cu hnh sequence-number, dng thng s seq seq-value trong lnh ip prefix-list. - Ch s sequence number khng cn thit ch ra khi xa mt dng trong cu hnh.
Cu hnh BGP prefix-list

64

Dng lnh sau cu hnh prefix-list: Router(config-router)#ip prefix-list prefix-list-name [seq seq-value] {deny| permit} network/len [ge ge-value] [le le-value] Thng s (Parameter) Prefix-list-name [ seq seq-value ] {deny | permit} Network/len [ge ge] [le le_value] M t (Description) Tn ca prefix-list S th t c gn n tiu chun ang nh ngha Hnh ng l t chi hoc cho php i vi kt qu chiu di ca prefix phi ph hp Ch ra chiu di ca prefix cn phi ph hp

cu hnh mt router dng prefix-list nh l tc v lc trong distribute-list, dng lnh sau: Router(config-router)#neighbor {ip address|peer-group} prefix-list prefix-listname {in|out}

KT LUN

65

Vi s pht trin ngy cng mnh m ca mng Internet, ti nghin cu Tng quan giao thc nh tuyn BGP trn router Cisco l ti thc t gip ngi c tip cn v c hiu bit c bn v cch thc nh tuyn gia cc vng t tr, mt thnh phn quan trng trn Internet . ti gp phn gip cho tc gi v nhng ngi tham kho: - Hiu v nm c cc thuc tnh, gii thut c s dng trong BGP nh tuyn. - Hiu r vai tr, hot ng v cu trc cc thng bo ca EBGP v IBGP trong h thng mng ngy nay. - Cc phng php gii quyt vn full mesh trong BGP. - Mt s phng php c s dng kim sot lu lng trong BGP. Mc d t c mt s kt qu nu trn nhng do iu kin thi gian v thit b thc nghim cn hn ch nn vic nghin cu giao thc BGP trn nn Ipv6 cha th c thc hin. ti c th c m rng nghin cu v trin khai giao thc BGP cng cc giao thc IGP da trn phn mm m phng GNS3. Vic nghin cu hot ng ca BGP trn h thng Ipv6 cng l mt vn cn c quan tm khi h thng Ipv4 ang ngy cng cn kit.

66

TI LIU THAM KHO

[1] [2] [3] [4] [5]

CCNP Self-Study, CCNP BSCI Exam Certification Guide, Third Edition. Cisco Press. 2004 CCIE 350-001 Routing and Switching Prep Kit. BareWolf, Inc. 2000 Routing FirstStep By Bill Parkhurst. Cisco Press. 2004 http://www.cisco.com http://www.vnpro.org

67