You are on page 1of 95

I HC NNG

TRNG I HC BCH KHOA

KHOA CNG NGH THNG TIN


Tel. (84-511) 736 949, Fax. (84-511) 842 771 Website: itf.ud.edu.vn, E-mail: cntt@edu.ud.vn

LUN VN TT NGHIP K S
NGNH CNG NGH THNG TIN
M NGNH : 05115

TI : TM HIU CNG NGH MPLS VPN QoS


M s : 06T1 013 06T4 007 Ngy bo v : 15 16/06/2011

SINH VIN : Nguyn Hu Nguyn Ph Duy LP : 06T1 06T4 CBHD : Nguyn Th Xun Ly

NNG, 06/2011

LI CM N
Ti xin chn thnh cm n cc thy c trong khoa Cng ngh Thng tin cng nh cc thy c ging dy trong trng i hc Bch khoa Nng truyn t nhng kin thc qu bu cho ti trong nhng nm hc va qua. c bit ti xin chn thnh cm n thy gio Nguyn Th Xun Ly tn tnh hng dn, ng vin v gip ti trong sut thi gian thc hin ti. Xin chn thnh cm n cc anh ch trong Trung Tm KV2 Cng ty Mng Li Viettel tn tnh hng dn, gip em trong sut thi gian thc tp v lm ti ti cng ty. Xin chn thnh cm n cc bn trong khoa Cng ngh Thng tin ng h, gip , chia s kin thc, kinh nghim v ti liu c c cho ti trong qu trnh nghin cu v thc hin ti. Mt ln na xin chn thnh cm n!

LI CAM OAN
Ti xin cam oan : 1 2 3 Nhng ni dung trong lun vn ny l do ti thc hin di s hng dn trc tip ca thy Nguyn Th Xun Ly. Mi tham kho dng trong lun vn u c trch dn r rng tn tc gi, tn cng trnh, thi gian, a im cng b. Mi sao chp khng hp l, vi phm quy ch o to, hay gian tr,ti xin chu hon ton trch nhim. Sinh vin, Nguyn Hu Nguyn Ph Duy

Mc lc

MC LC
M U.........................................................................................................11
.I L do chn ti..........................................................................................................11 .II Mc ch v ngha ca ti...................................................................................11 .III Nhim v thc hin...................................................................................................12 .IV Hng gii quyt.......................................................................................................12 .V Ni dung lun vn......................................................................................................12

C S L THUYT....................................................................................13
.I Tng quan v MPLS....................................................................................................13 .I.1. nh tuyn v chuyn mch gi truyn thng..................................................13 .I.1.1. nh tuyn IP................................................................................................13 .I.1.2. Chuyn mch ATM........................................................................................14 .I.1.3. M hnh IP over ATM...................................................................................15 .I.2. Cc khi nim c bn trong MPLS...................................................................16 .I.2.1. Min MPLS (MPLS Domain)........................................................................16 .I.2.2. Lp chuyn tip tng ng FEC...............................................................17 .I.2.3. Nhn v ngn xp nhn.................................................................................17 .I.2.4. ng chuyn mch nhn LSP.....................................................................18 .I.3. M ha nhn v cc ch ng gi nhn ......................................................18 .I.3.1. M ha ngn xp nhn..................................................................................18 .I.3.2. Ch khung (frame mode)..........................................................................19 .I.3.3. Ch t bo (cell mode).............................................................................19 .I.4. Kin trc mt nt MPLS...................................................................................21 .I.5. Giao thc phn phi nhn LDP........................................................................21 .I.5.1. Hot ng ca LDP.......................................................................................22 .I.5.2. Cu trc thng ip LDP..............................................................................23 .I.5.3. Ch phn phi nhn.................................................................................25 .I.5.4. Ch duy tr nhn.......................................................................................26 .I.5.5. Ch iu khin..........................................................................................27 .I.5.6. Qu trnh phn phi nhn.............................................................................28 .I.6. Phng thc hot ng ca MPLS...................................................................31 .I.7. u im v cc ng dng ca MPLS...............................................................31 .I.7.1. u im.........................................................................................................31 .I.7.2. Nhc im....................................................................................................32 .I.7.3. Cc ng dng................................................................................................32

TNG QUAN CNG NGH MPLS VPN V QOS TRONG MNG MPLS..............................................................................................................33
.I Cng ngh MPLS VPN................................................................................................33 .I.1. Khi nim VPN.................................................................................................33 .I.2. M hnh VPN....................................................................................................33 .I.3. So snh VPN truyn thng v MPLS VPN......................................................34 .I.3.1. VPN truyn thng..........................................................................................34 .I.3.2. MPLS VPN....................................................................................................35 .I.4. M hnh MPLS VPN........................................................................................36

Mc lc

ii

.I.5. Kin trc v qu trnh vn hnh ca VPN trong MPLS...................................38 .I.5.1. Qu trnh chuyn tip nh tuyn o VRF.....................................................38 .I.5.2. Route Distinguisher (RD)..............................................................................39 .I.5.3. Route Target (RT)..........................................................................................40 .I.6. Phn tn tuyn trong mng MPLS VPN...........................................................41 .I.7. Chuyn tip gi tin trong mng MPLS VPN....................................................42 .II QoS trong mng MPLS..............................................................................................43 .II.1. M u.............................................................................................................43 .II.2. nh ngha QoS...............................................................................................44 .II.3. Mt s khi nim trong QoS...........................................................................44 .II.3.1. Cc tham s c bn......................................................................................44 .II.3.2. Cp dch v GoS.....................................................................................44 .II.3.3. Tha thun mc dch v SLA..................................................................45 .II.4. Cc m hnh QoS.............................................................................................45 .II.5. M hnh dch v phn bit DiffServ................................................................46 .II.5.1. Kin trc DiffServ........................................................................................46 .II.5.2. im m dch v phn bit DSCP...............................................................47 .II.5.3. i x tng chng PHB...............................................................................49 .II.5.4. Phn loi v quy nh lu lng.................................................................51 .II.5.5. MPLS h tr DiffServ..................................................................................55 .II.5.6. Cc m hnh DiffServ Tunnel trong MPLS..................................................57 .II.5.7. Thc hin QoS trong min MPLS................................................................60

PHN TCH THIT K H THNG.......................................................61


.I Phn tch trang web m phng chia s d liu trc tuyn...........................................61 .I.1. Thu thp yu cu...............................................................................................61 .I.2. c t yu cu...................................................................................................61 .I.2.1. Cc thut ng................................................................................................61 .I.2.2. Yu cu chc nng...................................................................................61 .I.2.3. Yu cu phi chc nng..................................................................................62 .I.3. Xy dng biu Use Case ..........................................................................63 .I.3.1. Nhn dng tc nhn......................................................................................63 .I.3.2. Nhn dng cc Use Case ...........................................................................63 .I.3.3. Xy dng biu Use Case.......................................................................64 .I.4. M hnh ha s tng tc gia cc i tng..................................................64 .I.4.1. Biu hot ng.........................................................................................64 .I.4.2. Biu tun t..............................................................................................67 .I.5. Thit k c s d liu........................................................................................68 .II Phn tch bi m phng chia s d liu qua mng MPLS .........................................68 .II.1. Phn tch yu cu.............................................................................................68 .II.2. Thit k m phng...........................................................................................69 .II.3. Cc giao thc s dng trong bi lab................................................................69 .II.4. Cc phn mm s dng trong bi lab..............................................................69

KT QU TH NGHIM...........................................................................71
.I Kt qu trang web m phng chia s d liu trc tuyn.............................................71 .I.1. Trang ch..........................................................................................................71 .I.2. Chc nng upload.............................................................................................71 .I.3. Chc nng delete...............................................................................................72 .II Kt qu bi m phng vic trin khai QoS trong mng MPLS..................................73

Mc lc

iii

.II.1. Quy hoch a ch IP cho cc thit b..............................................................73 .II.2. Kt qu.............................................................................................................74

KT LUN....................................................................................................78
.I Kt qu t c..........................................................................................................78 .I.1. L thuyt...........................................................................................................78 .I.2. M phng..........................................................................................................78 .II Hn ch.......................................................................................................................78 .III Hng pht trin........................................................................................................78

Danh mc hnh nh

DANH MC HNH NH
HNH 1. QU TRNH CHUYN TIP GI TIN IP................................14 HNH 2. MNG CHUYN MCH ATM..................................................14 HNH 3. KT NI FULL MESH VI 4 ROUTER..................................15 HNH 4. KT NI FULL MESH VI 6 ROUTER..................................15 HNH 5. MIN MPLS..................................................................................16 HNH 6. UPSTREAM V DOWNSTREAM LSR.....................................17 HNH 7. LP CHUYN TIP TNG NG TRONG MNG MPLS .........................................................................................................................17 HNH 8. NGN XP NHN........................................................................18 HNH 9. NG CHUYN MCH NHN..............................................18 HNH 10. CU TRC NHN MPLS..........................................................19 HNH 11. SHIM HEADER C CHN VO GIA HEADER LP 2 V HEADER LP 3 ....................................................................................19 HNH 12. NHN TRONG CH T BO...........................................20 HNH 13. NG GI GI TIN C NHN TRN LIN KT ATM...20 HNH 14. KIN TRC MT NT MPLS.................................................21 HNH 15. VNG HOT NG CA LDP...............................................22 HNH 16. QU TRNH TRAO I THNG IP LDP .......................23 HNH 17. NH DNG LDP PDU HEADER............................................23 HNH 18. NH DNG THNG IP LDP.............................................24 HNH 19. PHN PHI NHN T NGUYN...........................................26 HNH 20. PHN PHI NHN THEO YU CU.....................................26 HNH 21. CH DUY TR NHN T DO...........................................27 HNH 22. CH DUY TR NHN BO TON...................................27 HNH 23. IU KHIN C LP............................................................28 HNH 24. IU KHIN TUN T............................................................28 HNH 25. QU TRNH XY DNG BNG NH TUYN...................29 HNH 26. QU TRNH GN NHN..........................................................29 HNH 27. QU TRNH PHN PHI NHN............................................30 HNH 28. CP NHT NHN VO BNG LIB........................................30

Danh mc hnh nh

ii

HNH 29. QUNG B NHN.....................................................................30 HNH 30. HON THNH VIC THIT LP LSP..................................31 HNH 31. MNG RING O VPN............................................................33 HNH 32. M HNH VPN SITE SITE SITE ......................................34 HNH 33. M HNH M HA THNG THNG................................35 HNH 34. M HNH PHN TCH DA VO VRF TRONG MPLS VPN .........................................................................................................................36 HNH 35. M HNH MPLS VPN................................................................36 HNH 36. NG I T SITE 1 N SITE 2........................................37 HNH 37. M T CC BNG NH TUYN O TRONG PE.............38 HNH 38. M T NH DNG RD...........................................................39 HNH 39. RT TRONG MPLS VPN EXTRANET......................................40 HNH 40.CC BC PHN TN TUYN T ROUTER CE SITE A N SITE B...................................................................................................42 HNH 41. QU TRNH CHUYN TIP GI TIN TRONG MNG MPLS VPN.................................................................................................................43 HNH 42. M HNH DCH V TCH HP INTSERV...........................45 HNH 43. SO SNH INTSERV VI DIFFSERV......................................46 HNH 44. CC THNH PHN TRONG KIN TRC DIFFSERV.......47 HNH 45. TRNG TOS TRONG IP HEADER TRC V SAU KHI C DIFFSERV..............................................................................................48 HNH 46. CU TRC TRNG DS..........................................................48 HNH 47. THUT TON MT THNG TOKEN...................................52 HNH 48. THUT TON HAI THNG TOKEN.....................................53 HNH 49. TNH NNG SHAPING.............................................................55 HNH 50. MIN MPLS S DNG E LSP .............................................56 HNH 51. MIN MPLS S DNG L LSP .............................................57 HNH 52. M HNH UNIFORM TRONG MPLS DIFFSERV TUNNEL58 HNH 53. M HNH PIPE TRONG MPLS DIFFSERV TUNNEL........59 HNH 54. M HNH SHORT PIPE TRONG MPLS DIFFSERV TUNNEL .........................................................................................................................59 HNH 55. NH X GI TR DSCP VO CC BIT EXP.......................60 HNH 56. BIU USE CASE CHC NNG CA NGI DNG 64

Danh mc hnh nh

iii

HNH 57. BIU HOT NG CHC NNG UPLOAD FILE...65 HNH 58. BIU HOT NG CHC NNG DOWNLOAD FILE .........................................................................................................................66 HNH 59. BIU HOT NG CHC NNG DELETE FILE. . .66 HNH 60. BIU TUN T CHC NNG UPLOAD FILE.........67 HNH 61. BIU TUN T CHC NNGDOWNLOAD FILE...67 HNH 62. BIU TUN T CHC NNG DELETE FILE..........68 HNH 63. M HNH MNG THC T....................................................69 HNH 64. GIAO DIN CHNH CA TRANG WEB................................71 HNH 65. GIAO DIN CHC NNG UPLOAD......................................72 HNH 66. CHC NNG DELETE.............................................................72 HNH 67. M HNH MNG BI LAB......................................................73 HNH 68. KT QU PING T SERVER N CLIENT........................74 HNH 69. KT QU PING T CLIENT N SERVER........................75 HNH 70. TC TI FILE KHI CHA P DNG QOS...................76 HNH 71. TC TI FILE KHI P DNG QOS................................77

Danh mc bng

DANH MC BNG
BNG 1. CC KIU BN TIN LDP..........................................................25 BNG 2. BNG NH X GI TR DSCP V PHB................................49 BNG 3. CC PHB AF VI U TIN HY GI TNG NG. .50 BNG 4. QUAN H GIA GI TR IP PREDENCE V B LA CHN LP CS...........................................................................................................50 BNG 5. SO SNH E LSP VI L LSP ..............................................57 BNG 6. BNG C S D LIU CA TRANG WEB..........................68 BNG 7. BNG QUY HOCH A CH IP CHO MY SERVER V MY CLIENT...............................................................................................73 BNG 8. BNG QUY HOCH A CH IP CHO CC ROUTER CE.73 BNG 9. BNG QUY HOCH A CH IP CHO CC LSR.................74

Danh mc t vit tt

DANH MC T VIT TT
T vit tt AS ASN ATM AtoM BGP B-ISDN CE CEF CIDR CLP CPE CSR DLCI DoS DS TE eBGP EGP EIGRP FEC FIB FR GFC GRE HDLC HEC iBGP IANA ICMP IGP IP IPSec IPv4 ISDN ISP L2TP LDP LER LFIB LIB LSP LSR MED T ting Anh Autonomous System Autonomous System number Asynchronous Transfer Mode Any Traffic over MPLS Border Gateway Protocol Broadband Integrated Services Digital Network Customer Edge Cisco Express Forwarding Classless Interdomain Routing Cell Loss Priority Customer Premise Equipment Cell Switch Router Data Link Connection Identifier Denial of Service DiffServ aware Traffic Engineering External Border Gateway Protocol Exterior Gateway Protocol Enhanced Interior Gateway Routing Protocol Fowarding Equivalent Class Forwarding Information Base Frame Relay Generic Flow Control Generic Routing Encapsulation High Level Data Link Control Header Error Check Internal Border Gateway Protocol Internet Assigned Numbers Authority Internet Control Message Protocol Interior Gateway Protocol Internet Protocol Internet Protocol Security Internet protocol v4 Integrated Services Digital Network Internet Service Provider Layer 2 Tunneling Protocol Label Distribute Protocol Label Edge Router Label Forwarding Information Base Label Information Base Label Switched Path Label Switch Router Media Endpoint Discovery

Danh mc t vit tt

ii

MP BGP MPLS MTU NBMA NGN OSI OSPF PE PPP PPTP PT PVC QoS RD RIB RT SP SDN SVC SONET SDH TCP TE ToS TTL UDP VC VCI VLSM VPI VPDN VPN VRF WAN

Multiprotocol BGP Multiprotocol Label Switching Maximum Transmission Unit Non-Broadcast Multiple Access Next Generation Network Open Systems Interconnection Open Shortest Path First provider edge Point to Point Protocol Point-to-Point Tunneling Protocol Payload Type permanent virtual circuit Quality of Service Route Distinguisher Routing Information Base Route Target Service Provider Software Defined Networks Switch virtual circuit Synchronous Optical NETwork Synchronous Digital Hierarchy Transport Control Protocol Traffic Engineering Type of Service Time To Live User Datagrame Protocol Virtual channel Virtual Channel Identifier Variable Length Subnet Mask Virtual Path Identifier Virtual private dial-up network Virtual Private Network Virtual Routing and Forwarding Table Wide Area Network

M U
.I L do chn ti

S pht trin nhanh chng ca cc dch v IP v s bng n thng tin trn mng Internet dn n s nhn thc mi trong vn kinh doanh ca cc nh cung cp dch v. Lu lng ln nht hin nay trn mng trc chnh l lu lng IP. Giao thc IP gi vai tr ch o trong ton b cc giao thc lp mng, h qu l tt c cc xu hng pht trin cng ngh lp di u h tr cho IP. Nhu cu cp bch ca th trng cho mt kt ni tc cao vi chi ph thp l c s cho mt lot cc cng ngh mi ra i, trong c MPLS. Trong khong 5 nm gn y l khong thi gian m cng ngh MPLS chng minh c tnh ng dng thc tin cc tnh nng vt tri ca n so vi cc cng ngh chuyn mch truyn thng khc nh ATM. Tp on Vin thng Qun i Viettel, trong c Cng ty Mng li Viettel, mt thnh vin ca Tp on, ni chng ti ang thc tp, la chn MPLS lm cng ngh cho lp truyn ti ca mng NGN ang trin khai trn phm vi ton quc. Chnh v tm quan trng ca cng ngh MPLS trong mng ca cc ISP hin nay, cng nh thc t cng vic m chng ti ang thc hin ti Trung tm Khu vc II Cng ty Mng Li Viettel, chng ti quyt nh chn ti Tm hiu cng ngh MPLS, trin khai cht lng dch v v.mng ring o trong mng MPLS. Cht lng dch v v mng ring o VPN chnh l hai dch v ch yu trong s cc dch v m cng ngh MPLS h tr. Hai dch v ny chnh l i tng nghin cu ca chng ti xuyn sut ti tt nghip ny.

.II Mc ch v ngha ca ti
Mt trong nhng ng dng ph bin nht trn Internet hin nay chnh l vic chia s d liu. D liu c ti ln v ti xung trn mng Internet vi dung lng ngy cng ln lm tng tr, gim tc m ngi s dng mong mun khi ng k vi nh cung cp dch v. Chnh v vy, mc ch ca ti l xy dng mt m hnh mng chy trn nn cng ngh MPLS v thc hin cht lng dch v trong mng ny ci thin cht lng vic chia s d liu trn mng. ng thi vn bo mt cng v cng trong h thng mng ngy nay, vic trin khai VPN trn nn cng ngh MPLS s l mt gii php bo mt rt tin li v ti u cho ngi dng. Vic xy dng mt m hnh mng chy MPLS m phng cng ngh m cc ISP ang trin khai trn thc t (c th l ti Cng ty Mng li Viettel) v hiu c cch h cung cp cho ngi s dng ng truyn tc cao vi chi ph hp l.

Nguyn Hu Nguyn Ph Duy

11

Tm hiu cng ngh MPLS VPN Q oS

.III Nhim v thc hin


Tm hiu tng quan v cng ngh MPLS, cc thnh phn trong mt h thng mng chy MPLS, kin trc ca MPLS. Tm hiu v cng ngh MPLS VPN, m hnh VPN p dng trong mng MPLS. Tm hiu v QoS trong mng MPLS, m hnh QoS p dng trong mng MPLS. Tin hnh xy dng h thng mng m phng cch truyn gi tin bng cng ngh MPLS. Tin hnh xy dng trang Web phc v kim tra QoS trong mng MPLS.

.IV Hng gii quyt


xy dng mt h thng mng trin khai cng ngh MPLS cn phi nghin cu cc ni dung ch yu sau y: C s l thuyt v cng ngh MPLS, cng ngh MPLS VPN v QoS trong mng MPLS. Cc thnh phn cn c trong mt mng chy MPLS.

.V

Ni dung lun vn

Lun vn tt nghip c t chc thnh 4 chng vi cc ni dung chnh sau y: Chng 1 C s l thuyt: Gii thiu tng quan cng ngh MPLS, cc khi nim c bn, kin trc chc nng v c ch hot ng ca MPLS. Chng 2 Cng ngh MPLS VPN v QoS trong mng MPLS: Trnh by khi nim v QoS, cc m hnh QoS, QoS trong mng MPLS; trnh by cc m hnh VPN v cng ngh MPLS VPN. Chng 3 Phn tch thit k h thng Chng 4 Kt qu v nh gi

Nguyn Hu Nguyn Ph Duy

12

CHNG I

C S L THUYT
.I Tng quan v MPLS
Trong mt vi nm gn y, Internet pht trin thnh mt mng li rng khp v to ra mt lot cc ng dng mi trong thng mi. Nhng ng dng ny mang n i hi phi tng v bo m c yu cu bng thng trong mng ng trc. Thm vo , ngoi cc dch v d liu truyn thng c cung cp qua Internet, thoi v cc dch v a phng tin ang c pht trin v trin khai. Internet lm ny sinh vn hnh thnh mt mng hi t cung cp y cc dch v. Tuy nhin vn t ra i vi mng bi cc dch v v ng dng mi l yu cu v bng thng v tc li t gnh nng cho ngun ti nguyn trn c s h tng Internet c sn. Mt thch thc khc lin quan ti vic truyn cc byte v bit qua mng ng trc cung cp cc cp dch v khc nhau i vi ngi dng. S pht trin nhanh chng ca s ngi dng v lu lng lm tng thm s phc tp ca vn . Vn cp dch v (GoS) v cht lng dch v (QoS) phi c quan tm c th p ng c nhng yu cu khc nhau ca lng ln ngi dng mng. Nhu cu v mt phng thc chuyn tip n gin m cc c tnh qun l lu lng v cht lng vi phng thc nh tuyn, chuyn tip thng minh l mt yu cu cp thit. Tt c cc yu cu c th c p ng bi cng ngh MPLS. MPLS l vit tt ca t Multiprotocol Label Switching, cn gi l Chuyn mch nhn a giao thc. Thut ng multiprotocol nhn mnh rng cng ngh ny c p dng cho tt c cc giao thc lp Network ch khng ch ring c giao thc IP. MPLS cng hot ng tt trn bt k giao thc lp Data Link. y l mt cng ngh lai kt hp nhng c tnh tt nht ca nh tuyn lp 3 (routing) v chuyn mch lp 2 (switching).

.I.1.
.I.1.1.

nh tuyn v chuyn mch gi truyn thng


nh tuyn IP

IP l thnh phn chnh trong kin trc mng Internet. Trong kin trc ny, IP ng vai tr l giao thc lp 3 v n nh ngha c ch nh a ch, c ch truyn tin v cc chc nng iu khin mc thp (ICMP). Gi tin IP c cha a ch ca bn nhn v cc thng tin cn cho vic chuyn gi tin n ch. u im ca m hnh TCP/IP l kh nng nh tuyn v truyn gi tin mt cch mm do, linh hot. Nhng IP khng m bo cht lng dch v v tc truyn tin theo yu cu.

Nguyn Hu Nguyn Ph Duy

13

Tm hiu cng ngh MPLS VPN Q oS

Hnh 1. Qu trnh chuyn tip gi tin IP

.I.1.2.

Chuyn mch ATM

ATM l mt k thut truyn tin tc cao. ATM nhn thng tin nhiu dng khc nhau nh thoi, video, d liu v ct ra thnh nhiu phn nh gi l t bo (cell). Cc t bo ny c truyn qua cc mch o VC. V ATM c th truyn cc t bo trn nhiu cng ngh bng rng khc nhau nn n c xem l cng ngh chuyn mch hng u. Cng ngh ATM c th mnh u vit v tc truyn tin cao, m bo thi gian thc v cht lng dch v theo yu cu nh trc. Nhng ATM cng c nhc im l tn bng thng (do mi t bo c kch thc n 53 bytes), nn gi tin nh b hn ch tc dng khi tc ng truyn vt l tng nhiu.
Engineering R&D

ATM Backbone

Sales

Security

Marketing

Hnh 2. Mng chuyn mch ATM Nguyn Hu Nguyn Ph Duy 14

Tm hiu cng ngh MPLS VPN Q oS

.I.1.3.

M hnh IP over ATM

IP v ATM l hai cng ngh thuc hai lp khc nhau trong m hnh OSI. Cc ATM switch ch vn chuyn lu lng da trn gi tr VPI/VCI m cc router IP khng th nhn bit. Tng t, cc router IP l cc thit b lp 3, ch quan tm n vic chuyn tip gi tin da trn cc thng tin cha trong gi tin, m cc ATM switch khng th hiu c cc thng tin ny. cho php kh nng d phng ti a v nh tuyn ti u, mt thit k full mesh cc VC phi c thit lp, dn n vic sinh ra m hnh overlay. Tuy nhin, vn ln nht i vi m hnh overlay chnh l kh nng m rng. Cng c nhiu node c thm vo mng core th cng yu cu nhiu VC to mt thit k full mesh. S lng VC c thit lp s tnh theo cng thc: n(n 1)/2, vi n l s lng router.
Gi s, c 4 router c kt ni vi nhau theo kiu full mesh, th ch cn c 6 VC.

Hnh 3. Kt ni full mesh vi 4 router

Tuy nhin, khi thm vo 2 router th tng s router l 6. Lc ny, s lng VC cn thit lp ln n 15 VC.

Hnh 4. Kt ni full mesh vi 6 router

Nguyn Hu Nguyn Ph Duy

15

Tm hiu cng ngh MPLS VPN Q oS

Khng ch vn m rng vi s lng VC phi thit lp thc hin thit k full mesh, m cn c vn m rng vi cc giao thc nh tuyn s dng trong mng. Khi cng nhiu VC c thit lp, th cc router phi thit lp mi quan h lng ging vi cc router khc cng nhiu. Tt c cc router phi trao i thng tin cp nht bng nh tuyn vi nhau, to ra mt lng thng tin rt ln trn mng. Lu lng qu ln ny s tiu th nhiu ti nguyn trn cc router v lm chng x l chm i. Chnh v vy, cng ngh MPLS c xut ti cc gi tin trn cc VC v khc phc c cc vn nu trn p ng cc nhu cu dch v ca ngi s dng.

.I.2.
.I.2.1.

Cc khi nim c bn trong MPLS


Min MPLS (MPLS Domain)

Min MPLS (MPLS Domain) l mt tp hp cc nt mng thc hin hot ng nh tuyn v chuyn tip MPLS. Mt min MPLS thng c qun l v iu khin bi mt nh qun tr.

Hnh 5. Min MPLS

Min MPLS c chia lm 2 phn: phn mng li (core) v phn mng bin (edge). Cc nt thuc min MPLS c gi l router chuyn mch nhn LSR (Label Switch Router). Cc nt phn mng li c gi l transit LSR. Cc LSR bin c gi l cc LSR bin hay gi tt l LER (Label Edge Router). Nu mt LER l nt u tin trn ng i ca mt gi tin khi i qua min MPLS th n c gi l LER ng vo (ingress LER), cn nu l nt cui cng th c gi l LER ng ra (egress LER). Cc thut ng ny ch c ngha tng i ty theo chiu ca lung lu lng trong mng, do mt LER c th va l LER ng vo, va l LER ng ra ty theo cc lung lu lng ang xt.

Nguyn Hu Nguyn Ph Duy

16

Tm hiu cng ngh MPLS VPN Q oS

Hnh 6. Upstream v Downstream LSR

Thut ng upstream LSR v downstream LSR c s dng ph thuc vo chiu ca lung lu lng. .I.2.2. Lp chuyn tip tng ng FEC

FEC l mt nhm cc gi, nhm cc gi ny chia s cng yu cu trong s chuyn tip chng qua mng. Tt c cc gi trong mt nhm nh vy c cung cp cng cch chn ng ti ch. Khc vi chuyn tip IP truyn thng, trong MPLS vic gn mt gi c th vo mt FEC c th ch c thc hin mt ln khi cc gi vo trong mng. MPLS khng ra quyt nh chuyn tip vi mi datagram lp 3 m s dng khi nim FEC. FEC ph thuc vo mt s cc yu t, t nht l ph thuc vo a ch IP v c th l ph thuc c vo kiu lu lng trong datagram (thoi, d liu, fax).

Hnh 7. Lp chuyn tip tng ng trong mng MPLS

.I.2.3.

Nhn v ngn xp nhn

Nhn l mt b nhn dng ngn, c di c nh, ch c ngha ni b v c s dng xc nh mt FEC. Nhn c dn ln mt gi i din cho mt FEC m gi tin c gn vo. Mt gi tin c th c dn chng nhiu nhn, cc nhn ny c cha trong mt ni gi l ngn xp nhn (label stack). Ti mi hop trong mng ch x l nhn trn cng trong ngn xp nhn. Chnh nhn ny c LSR s dng chuyn tip gi.
Nguyn Hu Nguyn Ph Duy 17

Tm hiu cng ngh MPLS VPN Q oS

Hnh 8. Ngn xp nhn

Nu gi tin cha c nhn th ngn xp nhn l rng ( su ngn xp l 0). Nu ngn xp nhn c chiu su l d th nhn y ngn xp s thit lp bit S ln bng 1. Mt entry nhn c th gn thm vo (push) hoc ly ra khi (pop) ngn xp nhn. .I.2.4. ng chuyn mch nhn LSP

Mi mt gi tin khi tham gia mng MPLS ti LSR vo v ra khi mng MPLS ti mt LSR ng ra. C ch ny to ra ng chuyn mch nhn LSP (Label Switched Path), c m t nh l mt nhm cc LSR m cc gi tin c gn nhn phi i qua ti LSR ng ra cho mt FEC c th. LSP ny ch theo mt hng duy nht, c ngha l mt LSP khc c s dng cho lu lng c th tr v t mt FEC no . LSP l hng kt ni (connection-oriented) bi v ng dn c to ra trc khi c s vn chuyn lu lng. Tuy nhin, vic thit lp kt ni ny da trn thng tin v m hnh mng hn l yu cu v lung lu lng. Khi gi tin i qua mng MPLS, mi LSR s hon i nhn i vo vi mt nhn i ra cho n LSR cui cng.

Hnh 9. ng chuyn mch nhn

.I.3.
.I.3.1.

M ha nhn v cc ch ng gi nhn
M ha ngn xp nhn

Khi nhn c gn ln gi tin, bn thn gi tr nhn 20 bit s c m ha cng vi mt s thng tin cng thm ph tr trong qu trnh chuyn tip gi. Mt nhn header c di c nh gm 32 bit chia lm 4 trng c m t nh hnh sau:

Nguyn Hu Nguyn Ph Duy

18

Tm hiu cng ngh MPLS VPN Q oS

Hnh 10. aCu trc nhn MPLS L bel

20 Nhn: trng ny c di 20-b i ts tc l c ti 220 = 1.048.576 gi tr nhn. bit,

EX P 3 -b i ts

T i m e -T o -L i v e (T T L ) 2 0 -b i ts

EXP (Experimental): trng ny c di 3 bit, dng nh x trng ToS (Type of Service) hay DSCP (Differentiated Service Code Point) trong gi tin IP vo trng EXP phc v cho mc ch QoS. S (Stack): trng ny c di 1 bit, dng ch nh nhn no cui mt ngn xp nhn. Nhn cui ngn xp th trng S s c gi tr bng 1. TTL (Time To Live): trng ny c di 8 bit, l bn sao ca trng TTL trong IP header. Gi tr trong trng ny gim ti mi hop ngn vic lp nh tuyn. Trng ny cng c th thit lp khc vi trng TTL trong IP header trong trng hp nh cung cp mng mun che du cu trc lin kt mng i vi th gii bn ngoi. MPLS c th hot ng ch khung v ch t bo. .I.3.2. Ch khung (frame mode)

Ch khung l thut ng dng ch vic chuyn tip mt gi tin vi ngn xp nhn c chn vo gia header lp 2 v header lp 3. nh ngn xp nm lin sau header lp 2 v y ngn xp nm lin trc header lp 3.

Ethernet Header

Ethernet Header

Label Stack

IP Header

Data

Shim Header

PPP Header Hnh over SONET/SDH Packet 11. Shim header

c PPP Header gia header IP Header header lp Data chn vo Label Stack lp 2 v 3

Router gi khung (frame) phi c cch bo cho router nhn bit rng khung ny c cha shim header. Cch thc bo hiu khc nhau gia cc k thut lp 2. Ethernet s dng cp gi tr Ethertype 0x8847 v 0x8848 ch th cc khung ang mang gi MPLS unicast v multicast tng ng. PPP s dng NCP (Network Control Protocol) sa i gi l MPLSCP (MPLS Control Protocol) v nh du tt c cc gi c cha shim header bng gi tr 0x8281 trong trng PPP Protocol. .I.3.3. Ch t bo (cell mode)

Ch t bo c s dng khi ta c mt mng gm cc ATM LSR (l cc ATM switch c h tr MPLS), trong n s dng cc giao thc phn phi nhn MPLS trao i thng tin VPI/VCI thay v s dng bo hiu ATM.
Nguyn Hu Nguyn Ph Duy 19

Tm hiu cng ngh MPLS VPN Q oS

Trong ch t bo, nhn c m ha vo cc trng VPI/VCI ca t bo. Sau khi vic trao i nhn c thc hin mt phng iu khin, mt phng d liu, router ng vo chia nh gi tin thnh cc t bo ATM, p gi tr VPI/VCI thch hp vo, ri truyn cc t bo i. Cc ATM LSR trung gian vn chuyn tip cc t bo da trn gi tr VPI/VCI n v thng tin cng n nh ATM switch thng thng. Cui cng, router ng ra gn cc t bo li thnh mt gi tin.

ATM Cell Header

GFC

VPI

VCI

PTI

CLP

HEC

Data

Hnh 12. Nhn trong ch t bo

T bo ATM gm 5 bytes header v 48 bytes payload. chuyn ti gi tin c kch thc ln hn 48 bytes t lp trn a xung (v d gi tin IP), ATM phi chia gi tin thnh nhiu phn nh hn, qu trnh ny gi l phn on. Qu trnh phn on do lp AAL (ATM Adaption Layer) m nhim. C th, AAL5 PDU s c chia thnh nhiu on 48 bytes, mi on s c thm vo 5 bytes header to thnh mt t bo ATM.

Label

Hnh 13. ng gi gi tin c nhn trn lin kt ATM

Khi ng gi gi tin c nhn MPLS trn ATM switch, ton b ngn xp nhn c t trong AAL5 PDU. Gi tr thc s ca nhn trn nh ngn xp nhn c t trong trng VPI/VCI. Khi cc t bo ATM i n cui LSP, n s c kt hp li thnh gi tin IP bnh thng. Nu c nhiu nhn trong ngn xp nhn, AAL5 PDU s c phn on ln na v nhn hin hnh trn nh ngn xp s c t vo trng VPI/VCI.

Nguyn Hu Nguyn Ph Duy

20

Tm hiu cng ngh MPLS VPN Q oS

.I.4.

Kin trc mt nt MPLS

Kin trc mt nt MPLS gm 2 thnh phn: thnh phn chuyn tip (cn gi l mt phng chuyn tip) v thnh phn iu khin (cn gi l mt phng iu khin).

Hnh 14. Kin trc mt nt MPLS

Mt phng chuyn tip c chc nng nh tuyn IP dng giao tip vi cc LSR, LER khc hoc cc router IP thng thng bng cc giao thc nh tuyn IP. Kt qu l mt C s thng tin nh tuyn RIB (Routing Information Base) c to ra gm cc thng tin miu t cc tuyn kh thi tm n cc a ch prefix. LER s s dng cc thng tin ny xy dng C s thng tin chuyn tip FIB (Forwarding Information Base) trong mt phng chuyn tip. Mt phng iu khin cn c chc nng bo hiu MPLS giao tip vi cc LSR khc bng giao thc phn phi nhn LDP. Kt qu l mt C s thng tin nhn LIB (Label Information Base) gm cc thng tin lin quan n cc t hp nhn c thng lng vi cc router MPLS khc c to ra. Thnh phn bo hiu MPLS nhn thng tin t chc nng nh tuyn IP v LIB xy dng C s thng tin chuyn tip nhn LFIB (Label Forwarding Information Base) trong mt phng chuyn tip. Mt LER c th chuyn tip cc gi tin IP, gn nhn vo gi, hoc g nhn ra khi gi. Trong khi , mt transit LSR ch c kh nng chuyn tip gi tin c nhn, thm hoc b bt nhn.

.I.5.

Giao thc phn phi nhn LDP

LDP c thit k thit lp v duy tr cc LSP. Vng hot ng ca LDP c th l gia cc LSR lng ging trc tip hoc gin tip. Nguyn Hu Nguyn Ph Duy 21

Tm hiu cng ngh MPLS VPN Q oS

Trao i t xa Trao i cc b
LDP A B

Trao i cc b
LDP C

Hnh 15. Vng hot ng ca LDP

.I.5.1.

Hot ng ca LDP Pht hin lng ging (Neighbor discovery) Thit lp v duy tr phin (Session establishment and maintenance) Qung b nhn (Label advertisement) Thng bo (Notification)

LDP c 4 chc nng chnh l:

Tng ng vi cc chc nng ny, c 4 loi thng ip LDP c s dng: Discovery: s dng bn tin Hello c trao i nh k nhm kim tra mt LSR trc tip hoc gin tip. Session: s dng bn tin Initialization v Keepalive thit lp, thng lng cc thng s cho vic khi to, duy tr v chm dt cc phin LDP. Advertisement: s dng cc bn tin Label Mapping, Label Withdraw, Label Release, Label Request, Label Abort Request to ra, thay i hoc xa cc nh x FEC v nhn. Notification: s dng bn tin Notification truyn t thng tin trng thi, li v cnh bo. Bn tin Hello c trao i trn UDP. Cc kiu thng ip cn li i hi phn pht tin cy nn dng TCP. Trng hp hai LSR c kt ni lp 2 trc tip th th tc pht hin lng ging c thc hin nh sau:
Mt LSR nh k gi bn tin Hello ti a ch multicast 224.0.0.2 cng UDP 646. Cc LSR tip nhn bn tin Hello ny trn cng UDP 646. n mt thi im no LSR s bit c tt c cc LSR khc m n c kt ni trc tip. Khi LSR nhn bit c a ch cc LSR bng c ch ny th n s thit lp kt ni TCP n LSR . Khi , phin LDP c thit lp gia 2 LSR.

Phin LDP l song hng nn mi LSR 2 u kt ni u c th gi yu cu v gi lin kt nhn. i vi trng hp cc LSR kt ni khng trc tip th cc bn tin Hello c gi bng c ch unicast (vn s dng cng UDP 646). iu ny yu cu LSR phi bit
Nguyn Hu Nguyn Ph Duy 22

Tm hiu cng ngh MPLS VPN Q oS

trc n c LSR no l lng ging kt ni khng trc tip. iu ny thc hin thng qua vic cu hnh.

Hnh 16. Qu trnh trao i thng ip LDP

i vi trng hp cc LSR kt ni khng trc tip th cc bn tin Hello c gi bng c ch unicast (vn s dng cng UDP 646). iu ny yu cu LSR phi bit trc n c LSR no l lng ging kt ni khng trc tip. iu ny thc hin thng qua vic cu hnh. .I.5.2. Cu trc thng ip LDP

Mt bn tin LDP bt u vi mt PDU (Protocol Data Unit) header. Mi LDP PDU header c th mang theo mt hoc nhiu thng ip, cc thng ip ny khng nht thit phi lin quan vi nhau.
.1 nh dng LDP PDU Header

Hnh 17. nh dng LDP PDU header LDP PDU header gm cc trng sau: Version: gm 2 octets, trng ny c nh ngha bng 1. PDU Length: gm 2 octets, cha thng tin v di ca PDU bao gm bt c d liu mang theo trong gi tin sau phn PDU header. PDU Identifier: gm 6 octets, dng xc nh khng gian nhn c th. Bn octets u l LSR ID. Hai octets sau xc nh khng gian nhn bn trong LSR. Hai octets ny c thit lp l 0 i vi khng gian nhn per platform, v bng 1 i vi khng gian nhn per interface. .2 nh dng thng ip LDP Nguyn Hu Nguyn Ph Duy 23

Tm hiu cng ngh MPLS VPN Q oS

Cc thng ip LDP u c nh dng chung nh sau:

Hnh 18. nh dng thng ip LDP

Bit U (Unknown): lun lun bng 0 do khng c thng ip LDP no c nh ngha l Unknown. Trng Message Type: gm c cc kiu bn tin v gi tr tng ng nh sau:

Tn thng ip Notification Hello Initialization Keepalive Address Address Withdraw Label Mapping Label Request Label Release Label Withdraw Label Abort Request
Nguyn Hu Nguyn Ph Duy

Gi tr thng ip 0x0001 0x0100 0x0200 0x0201 0x0300 0x0301 0x0400 0x0401 0x0403 0x0402 0x0404
24

Tm hiu cng ngh MPLS VPN Q oS Bng 1. Cc kiu bn tin LDP

Trng Message Length: di (tnh bng bytes) ca tp hp cc trng sau trng ny, bao gm cc trng Message ID, Mandatory Parameters, Optional Parameters. Trng Message ID: thng c s dng lin kt mt s thng ip vi nhau. V d, mt thng ip phn hi cho mt thng ip khc s s dng cng Message ID ca thng ip m n ang phn hi n. Cc trng Mandatory Parameters v Optional Parameters ph thuc vo kiu thng ip c gi. Chng thng l b ba TLV (Type/Length/Value), mt cch m ha ph bin mt lng ty d liu bn trong mt gi tin.
.3 Cc bn tin LDP Hello: c trao i trong sut qu trnh hot ng LDP. Initialization: c gi khi bt u mt phin LDP gia 2 LSR thng lng cc tham s, cc ty chn cho phin. Nhng tham s ny bao gm phin bn, phng thc phn phi nhn (t nguyn hay yu cu), gi tr cc b nh thi, khong gi tr VPI/VCI, v.v Keepalive: c gi nh k trong sut mt phin LDP m bo cho mi thnh phn LDP bit rng cc thnh phn LDP khc vn ang hot ng tt. Trng hp khng xut hin bn tin Keepalive hay mt s bn tin LDP khc trong khong thi gian nht nh th LSR s xc nh lng ging LDP hng hoc kt ni c s c v phin LDP kt thc. Label Mapping: c s dng qung b t hp nhn FEC. Label Withdraw: thc hin qu trnh ngc li vi bn tin Label Mapping. N c LSR s dng thu hi t hp trc n gi. Label Release: thng bn tin ny dng xc nhn vic gii phng t hp nhn c xc nh trong bn tin Label Withdraw. Label Request: c s dng trong phng thc phn phi nhn theo yu cu, khi mt upstream LSR yu cu mt nhn t downstream LSR. Label Abort Request: nu bn tin Label Request cn phi hy b trc khi c chp nhn (do nt k tip trong FEC yu cu thay i), th LSR yu cu s loi b yu cu trc bng bn tin Label Abort Request.

.I.5.3.

Ch phn phi nhn

MPLS cho php cc LSR hot ng hai ch phn phi nhn, l: phn phi nhn t nguyn (Unsolicited Downstream) v phn phi nhn theo yu cu (Downstream on Demand DoD).
.1 Phn phi nhn t nguyn (Unsolicited Downstream)

Trong ch phn phi nhn t nguyn, mi LSR phn phi mt t hp nhn FEC ti cc LSR lng ging ca n, khng cn cc LSR yu cu nhn. Mt LSR s

Nguyn Hu Nguyn Ph Duy

25

Tm hiu cng ngh MPLS VPN Q oS

nhn c mt t hp nhn xa t mi LSR lng ging. Khi , trong bng LIB s hin th nhiu hn mt t hp nhn.

Upstream LSR

Downstream LSR

Hnh 19. Phn phi nhn t nguyn .2 Phn phi nhn theo yu cu (Downstream on Demand)
Phn phi t hp nhn - FEC

ch ny, upstream LSR yu cu mt nhn cho mt FEC c th th downstream LSR mi phn phi. Mi LSR ch nhn c mt nhn duy nht cho mt FEC. Trong bng LIB lc ny ch hin th duy nht mt t hp nhn FEC.

Upstream LSR

Yu cu nhn cho FEC

Downstream LSR

Hnh 20. Phn phi nhn theo yu cu

.I.5.4.

Ch duy tr nhn

Phn phi t hp nhn - FEC

Mt upstream LSR c th nhn cc t hp nhn cho cng mt FEC X t nhiu downstream LSR. C hai ch duy tr cc t hp nhn nhn c l ch duy tr nhn t do v ch duy tr nhn bo ton.
.1 Ch duy tr nhn t do (Liberal Label R etention) ch ny, LSR s gi tt c cc t hp nhn nhn c t downstream LSR v lu trong bng LIB. iu ny xy ra v khi trng thi ca mng thay i (do lin kt b t hoc mt nt mng hng), th cc LSR s cp nht li bng nh tuyn, v c th downstream LSR gi t hp nhn s tr thnh next hop ca upstream LSR.

Nguyn Hu Nguyn Ph Duy

26

Tm hiu cng ngh MPLS VPN Q oS

Gn nhn 16 cho mng X

X D

Gn nhn 21 cho mng X E

Hnh 21. Ch duy tr nhn t do

Ch ny lm tn khng gian trong bng LIB, nhng li y nhanh tc hi t ca mng do LSR khng cn phi i cc downstream LSR gi t hp nhn sau khi bng nh tuyn hi t.
.2 Ch duy tr nhn bo ton (Conversative Label Retention) mng X
Gn nhn 16 cho B C

Trong ch ny, upstream LSR hy tt c cc t hp nhn khc, ch gi li cc t hp nhn c gi t downstream LSR l next hop ca n. X
A D Gn nhn 21 cho mng X Cc entry trong LIB: FEC X - nhn 16 FEC X - nhn 21 E

Hnh 22. Ch duy tr nhn bo ton

u im ca ch ny l khng gian bng LIB c tit kim hn ch duy tr nhn t do. Tuy nhin, tc hi t li chm hn do phi yu cu v phn phi t hp nhn li. Ch ny thch hp vi cc LSR ch h tr mt s lng nhn hn ch (v d cc ATM switch). .I.5.5. Ch iu khin

Cc LSR c th to ra mt t hp nhn ni b cho mt FEC theo hai cch l: iu khin c lp v iu khin tun t.
Nguyn Hu Nguyn Ph Duy 27

Tm hiu cng ngh MPLS VPN Q oS .1 Ch iu khin c lp (Independent LSP Control mode)

Khi mi LSR nhn dng ra mt FEC th n quyt nh gn ngay mt nhn cho FEC v cng b ngay t hp nhn cho cc i tc phn phi nhn.

Hnh 23. iu khin c lp

iu khin c lp c u im l thit lp LSP nhanh v vic gn nhn l song song gia nhiu cp LSR v dng lu lng c th bt u truyn m khng cn i cc t hp nhn c thit lp xong.
.2 Ch iu khin tun t (Ordered LSP Control mode) Trong ch ny, mt LSR ch to ra t hp nhn cho mt FEC nu n c ng i ti FEC thng qua LSR ng ra, hoc nu LSR nhn c mt t hp nhn t next hop cho FEC .

Hnh 24. iu khin tun t

Vic thit lp LSP bt u LSR ng ra v thc hin ln lt ngc cho n LSR ng vo. Vic phn phi nhn ch ny s to ra thi gian tr trc khi dng lu lng c th chuyn i trn LSP. Tuy nhin, iu khin tun t tng kh nng chng lp v t c mc thu gom ln hn. .I.5.6. Qu trnh phn phi nhn Bc 1: cc giao thc nh tuyn (OSPF, IS IS, BGP,) xy dng bng nh tuyn. Bc 2: cc LSR gn nhn cho mi tuyn trong bng nh tuyn mt cch c lp. Bc 3: cc LSR ln lt phn phi nhn cho tt c cc LSR lng ging.
Nguyn Hu Nguyn Ph Duy 28

Qu trnh gn v phn phi nhn gm nhng bc sau:

Tm hiu cng ngh MPLS VPN Q oS

Bc 4: tt c cc LSR xy dng cc bng LIB, FIB, LFIB da trn cc nhn nhn c. V d sau y s minh ha qu trnh phn phi nhn trong mng MPLS. u tin, cc LSR trong mng s s dng cc giao thc nh tuyn tm ng i cho gi tin v xy dng nn bng nh tuyn ca mnh. Gi s, y router A mun n mng X th phi qua next hop l router B.

Hnh 25. Qu trnh xy dng bng nh tuyn

Sau khi bng nh tuyn hon thnh, cc router s gn nhn cho cc tuyn ch c trong bng nh tuyn ca n. y, router B s gn nhn 25 cho mng X.

Hnh 26. Qu trnh gn nhn

Router B phn phi nhn 25 cho tt c cc LSR k cn vi n v bng LIB c hnh thnh.

Nguyn Hu Nguyn Ph Duy

29

Tm hiu cng ngh MPLS VPN Q oS

Hnh 27. Qu trnh phn phi nhn

Cc LSR nhn c nhn s cp nht vo bng LIB, ring vi LER s cp nht vo bng FIB v LIB ca n.

Hnh 28. Cp nht nhn vo bng LIB

Tng t, router C s gn nhn 47 cho mng X v qung b nhn ny cho cc LSR lng ging. Router C khng qung b nhn cho router D v Router D khng chy MPLS.

Hnh 29. Qung b nhn

Cng lc ny, router C hnh thnh 2 bng LIB v LFIB. Sau khi nhn c nhn 47 t router C, router B cp nht nhn ny vo trong 2 bng LIB v FIB ng thi xy dng bng LFIB. Router E ch thm nhn 47 vo bng LIB v FIB.
Nguyn Hu Nguyn Ph Duy 30

Tm hiu cng ngh MPLS VPN Q oS

Hnh 30. Hon thnh vic thit lp LSP

Nh vy, mt LSP c hon thnh t LER A n mng X.

.I.6.

Phng thc hot ng ca MPLS

Khi mt gi tin vo mt mng MPLS, LER ng vo khng thc hin vic chuyn tip theo tng gi m thc hin phn loi gi tin vo cc FEC, vic phn loi c th da vo thng tin gi nh a ch mng ch, cng vo hoc interface. Sau , nhn c gn vo cc FEC. Giao thc LDP s xc nh v phn phi cc t hp FEC nhn cho cc LSR. Sau khi LDP hon thnh nhim v ca n, mt ng chuyn mch nhn LSP c hnh thnh. Cc LSR nhn cc gi tin c gn nhn v s dng cc bng chuyn tip nhn trao i nhn vo ca gi tin vi nhn ra ph hp vi FEC. Khi gi tin n LER ng ra, n g b nhn v thc hin vic nh tuyn da trn thng tin lp 3 nh thng thng.

.I.7.
.I.7.1.

u im v cc ng dng ca MPLS
u im

n gin ha chc nng chuyn tip: MPLS s dng c ch chuyn tip da vo nhn c di c nh nn quyt nh chuyn tip c th xc nh ngay ch vi mt ln tra cu bng LFIB. Kh nng m rng: chuyn mch nhn cung cp s tch bit ton din hn gia nh tuyn lin min v nh tuyn ni min, iu ny ci thin kh nng m rng ca cc tin trnh nh tuyn. Chuyn tip c phn cp: MPLS c s thay i ng k trong kin trc chuyn tip. S ci tin trong kin trc chuyn tip c tc ng ng k n kh nng cung cp chuyn tip phn cp. Chuyn tip phn cp cho php lng 1 LSP vo 1 LSP khc (xp chng nhn hay cn gi l iu khin gi a cp). MPLS cho php cc LSP c lng vo nhau mt cch ty , cung cp iu khin gi a cp cho vic chuyn tip. Tnh thng minh phn tn: quan im ca MPLS l tnh thng minh cng a ra bin th mng hot ng cng tt. L do l nhng thnh phn mng li phi chu ti rt cao. Thnh phn mng li nn c tnh thng minh thp v nng lc chuyn ti cao.
Nguyn Hu Nguyn Ph Duy 31

Tm hiu cng ngh MPLS VPN Q oS

MPLS phn tch hai chc nng nh tuyn v chuyn mch: cc router bin thc hin nh tuyn v gn nhn cho gi tin, cn cc router mng li ch tp trung lm nhim v chuyn tip gi tin vi tc cao da vo nhn. Tnh thng minh phn tn l mt trong nhng u im ln nht ca MPLS. .I.7.2. Nhc im

H tr ng thi nhiu giao thc s gp phi nhng vn phc tp trong kt ni. Kh h tr QoS xuyn sut. Chn thm nhn vo gi tin s tng thm lu lng truyn ti trn mng. .I.7.3. Cc ng dng

Internet c 3 nhm ng dng chnh: voice, data v video vi cc yu cu khc nhau. MPLS gip khai thc ti nguyn mng t hiu qu cao. Trong , c mt s ng dng ang c trin khai trn mt mng MPLS l: MPLS VPN: Nh cung cp dch c c th to VPN lp 3 dc theo mng ng trc cho nhiu khch hng, ch dng mt c s h tng cng cng sn c, khng cn cc ng dng encrytion hoc end-user. MPLS TE (Traffic Engineering): cung cp kh nng thit lp mt hoc nhiu ng i iu khin lu lng mng v cc c trng thc thi cho mt loi lu lng. K thut lu lng cho php cc ISP nh tuyn lu lng theo cch h c th cung cp dch v tt nht cho khch hng kha cnh thng lng v tr. MPLS TE cho php lu lng c phn b hp l qua ton b h tng mng, ti u ha hiu sut s dng mng MPLS QoS: dng QoS cc nh cung cp dch v c th cung cp nhiu loi mc dch v vi s m bo ti a v cht lng dch v.

Nguyn Hu Nguyn Ph Duy

32

CHNG II

TNG QUAN CNG NGH MPLS VPN V QoS TRONG MNG MPLS
.I
.I.1.

Cng ngh MPLS VPN


Khi nim VPN

Mng ring o VPN l mt loi hnh mng c xy dng da trn kin trc h tng mng c sn ca cc nh cung cp dch v. Mng VPN c th cung cp truyn thng lp 2 hay lp 3 trong m hnh OSI v c s dng bi cc cng ty c nhiu site nm cch xa nhau nhng c nhu cu kt ni vi nhau. Mng ring o VPN yu cu tt c cc site ca khch hng phi c kt ni vi nhau v hon ton tch bit vi mt mng VPN khc. Tuy nhin, cc m hnh mng VPN trn nn IP c th p ng c nhiu yu cu hn th nh l kh nng to kt ni ln nhau gia cc VPN (nu c yu cu) hoc kt ni VPN vo Internet.

Hnh 31. Mng ring o VPN

MPLS VPN c kh nng p ng y cc yu cu ny bng cch to ra cc mng ng trc MPLS cho cc nh cung cp dch v m vn iu khin (control plane) v vn chuyn tip (forwarding plane) c tch bit hn ra (iu ny khng th thc hin c bi IP).

.I.2.

M hnh VPN

VPN tn ti trc khi MPLS ra i. Lc ny, n c xy dng trn cc nn cng ngh nh Frame-Relay hay ATM cung cp dch v VPN lp 2. Cc nh cung cp dch v s dng mt ng trc Frame-Relay hay ATM cung cp cc kt ni ti lp 2 cho cc router ca khch hng. V VPN lc ny c xy dng theo m hnh mng bao ph overlay. Cc nh cung cp dch v thc t c th s hu v iu khin hot ng ti cc router bin thc hin kt ni n h thng mng ca khc hng. M hnh mng ngang hng peer-to-peer VPN lc ny xut hin nhng khng
Nguyn Hu Nguyn Ph Duy 33

Tm hiu cng ngh MPLS VPN Q oS

ph bin v kh thc thi v duy tr (kh khn trong vic lc cc gi IP, phn phi cc danh sch hay to cc ng hm GRE). Vi s ra i ca MPLS m hnh ny c thc hin d dng hn v ang rt ph bin trong thc t.

Hnh 32. M hnh VPN site site site

.I.3.
.I.3.1.

So snh VPN truyn thng v MPLS VPN


VPN truyn thng

Cc mng VPN truyn thng s dng cc chc nng bo mt nh: to ng hm (Tunneling), m ho d liu (Encryption), . vi mc ch t c kh nng bo mt khi truyn d liu gia hai u cui. C rt nhiu cc giao thc khc nhau c s dng cho cc mng VPN ny nh: GRE, PPTP, L2TP, v IPSec. Chng u da trn hot ng to ng truyn dn ring v s dng cc thut ton m ha d liu. Ph bin nht vn l IPSec, hn ch u tin v cng l d nhn thy nht IPSec l lm gim hiu nng ca mng. Trong mt mi trng mng khng c VPN th gi tin s c truyn ngay. Tuy nhin, vi giao thc IPSec, Router gi phi thc hin mt s thao tc trc khi gi gi tin i. u tin, gi tin c m ha, sau ng gi vo cc gi IP, hot ng ny tiu tn thi gian v gy tr cho gi tin. Tip theo gi tin s c a vo trong mng ca nh cung cp dch v. Lc ny, nu gi tin mi c to thnh c kch thc ln hn kch thc ti a cho php truyn (MTUMaximum Transmission Unit th gi tin s cn phi c phn mnh thnh hai hay nhiu gi tin nh hn. Sau c chuyn n ch. Khi n ch n s c m gi v gii m, hai hot ng ny tip tc lm tr gi tin trong mng. Thi gian tr trong mng s ph thuc vo phc tp v tc x l ca cc Router. Cc thit b cht lng thp thng phi thc hin hu ht cc chc nng IPSec bng phn mm khin tr trong mng ln. Cc thit b vi kh nng thc hin cc chc nng IPSec bng phn cng c th tng tc x l gi tin ln rt nhiu nhng chi ph cho cc thit b ny l rt t. iu ny dn n chi ph trin khai mt mng IPSec VPN l rt tn km.

Nguyn Hu Nguyn Ph Duy

34

Tm hiu cng ngh MPLS VPN Q oS

Cc mng IPSec VPN l mng lp trn ca mng IP v s trao i thng tin trong mng c thc hin bng cch thit lp cc ng hm gia cc site. iu ny s to nn nhng cu hnh mng khng ti u. r hn v vn ny, ta s xt hai cu hnh mng, cu hnh hnh sao v cu hnh mng full mesh. Mt im chng ta cn phi cn nhc khi trin khai cc mng VPN l cc thit b phi tng thch vi nhau v u cn h tr tunneling. Khai thc v bo dng cng l mt vn na ca cc mng IPSec VPN v mi mt ng hm IPSec u phi c thit lp bng tay. Cu hnh cho mt ng hm IPSec n l khng phi l vn th nhng thi gian thit lp v duy tr mt mng VPN vi nhiu site s tng ln ng k khi kch thc mng c m rng. Vn bo mt cng cn c quan tm trong cc mng VPN. Mi CPE c th truy nhp vo mng Internet cng cng nhng tin tc vn cn c bo mt trong qu trnh truyn gia cc site.

Hnh 33. M hnh m ha thng thng

.I.3.2.

MPLS VPN

Khng ging nh cc mng VPN truyn thng, cc mng MPLS VPN khng s dng hot ng ng gi v m ha gi tin t c mc bo mt cao. MPLS VPN s dng bng chuyn tip v cc nhn tags to nn tnh bo mt cho mng VPN. Kin trc mng loi ny s dng cc tuyn mng xc nh phn phi cc dch v VPN, v cc c ch x l thng minh ca MPLS VPN lc ny nm hon ton trong phn li ca mng. Mi site ch c th kt hp vi mt v ch mt VRF. Cc VRF ca site khch hng mang ton b thng tin v cc tuyn c sn t site ti VPN m n l thnh vin. i vi mi VRF, thng tin s dng chuyn tip cc gi tin c lu trong cc bng nh tuyn IP v bng CEF. Cc bng ny c duy tr ring r cho tng VRF nn n ngn chn c hin tng thng tin b chuyn tip ra ngoi mng VPN cng nh ngn chn cc gi tin bn ngoi mng VPN chuyn tip vo cc router bn trong
Nguyn Hu Nguyn Ph Duy 35

Tm hiu cng ngh MPLS VPN Q oS

mng VPN. y chnh l c ch bo mt ca MPLS VPN. Bn trong mi mt MPLS VPN, c th kt ni bt k hai im no vi nhau v cc site c th gi thng tin trc tip cho nhau m khng cn thng qua site trung tm.

Hnh 34. M hnh phn tch da vo VRF trong MPLS VPN

.I.4.

M hnh MPLS VPN

Hnh 35. M hnh MPLS VPN

Da trn ng dng ca cng ngh MPLS cc gi tin IP s c nhn ha v c chuyn tip trong mng ca nh cung cp dch v bng cc nhn trn gi tin v mi mng ring o VPN cho mt khch hng c xy dng mt cch hp l v hiu qu. Hn na, cc router P lc ny khng cn phi c bng nh tuyn cho mi khch hng hay BGP cng khng cn phi c s dng trn cc router ny. Tt c vn ny
Nguyn Hu Nguyn Ph Duy 36

Tm hiu cng ngh MPLS VPN Q oS

c gii quyt bi MPLS v qu trnh thc hin cng ch din ra ch yu trn cc router PE. Khi s dng MPLS, ch cn router PE c kh nng nhn bit cc tuyn VPN v qu trnh nh tuyn ch tht s din ra trn cc router ny, cc router P ch lm nhim v chuyn tip trung gian gi tin n ch. Gii php MPLS VPN thc s rt hu ch v hiu qu.

Hnh 36. ng i t Site 1 n Site 2

Mt s khi nim trong MPLS VPN Router PE (Provider Edge router): router cung cp dch v bin, c s dng to kt ni trc tip vi cc router CE ca khch hng ti lp 3. Router P (Provider router): router cung cp dch v. Router ca nh cung cp dch v nhng khng to kt ni trc tip vi khch hng. Trong mng MPLS VPN, c router P v PE u chy MPLS. iu ny c ngha l chng phi c kh nng phn phi nhn v chuyn tip gi tin nhn. Router CE (Customer Edge): router bin khch hng, c s dng to kt ni vi router PE ca nh cung cp dch v. V router ny tng tc vi router PE ti lp 3 nn cn phi c mt giao thc nh tuyn chy gia chng m khng cn phi chy MPLS. i vi mt site ca khch hng, thng thng ch cn c 1 router CE v 1 router PE peer vi n (ch ng trong m hnh mng ring o ngang hng peer-topeer). Nu router CE c kt ni multihomed, n c th c nhiu router PE peer.

Nguyn Hu Nguyn Ph Duy

37

Tm hiu cng ngh MPLS VPN Q oS

.I.5.

Kin trc v qu trnh vn hnh ca VPN trong MPLS

xy dng c m hnh mng ring o MPLS VPN, chng ta cn phi xy dng mt s thnh phn h tr (gi l building block) trn cc router PE. Cc thnh phn ny bao gm: chuyn tip/nh tuyn o VRF (Virtual Routing Forwarding), phn bit tuyn RD (route distinguisher), mc tiu tuyn RT (route target), pht tn tuyn thng qua MP-BGP (route propagation through MP-BGP), v qu trnh chuyn tip cc gi tin nhn. .I.5.1. Qu trnh chuyn tip nh tuyn o VRF

Mi router PE c mt c ch VRF ring cho mt mng VPN. Quan st v d sau thy rng router PE lu gi bng nh tuyn IP tng th (global IP routing tabel), nhng cng c mt bng nh tuyn VRF cho mt VPN c kt ni ti router PE.

Hnh 37. M t cc bng nh tuyn o trong PE

V qu trnh nh tuyn l tch bit cho mi mng ring o VPN ca khch hng trn mt router PE, nn mi mng VPN phi c bng nh tuyn ca ring n. Bng nh tuyn ring bit ny gi l bng nh tuyn VRF. Cc interface trn router PE ni n router CE c th ch thuc vo mt VRF. V th, tt c cc gi tin IP nhn c trn mt interface VRF khng tht s xc nh c l n c thuc vo VRF hay khng. V mi VPN c mt bng nh tuyn ring bit nn cc router PE cng s c mt bng CEF ring bit c dng chuyn tip cc gi tin trong mt VPN. Bng ny gi l bng chuyn tip VRF CEF c rt ra t bng nh tuyn VRF. Bng nh tuyn VRF tht s khng qu khc bit so vi bng nh tuyn thng thng, ch khc ch chng ch c s dng cho mt s site ca mt VPN v hon
Nguyn Hu Nguyn Ph Duy 38

Tm hiu cng ngh MPLS VPN Q oS

ton tch bit vi cc bng nh tuyn khc (bng nh tuyn tng th hay bng nh tuyn mc nh). Cc khi nim metric, khong cch, next-hop,... khng thay i. V VRF c xy dng kt hp vi cc interface, nn ch nhng gi tin IP i vo router PE thng qua cc interface VRF mi c thc hin chuyn tip da trn bng VRF CEF. .I.5.2. Route Distinguisher (RD)

Cc tin t VPN c pht tn trong mng MPLS VPN bng giao thc nh tuyn cng ni bin a giao thc MP-BGP (Multiprotocol BGP). Khi BGP thc hin mang cc tin t Ipv4 qua mng ca nh cung cp dch v, cc tin t ny phi l duy nht. Nu khch hng s dng a ch IP chng lp overlapping, qu trnh nh tuyn s gp s c v khng din ra c. gii quyt vn ny, khi nim RD c a ra phn bit cc tin t Ipv4. C ch lm vic ca RD da trn tng c bn l mi tin t ca mt khch hng s c gn mt ch s xc nhn duy nht RD phn bit vi cc tin t tng t ca mt khch hng no khc. Mt tin t kt hp gia mt tin t Ipv4 v mt RD c gi l tin t vpnv4. Lc ny, MP-BGP ch thc hin chuyn tip da trn cc tin t vpnv4 ny gia cc router PE.

Hnh 38. M t nh dng RD

Ch s xc nhn duy nht RD l mt trng 64 bit dng tch bit cc tin t VRF trong MP-BGP nhng khng trc tip ch ra tin t thuc vo VRF no. Tnh nng tht s ca RD khng phi l mt ch s xc nhn VPN v trong mt s trng hp mng VPN phc tp mt VPN c th c nhiu RD. Mi trng hp VRF trn router PE phi c mt RD kt hp vi n. Gi tr 64bit RD c th c 2 khun dng: ASN:nn hoc IP-address:nn (nn l mt s no ). Khun dng c s dng thng thng l ASN:nn, ASN (Autonomous System number) l ch s xc nhn h thng t tr c gn n nh cung cp dch v bi IANA (internet Assigned Numbers Authority) v nn l ch s xc nhn VRF duy nht ca nh cung cp dch v . S kt hp RD vi tin t Ipv4 cho chng ta tin t vpnv4 di 96bit. Nu chng ta c tin t IP l 10.1.1.0/24 v RD l 1:1 th tin t vpnv4 s l 1:1:10.1.1.0/24. Mt khch hng c th s dng cc RD khc nhau cho cng mt tuyn Ipv4. Khi mt site VPN c kt ni n 2 router PE, cc tuyn t cc site VPN c th c hai RD khc nhau, ph thuc vo router PE m tuyn c nhn. Mi tuyn Ipv4 s c
Nguyn Hu Nguyn Ph Duy 39

Tm hiu cng ngh MPLS VPN Q oS

hai RD khc nhau v hnh thnh hai tuyn vpnv4 hon ton khc nhau. iu ny cho php BGP xem chng nh l cc tuyn khc nhau v thc hin chnh sch i x khc nhau trn tng tuyn. .I.5.3. Route Target (RT)

Qu trnh truyn thng n gin nht gia cc site trong cng mt cng ty (cng VPN) gi l truyn thng VPN trong mng (intranet VPN). Cc qu trnh truyn thng gia cc site ny c iu khin bi mt tnh nng khc ca MPLS VPN gi l RTs RT l mt cng ng BGP m rng (BGP extented community) dng ch ra tuyn no phi c nhp vo VRF t MP-BGP. RT c th c nhp vo hay xut ra mt tuyn vpnv4 vo VRF. Xut ra (exporting) mt RT c ngha l tuyn vpnv4 c xut ra (exported route) nhn mt cng ng BGP m rng (mt RT) c cu hnh di cu lnh ip vrf trn router PE khi cc tuyn c phn phi t bng nh tuyn VRF vo MP-BGP. Nhp vo mt RT c ngha l tuyn vpnv4 nhn c t MP-BGP c kim tra s ph hp ca cng ng m rng ny (y l cc mc tiu tuyn route target) vi mt cng ng m rng no khc c cu hnh. Nu kt qu l ph hp vi nhau, tin t c thm vo bng nh tuyn VRF nh l mt tuyn Ipv4. Nu kt qu l khng ph hp, tin t s b t chi.

Hnh 39. RT trong MPLS VPN Extranet

C th nhn thy mt cch r rng rng Site A v Site B cng mt VRF cust-one c th truyn thng vi nhau. iu tng t cng xy ra vi cc site ca VRF custtwo. VPN cust-one dng RT 1:1, VPN cust-two dng RT 1:2. By gi tng tng rng Site A trn VRF cust-one mun truyn thng vi Site A ca VRF cust-two. iu ny hon ton c th c thc hin bng cch cu hnh cc RTs sao cho ph hp. RT 100:1 c nhp vo v xut ra cho Site A ca vrf cust-one v vrf cust-two trn router

Nguyn Hu Nguyn Ph Duy

40

Tm hiu cng ngh MPLS VPN Q oS

PE1 v PE2 t c iu ny. y gi l VPN extranet. V d sau c bn ging nh v d hnh trn nhng thm vo cc RTs trnh by VPN extranet.

.I.6.

Phn tn tuyn trong mng MPLS VPN

VRF c s dng tch bit cc tuyn khch hng trn cc router PE, nhng lm cch no cc tin t c th c vn chuyn trong mng ca nh cung cp dch v? Do c mt s lng rt ln cc tuyn (ln n hng trm ngn) c th c vn chuyn nn BGP l giao thc l tng c s dng v n l mt giao thc n nh v c th mang nhiu tuyn. V chng ta cng nhn thy rng BGP l giao thc nh tuyn tiu chun c dng mang bng nh tuyn Internet hon chnh. V v cc tuyn VPN ca khch hng l duy nht khi chng ta thm RD vo mi tuyn Ipv4 (i thnh vpnv4) nn tt c cc tuyn khch hng c th c vn chuyn mt cch an ton trn mng MPLS VPN bng BGP. Router PE nhn cc tuyn Ipv4 t router CE thng qua cc giao thc nh tuyn bn trong IGP hay eBGP (external BGP). Cc tuyn Ipv4 t cc site VPN ny c thm vo bng nh tuyn VRF, v VRF no c s dng ph thuc vo vic n c cu hnh nh th no trn cc router PE ni n router CE. Cc tuyn ny xut hin trong bng VRF vi RD c gn vo. V th, chng tr thnh cc tuyn vpnv4 v sau c thm vo MP-BGP. BGP s chu trch nhim phn phi cc tuyn vpnv4 ny n tt c cc router PE trong mng MPLS VPN. Trn cc router PE, cc tuyn vpnv4 c g b RD v a vo bng nh tuyn VRF nh l cc tuyn Ipv4. Vic g b RD trong tuyn vpnv4 a vo VRF c xy ra hay khng l ph thuc vo vic RT c c nhp vo VRF hay khng. Cc tuyn Ipv4 ny sau c qung co n router CE thng qua IGP hay eBGP. V d hnh sau m t cc bc pht tn tuyn t router CE site A n router CE site B trong mng MPLS VPN.

Nguyn Hu Nguyn Ph Duy

41

Tm hiu cng ngh MPLS VPN Q oS

Hnh 40.Cc bc phn tn tuyn t router CE site A n site B

Cc nh cung cp dch v MPLS VPN s dng iBGP thc hin nh tuyn gia cc router PE trong cng h thng t tr ca h. Qu trnh pht tn t eBGP (chy gia cc router PE v CE) n MP-iBGP trong mng MPLS VPN v ngc li c thc hin t ng v khng cn cu hnh g thm. Tuy nhin, qu trnh phn phi MP-iBGP vo IGP chy gia cc router PE v CE th khng phi t ng. Chng ta phi thc hin cu hnh gia MP-iBGP v IGP.

.I.7.

Chuyn tip gi tin trong mng MPLS VPN

Lm th no router ePE bit gi tin thuc vo VRF no? Thng tin ny khng nm trong header gi tin IP v n cng khng th nhn c t nhn, v n c s dng duy nht chuyn tip gi tin qua mng cung cp dch v. Gii php cho vn ny l thm vo mt nhn khc trong ngn xp nhn MPLS. Nhn ny ch nh gi tin thuc vo VRF no. V th, tt c cc gi tin khch hng c chuyn tip vi hai nhn: nhn IGP lm nhn nh v nhn VPN lm nhn y. Nhn VPN phi c thm vo ti router iPE ch cho router ePE bit gi tin thuc vo VRF no. Vy th lm th no router ePE bo hiu cho router iPE bit nhn no c s dng cho tin t VRF c th no ? V MP-BGP c s dng qung co tin t vpnv4 nn n cng c s dng bo hiu nhn VPN (cn gi l nhn BGP) c s dng kt hp vi tin t vpnv4 . Trong thc t cch thc s dng mt nhn VPN ch ra gi tin thuc vo VRF no l khng thc s chnh xc. iu ny c th ng trong mt s trng hp, nhng sai trong hu ht cc trng hp. Mt nhn VPN thng ch ra next-hop m gi tin phi c thc hin chuyn tip n gi n router PE. V th, trong hu ht cc trng hp, mc ch chnh ca nhn VPN l ch ra router CE no l next-hop ca gi tin.
Nguyn Hu Nguyn Ph Duy 42

Tm hiu cng ngh MPLS VPN Q oS

Lu lng VRF-to-VRF trong mng MPLS VPN c hai nhn. Nhn nh l nhn IGP c phn phi bi LDP hay RSVP (cho TE) gia tt c cc router P v PE qua tng hop (hop by hop). Nhn y l nhn VPN c qung co bi MP-iBGP t PE n PE. Cc router P s dng nhn IGP chuyn tip gi tin n chnh xc router ePE. Router ePE s dng nhn VPN chuyn tip gi IP n chnh xc router CE.

Hnh 41. Qu trnh chuyn tip gi tin trong mng MPLS VPN

.II QoS trong mng MPLS


.II.1. M u
Trc y, khi m internet ch yu l truyn data th ngi ta khng cn quan tm n vic phn bit v u tin cho cc gi tin bi v lc ny bng thng mng v cc ti nguyn khc cung cp cho cc ng dng trong mng, v vy cc ISPs s cung cp cho khch hng ca h dch v Best Effort (BE) khi tt c cc khch hng s c i s nh nhau h ch khc nhau loi kt ni. y l dch v ph bin trn mng Internet hay mng IP ni chung. Cc gi thng tin c truyn i theo nguyn tc n trc c phc v trc m khng quan tm n c tnh lu lng ca dch v l g. iu ny dn n rt kh h tr cc dch v i hi tr thp nh cc dch v thi gian thc hay video. Cho n thi im ny, a phn cc dch v c cung cp bi mng Internet vn s dng nguyn tc BE ny. Nhng khi internet cng ngy cng pht trin v pht trin thm cc dch v HTTP, Voice, Video th iu ny s lm cho cht lng ca cc dch v ny gim i r rt v delay ln, jitter ln v khng bng thng truyn, phng n tng bng thng ca mng cng khng gii quyt c vn ny m li cn rt tn km. Chnh v nhng l do trn m cc ISP tp trung trin khai vic qun l lu lng v cc qu trnh QoS.

Nguyn Hu Nguyn Ph Duy

43

Tm hiu cng ngh MPLS VPN Q oS

.II.2. nh ngha QoS


Cht lng dch v QoS l mt tp hp cc tiu chun cng nghip v cc c ch m bo hiu sut cht lng cao cho cc ng dng quan trng. Bng cch s dng cc c ch QoS, cc nh qun tr mng c th s dng ti nguyn mt cch hiu qu v m bo cp dch v yu cu m khng cn m rng hoc cung cp qu nng lc mng ca h. Qos gip xc nh cc vn v sai st trong cc dch v, cho php cc nh cung cp dch v ci thin cc dch v ca h.

.II.3. Mt s khi nim trong QoS


.II.3.1. Cc tham s c bn
.1 tr

Tr l khong thi gian mt bn tin chim khi truyn t im ny sang im khc trn mng. Tr bao gm mt s thnh phn nh thi gian tiu tn trong hng i ca b nh tuyn-tr xp hng, thi gian cn thit thc hin quyt nh trong b nh tuyn-tr chuyn tip, thi gian cn thit tuyn vt l truyn d liu-tr lan truyn v thi gian s dng t gi tin ln mng-tr ni tip ho. Thnh phn c th c qun l vi QoS l tr xp hng. Gi c u tin cao hn s c a ra truyn trc cc gi c u tin thp hn v cc k thut qun l hng i nh RED c th c s dng.
.2 Bin thin tr

Bin thin tr c nh ngha nh s bin i trong cc tr chuyn tip u cui- u cui. Trong mt s ng dng, nh cc ng dng thi gian thc khng th chp nhn bin thin tr. Giao thc TCP cng thc hin rt km di tc dng ca bin thin tr, v n c gng iu chnh tc truyn dn ca n tng ng.
.3 Bng thng

Bng thng biu th tc tryn d liu cc i c th t c gia hai im u cui.


.4 mt gi

mt gi l trng hp khi gi tin khng ti c ch ca n trc thi gian timeout ca b thu. Trong mng TCP/IP th mt gi ch yu l do nghn, y l nguyn nhn to ra s trn b nh hoc loi b gi tin bi cc phng tin qun l lu lng. .II.3.2. Cp dch v GoS

Khi nim cp dch v GoS c ngha hp hn QoS v ch ra mt cch n gin rng cc dch v c th phn loi c trong cc cp khc nhau, c th c cung cp cho ngi s dng v c qun l c lp.

Nguyn Hu Nguyn Ph Duy

44

Tm hiu cng ngh MPLS VPN Q oS

.II.3.3.

Tha thun mc dch v SLA

Tha thun mc dch v SLA l hp ng gia khch hng v nh cung cp dch v SP, SLA nh mc dch v no SP nh cung cp. tng rt n gin: khch hng no bo co bao nhiu lu lng h s gi v tr tin cho mc ti thiu c m bo trong lu lng .

.II.4. Cc m hnh QoS


Hai m hnh cung cp cht lng dch v c s dng ph bin ngy nay l:
Dch v tch hp IntServ Dch v phn bit DiffServ

M hnh IntServ s dng khi nim lung cng vi giao thc bo hiu dc theo ng dn ca gi tin. Giao thc bo hiu m bo cc ngun ti nguyn tha mn yu cu dch v c cung cp ti mi nt cho cc lung lu lng trc khi n c truyn trn mng. iu ny gp tr ngi ln khi hot ng trong mi trng khng gian ln nh Internet, v s lng cc router, switch, my ch rt ln v a dng. Chnh s hn ch bi vn m rng v rt nhiu lung lu lng cn phi qun l, mt tp tiu chun ca m hnh phn bit dch v DiffServ c a ra nh l mt m hnh QoS th hai.

Hnh 42. M hnh dch v tch hp IntServ

Trong khi , tng ca m hnh dch v phn bit DiffServ kh n gin: n cung cp cc mc dch v mng khc nhau cho mt gi tin, t cho php phn bit cc dch v c kh nng m rng khc nhau m khng cn trng thi mi lung v bo hiu ti mi hop. Cc gi tin ca mt dch v c th thuc v mt lp. Cc lp c phn loi nh vic nh du gi tin v vic i x vi mi gi tin l hon ton c lp. iu ny cho php kh nng m rng tt hn m hnh IntServ, nhng li
Nguyn Hu Nguyn Ph Duy 45

Tm hiu cng ngh MPLS VPN Q oS

khng cung cp vic bo m bng thng i vi cc gi tin thuc v mt lung, do khng th cung cp vic kim sot truy nhp vi cc lung mi.

Hnh 43. So snh IntServ vi DiffServ

.II.5. M hnh dch v phn bit DiffServ


Mc ch ca vic a ra dch v Diffserv nhm t c tnh linh ng. Diffserv tri ngc vi Intserv l da trn tng lung d liu, n phn loi cc gi thnh mt s lng khng ln cc tp gi l cc lp) v do t c hiu qu cho cc mng ln. Cc chc nng n gin c thc hin ti router li, trong khi cc chc nng phc tp c trin khai ti cc router bin. Tnh linh ng rt l cn thit v dch v mi c th xut hin v mt s dch v tr ln li thi. Do , Diffserv khng cn thit phi xc nh dch v nh l Inserv, thay vo n cung cp cc thnh phn chc nng m trn dch v c th c xy dng. Vic thng tin gia ngi dng v dch v s nm trong bn tha thun mc dch v SLA , vic i x lung lu lng tng ng vi bn SLA. Vic xc nh SLA s c cung cp bao nhiu ti nguyn s c cu hnh tay. .II.5.1. Kin trc DiffServ

Kin trc m hnh DiffServ bao gm cc thnh phn chnh c s d ng cng nhau cho php tr, bin thin tr, mt gi phn bit t u n cui c th c h tr trong cng mt mng h tr DiffServ. Cc thnh phn y gm:

Nguyn Hu Nguyn Ph Duy

46

Tm hiu cng ngh MPLS VPN Q oS

Hnh 44. Cc thnh phn trong kin trc DiffServ

Phn loi v quy nh lu lng: Ti li vo min DiffServ, lu lng ca khch hng c phn loi vo cc lp khc nhau, cn gi l cc tp hp hnh vi BA. Nhng tp hp ny c i chiu vi bn tha thun quy nh lu lng TCA. Sau , cc c ch QoS, chng hn nh policing hoc shaping, c s dng m bo rng lu lng vo min DiffServ ph hp vi TCA. Nhng lu lng no khng ph hp s b tr hon, hy b hoc nh du li l vt khi quy nh ca TCA. nh du DSCP: cc gi tin c nh du trc bng cch thay i gi tr DSCP thuc trng DS trong phn IP header, hoc c nh du ti ng vo min DiffServ xc nh gi tin thuc v lp hoc BA no. V vy, cc nt mng tip theo trong min DiffServ ch cn thc hin vic phn loi n gin xc nh lp ca gi tin. i x tng chng PHB: sau khi p dng cc quy nh lu lng ti bin ca min DiffServ, bn trong min DiffServ, mc tiu l phi m bo rng SLA mi class phi c p ng. PHB i din cho cc m t v cc c tnh tr, bin thin tr v t l mt gi m mi BA phi chu khi i qua mt nt DiffServ. Mt nhm PHB c th cha mt hoc nhiu PHB lin quan c thc hin ng thi. .II.5.2. im m dch v phn bit DSCP

Cc c tnh k thut trc y, IP d tr mt s bit trong header cho vic h tr cc cht lng dch v QoS. i vi IPv4, octet th hai ca header l octet ToS (Type of Service), cn i vi IPv6 th l octet lp lu lng (Traffic Class).

Nguyn Hu Nguyn Ph Duy

47

Tm hiu cng ngh MPLS 0 -VPN Q oS 6 - 7 2 3-5


IP Predence ToS field
unused

ToS byte

DS field

DSCP 0-5

ECN 6-7

Hnh 45. Trng ToS trong IP header trc v sau khi c DiffServ

Trong m hnh DiffServ, trng ToS trong IPv4 Header c nh ngha li, gi l trng DS (Differentiated Service). Trng DS c cu trc nh sau:

RFC 2474
CSCP DSCP

RFC 3168
CSCP DSCP Hnh 46. Cu trc trng DS ECN

Trng ToS cha 8 bit, 6 trong s chng c s dng biu th cho DSCP. Vi 6 bit trng DS s c 64 gi tr nh phn tng ng vi 64 trng thi cht lng dch v cha trong 3 b tr(pool). Trong s c 2 b tr vi 32 gi tr c d tr cho thc nghim hay s dng cc b. Cc c tnh DiffServ hin nay khuyn co s dng 21 gi tr trong b tr th 3.
Nguyn Hu Nguyn Ph Duy 48

Tm hiu cng ngh MPLS VPN Q oS

.II.5.3.

i x tng chng PHB

Kin trc DiffServ nh ngha mt PHB nh l hnh vi chuyn tip m mt nt p dng i vi mt BA. PHB lin quan n cc c im v tr, bin thin tr hay t l mt gi m mt BA s gp khi i qua mt min DiffServ. Mt nhm PHB cha mt hoc nhiu PHB lin quan c thc thi ng thi. C cc PHB c nh ngha trong ti liu c t DiffServ nh sau: PHB mc nh (Default PHB) Chuyn tip nhanh EF (Expetided Forwarding) Chuyn tip m bo AF (Assured Forwarding) B la chn lp CS (Class Selector) Ta c bng nh x cc gi tr DSCP vi hnh vi PHB nh sau: PHB EF AF43 AF42 AF41 AF33 AF32 AF31 AF23 AF22 AF21 AF13 AF12 AF11 CS7 CS6 CS5 CS4 CS3 CS2 CS1 Default
.1 PHB mc nh

DSCP (Decimal) 46 38 36 34 30 28 26 22 20 18 14 12 10 56 48 40 32 24 16 8 0

DSCP (Binary) 101110 100110 100100 100010 111100 111000 110100 101100 101000 100100 111000 110000 101000 111000 110000 101000 100000 011000 010000 001000 000000

Bng 2. Bng nh x gi tr DSCP v PHB

PHB mc nh l mt dch v Best Effort m mt min DiffServ cung cp. Min DiffServ s chuyn tip cng nhiu gi tin cng tt, cng sm cng tt. Khng c cc c tnh v tr, bin thin tr v t l mt gi. Vic thc hin cc hnh vi PHB khc s ngn cn hot ng ca cc ng dng ca PHB mc nh.
Nguyn Hu Nguyn Ph Duy 49

Tm hiu cng ngh MPLS VPN Q oS .2 Chuyn tip nhanh EF

Chuyn tip nhanh EF nh ngha mt hnh vi c tr thp, bin thin tr thp v t l mt gi thp m mt nt DiffServ phi thc hin. PHB ny thng dng cho cc lu lng thi gian thc i qua min DiffServ. h tr hnh vi ny, nt DiffServ phi phc v EF vi mt tc cao hn tc n ca n, m bo rng lu lng EF ch phi gp mt hng i rng hoc gn rng, gip ti thiu ha tr xp hng. Vic ti thiu ha tr xp hng dn ti khng ch tr v bin thin tr thp m cn lm cho t l mt gi thp, bi v n ngn chn b m gi tin b cn kit.
.3 Chuyn tip bo m AF

Cc nhm AF PHB nh ngha mt nt DiffServ h tr vic bo m t l mt gi nh th no. C 4 nhm AF c dng AFij, trong i = 14 m t cc lp, j = 1..3 m t u tin hy gi. u tin cng cao th cc gi tin b hy cng nhiu. u tin hy gi Thp Trung bnh Cao AF1 AF11 AF12 AF13 AF2 AF21 AF22 AF23 AF3 AF31 AF32 AF33 AF4 AF41 AF42 AF43

Bng 3. Cc PHB AF vi u tin hy gi tng ng

Cc nhm AF thc thi c lp vi nhau, khng c mt b m t tr, hoc bin thin tr khng tng minh. Vic bo m thc s cung cp bi mi nhm ph thuc vo ti nguyn chuyn tip m cc nt DiffServ cp pht, s lu lng ca nhm n mt nt v u tin hy gi ca gi tin.
.4 B la chn lp CS

DiffServ nh ngha cc CS PHB cung cp c ch tng thch ngc vi cc bit IP Predence trong trng ToS (Type of Service) ca IPv4 header. Cc CS c gi tr cao hn s c xc sut chuyn tip ln hn. PHB CS7 CS6 CS5 CS4 CS3 CS2 CS1 CS0 DSCP (Thp phn) 56 48 40 32 24 16 8 0 DSCP (Nh phn) 111000 110000 101000 100000 011000 010000 001000 000000 Tn bit IP Predence Network Control Internetwork Control Critic/ECP Flash Override Flash Immidiate Priority Routine IP Predence (Nh phn) 111 110 101 100 011 010 001 000 IP Predence (Thp phn) 7 6 5 4 3 2 1 0
50

Bng 4. Quan h gia gi tr IP Predence v b la chn lp CS Nguyn Hu Nguyn Ph Duy

Tm hiu cng ngh MPLS VPN Q oS

.II.5.4.

Phn loi v quy nh lu lng

Vic quy nh lu lng c thc hin da trn tha thun cp dch v SLA gia cc khch hng vi nh cung cp dch v. Ti liu c t quy nh lu lng m t cc tham s ca mi cp dch v. Quy nh lu lng s thc hin cc cng vic phn loi, nh du, policing v shaping.
.1 Phn loi lu lng

Phn loi c thc hin nhn dng lu lng v phn chia lu lng thnh cc lp khc nhau. phn loi gi, ta dng b m t lu lng phn chia cc gi trong phm vi cc nhm ring bit nh ngha cc gi . Mt s b m t c trng dng phn loi gi bao gm: b giao tip ng vo, u tin IP (IP Precedence), DSCP, a ch ngun hay a ch ch v cc ng dng. Sau khi gi c nh danh, chng c kh nng c tin hnh cc chc nng QoS trn mng. Vi vic s dng phn loi gi, nh qun tr mng c th phn vng lu lng mng thnh nhiu mc u tin hay nhiu lp dch v. Khi b c t lu lng c s dng phn loi, lu lng ngun ng tham gia tho thun cc gii hn v mng s thc hin cc gii hn vi vic m bo v cht lng dch v. Cc k thut cht lng dch v khc nh gim st lu lng, nn dng lu lng v k thut hng i s dng b m t lu lng m bo gi ng tho thun. Vic phn loi nn c t bin mng.
.2 nh du lu lng

Hot ng nh du cho php cc thit b mng phn loi gi hay khung (frame) da vo b m t lu lng c trng. Mt s b m t lu lng c s dng nh du gi nh: lp dch v (CoS), DSCP, u tin IP, nhm QoS, chuyn mch nhn a giao thc (MPLS). Vic nh du c s dng thit lp thng tin trong tiu gi lp 2 hay lp 3. Vic nh du gi hay khung cng vi vic phn loi cho php thit b mng d dng phn bit cc gi hay khung c nh du. nh du l yu t hu dng v n cho php thit b mng d dng nhn dng cc gi hay khung theo cc lp c trng. Khi k thut QoS c th ng dng tng thch m bo s ng n vi cc chnh sch qun tr QoS.
.3 Policing

Tnh nng policing thc hin cc chc nng sau:


Gii hn tc vn chuyn ca mt lp lu lng i vo v i ra mt interface da trn mt s tiu ch do ngi qun tr nh ngha. nh du gi tin bng cch thit lp cc bit ATM CLP (Cell Loss Priority), Frame Relay DE (Discard Eligible), cc gi tr IP Predence, DSCP, EXP v qos group.

Nguyn Hu Nguyn Ph Duy

51

Tm hiu cng ngh MPLS VPN Q oS

Policing cho php chng ta kim sot tc truyn v nhn ti a ca dng lu lng trn mt interface. Tnh nng ny c p dng khi p dng mt chnh sch lu lng vo mt interface. Vic thc hin tnh nng policing da trn thut ton thng token. C 2 kiu thut ton thng token l: thut ton mt thng token v thut ton hai thng token. Hai thut ton ny c m t nh sau: Thut ton mt thng token

G i t in k c h t h c B b y tes n

b to ke n s > = B b y te s ?

ng

L y i B t o k e n s t ro n g th n g

Hnh ng C o n fo rm

Sai
Hnh ng E xc e e d

Hnh 47. Thut ton mt thng token

Thut ton ny s dng mt thng token gi l thng Conform. Thng Conform ban u c lm y bng s bytes token xc nh nh l kch thc burst bnh thng. Khi mt gi tin kch thc B bytes n ti thi im t th xy ra cc hnh ng sau: Kch thc thng Conform c cp nht: nu gi thi im gi tin n trc l t1 v thi im hin ti l t, th kch thc thng c cp nht da trn tc token n (hay CIR Committed Information Rate ) nh sau: (Thi gian gia cc gi tin <t t1> * tc cho php CIR)/8 bytes Nu kch thc thng Conform ln hn hoc bng kch thc gi tin, th gi tin l ph hp v xy ra hnh ng Conform i vi gi tin. ng thi, kch thc thng Conform s gim i B bytes token. Nu s lng bytes trong thng tr i B bytes nh hn 0, th hnh ng Exceed xy ra. V d, cu hnh policing s dng thut ton 1 thng token nh sau:
Router(config)# class-map access-match Router(config-cmap)# match access-group 1 Router(config-cmap)# exit Router(config)# policy-map police-setting Router(config-pmap)# class access-match Router(config-pmap-c)# police 8000 1000 conform-action transmit

exceed-action drop

Nguyn Hu Nguyn Ph Duy Router(config-pmap)# exit

Router(config-pmap-c)# exit Router(config)# interface fastethernet 0/0 Router(config-if)# service-policy output police-setting

52

Tm hiu cng ngh MPLS VPN Q oS

Tc CIR l 8000bps v kch thc burst bnh thng l 1000 bytes cho tt c cc gi tin ra khi interface FastEthernet 0/0. Ban u thng token lm y bi 1000 bytes. Khi mt gi tin 450 bytes n, n ph hp v c token trong thng. Hnh ng Conform lc ny l gi tin c chuyn i (transmit) v trong thng cn li l 550 bytes. Sau 0.25s th gi tin tip theo n, thng c thm vo 250 bytes ((0.25 * 8000)/8). Lc ny trong thng c 800 bytes. Gi s, gi tin tip theo c kch thc 900 bytes, th gi tin vt qu kch thc thng token v hnh ng Exceed lc ny l gi tin b hy (drop). V trong thng lc ny vn cn 800 bytes. Thut ton hai thng token

Gi tin kch thc B bytes n

b tokens trong thng Conform >= B bytes?

Sai

b tokens trong thng Exceed >= B bytes?

Sai

Hnh ng Violate

ng

ng

Ly i B tokens trong thng Conform

Ly i B tokens trong thng Exceed

Hnh ng Hnh 48. Thut ton hai thng token Hnh ng Conform Exceed

Thut ton ny s dng hai thng token gm thng Conform v thng Exceed. C 2 thng ban u u c lm y bng s bytes token, trong kch thc thng Conform c xem nh l kch thc burst bnh thng, cn kch thc thng Exceed c xem l kch thc burst ti a. Kch thc hai thng c cp nht da trn tc CIR. Khi mt gi tin kch thc B bytes n ti thi im t th din ra cc hnh ng sau: Kch thc thng Conform c cp nht: nu gi tin trc n ti thi im t1 v gi tin tip theo n ti thi im t, th kch thc thng c tnh da trn tc CIR nh sau: (Thi gian gia cc gi tin <t t1> * tc cho php CIR)/8 bytes
Nguyn Hu Nguyn Ph Duy 53

Tm hiu cng ngh MPLS VPN Q oS

Nu s token trong thng Conform ln hn hoc bng kch thc gi tin th gi tin ph hp v hnh ng Conform din ra. ng thi, thng Conform s gim i B bytes token. Ngc li, nu s token trong thng Conform nh hn kch thc gi tin th s kim tra s bytes token trong thng Exceed. Nu s token trong thng Exceed ln hn hoc bng kch thc gi tin th hnh ng Conform din ra. ng thi, thng Exceed s gim i B bytes token. Kch thc thng Conform vn nh c. Ngc li, nu kch thc thng Exceed nh hn kch thc gi tin th hnh ng Violate xy ra. V d , ta c cu hnh policing s dng thut ton 2 thng token nh sau:
Router(config)# class-map access-match Router(config-cmap)# match access-group 1 Router(config-cmap)# exit Router(config)# policy-map police-setting Router(config-pmap)# class access-match Router(config-pmap-c)# police 8000 1000 1000 conform-action

transmit exceed-action set-qos-transmit 1 violate-action drop Router(config-pmap-c)# exit Router(config-pmap)# exit Router(config)# interface fastethernet 0/0 Router(config-if)# service-policy output police-setting

Tc CIR l 8000bps, kch thc burst bnh thng v kch thc burst ti a u l 1000 bytes cho tt c cc gi tin ra khi interface FastEthernet 0/0. Ban u, 2 thng Conform v Exceed u cha 1000 bytes token. Khi mt gi tin kch thc 450 bytes n, c token trong thng Conform nn gi tin ph hp v hnh ng Conform c thc hin lc ny l chuyn gi tin i (transmit). Trong thng Conform cn li 550 bytes. Sau 0.25s, gi tin tip theo n. Thng Conform lc ny c b sung thm 250 bytes token ((0.25+8000)/8) v c tng cng l 800 bytes. Nu kch thc gi tin l 900 bytes, th gi tin khng ph hp v ch c 800 bytes trong thng Conform. Do , thng Exceed c kim tra v c s token cho gi tin ny nn hnh ng Exceed xy ra (thit lp gi tr QoS transmit bng 1), ng thi thng Exceed gim i 900 bytes token v cn li 100 bytes. Sau 0.4s, cc thng c b sung thm 400 bytes ((0.4*8000)/8). Do thng Conform c 800 bytes nn ch nhn thm 200 bytes. Phn cn li c b sung cho thng Exceed v thng Exceed lc ny c 300 bytes. Nu gi tin tip theo n c kch thc 1000 bytes th xy ra hnh ng Conform v thng Conform lc ny rng.
Nguyn Hu Nguyn Ph Duy 54

Tm hiu cng ngh MPLS VPN Q oS

Sau 0.2s, c 200 bytes c b sung vo cc thng ((0.2*8000)/8). Thng Conform lc ny s c 200 bytes v thng Exceed vn l 300 bytes. Gi s gi tin tip theo n c kch thc 400 bytes, th u khng c s bytes token trong c 2 thng. Do , hnh ng Violate c thc hin bng cch hy (drop) gi tin.
.4 Shaping

Tnh nng shaping c thc hin tng t nh tnh nng policing khi s dng thut ton thng token a ra quyt nh x l i vi dng lu lng. Khi mt gi tin trong mt dng lu lng n, gi tin vi kch thc B bytes c so snh vi s lng token hin c trong thng. Nu kch thc thng khng nh hn kch thc gi tin th gi tin c chuyn i khng cn tr hon. Nu kch thc thng nh hn kch thc gi tin, tc c t bytes token hn B bytes ca gi tin, th gi tin s b tr hon (bng b m hoc hng i) cho n khi c s bytes token trong thng, ch khng hy gi nh policing. Khi c s bytes token trong thng, gi tin s c gi i v thng token s gim i B bytes.

Thng token
hp

Ph

Cc gi tin c chuyn i

Phn loi Tc shaping cu hnh

C token trong thng khng ?

Phn loi gi tin

Traffic Shaping Khng

Cc gi tin c t trong hng i ( chuyn i sau)

Hnh 49. Tnh nng shaping

.II.5.5.

MPLS h tr DiffServ

V c bn mng MPLS DiffServ khng thay i kin trc QoS ca mng IP. Cc thnh phn chc nng nh bng tha thun iu ha lu lng TCA, PHB vn khng thay i. Cc router ti bin vn thc hin cc chc nng phn loi (classification), nh du (marking), policing v shaping. ng thi cc chc nng qun l b m cng nh lp lch gi tin i trong mng theo thc thi PHB vn gi nguyn. im khc y chnh l cu trc ca node MPLS v vic chuyn tip gi tin , do n ko theo mt s thc thi DiffServ khc so vi mng IP. Cc router LSR chuyn tip ch da vo header MPLS v trng m rng EXP, do LSR khng nhn thy trc tip trng Prec/DSCP trn header IP. Vn t ra
Nguyn Hu Nguyn Ph Duy 55

Tm hiu cng ngh MPLS VPN Q oS

y l trng DSCP l trng 6bit trong khi trng EXP ca nhn chn MPLS li ch c 3 bit. Lm th no nh x t DSCP sang EXP? MPLS h tr cho DiffServ (RFC 3270) gii thiu 2 kiu LSP vi cc c tnh dch v khc nhau v qu trnh hot ng. Kiu u tin, E LSP (EXP inferred PSC LSP) c th vn chuyn nhiu lp lu lng ng thi. Kiu th hai, L LSP (Label inferred PSC LSP) ch vn chuyn mt lp lu lng.
.1 E LSP (EXP inferred PSC LSP)

E LSP l kiu LSP c th mang nhiu lp lu lng ng thi. Cc LSR s dng trng EXP trong nhn suy ra hnh vi PHB m mt gi tin yu cu. Trng EXP c 3 bit nn mt E LSP c th cha ti 8 lp dch v. Cc LSR c th thit lp cc E LSP vi vic dnh trc bng thng.

Min MPLS C A D

AF2

EF

AF1

Hnh 50. Min MPLS s dng E LSP

E LSP nh ngha cc c ch nh x gia gi tr EXP v cc hnh vi PHB. Mt LSR s nh x EXP sang PHB i vi cc nhn vo, v nh x PHB sang gi tr EXP i vi cc nhn ra. Hnh 50 biu din mt mng s dng cc ng E LSP. Trong trng hp ny c 2 ng E LSP gia 2 node A v D. Mng h tr 3 lp dch v : EF, AF1 v AF2. ng E LSP u tin mang lu lng EF, ng LSP th 2 mang tng hp c 3 lp dch v. Theo cc nguyn tc ca E LSP, tt c cc node thc thi PHB u da trn gi tr trng EXP ca gi tin. Ch rng, mt s lu lng EF i theo mt ng E LSP, trong khi mt s li i theo ng khc. Node A c th chia nh lu lng EF v node C ch vic phc v lu lng EF m khng cn phi quan tm n vic LSP no mang lu lng EF.
.2 L LSP (Label inferred PSC LSP)

L LSP l kiu LSP ch vn chuyn duy nht mt lp lu lng n. Cc LSR suy ra cc hnh vi PHB t gi tr nhn, gi tr EXP lc ny ch mang ngha l u tin
Nguyn Hu Nguyn Ph Duy 56

Tm hiu cng ngh MPLS VPN Q oS

hy gi. Cc LSR hc s kt hp gia gi tr nhn vi cc lp trong qu trnh thit lp LSP. L LSP yu cu phi s dng cc c ch bo hiu m rng ca DiffServ.

Min MPLS C A D

AF2

EF

AF1

Hnh 51. Min MPLS s dng L LSP

Vic s dng E LSP v L LSP trong cng mng MPLS s khng loi tr ln nhau. Cc LSR s m bo ni dung ca nhn DiffServ. Ni dung ny chnh l kiu ng dn LSP (E LSP hay L LSP), cc hnh vi PHB m LSP h tr v nh x gia vic ng gi tin vi mt PHB. i vi cc nhn u vo, vic nh x s ch ra cc LSR c suy ra PHB nh th no. i vi cc nhn u ra, vic nh x s ch ra lm th no LSR m ha PHB. Hnh 51 minh ha mt mng MPLS s dng cc ng L LSP. Trong trng hp ny s c 4 ng L LSP gia node A v D. Mng s dng 3 lp dch v EF, AF1 v AF2. ng L LSP u tin s mang lu lng AF2, ng 2 v 3 mang lu lng EF v ng cui cng mang lu lng AF1. Ch rng node A chia nh lu lng EF trn 2 ng L LSP. Node C s nhn ra dng lu lng EF bng cch s dng cc nhn v phc v lu lng ny m khng cn phi xem xt LSP no mang n (c ngha l node s khng cung cp PHB trn mi L LSP m trn mi lp dch v). Ta c bng so snh sau y: E LSP Mt hoc nhiu lp mi LSP PHB suy ra t trng EXP Khng cn bo hiu (ty chn) .II.5.6. L LSP Mt lp mi LSP PHB suy ra t gi tr nhn v EXP Yu cu c bo hiu

Bng 5. So snh E LSP vi L LSP

Cc m hnh DiffServ Tunnel trong MPLS

Cc LSP h tr DiffServ nh ngha 3 m hnh tng tc gia cc hnh vi PHB trong cc lp ng gi khc nhau. Cc m hnh ny gm c: Uniform, Pipe, Short
Nguyn Hu Nguyn Ph Duy 57

Tm hiu cng ngh MPLS VPN Q oS

Pipe, s nh ngha cc th tc m mt LSR c th p dng khi mt gi tin (IP hoc MPLS) vi mt PHB c i vo v ra khi mt LSP. Ba m hnh ny p dng chung cho c E LSP v L LSP.
.1 M hnh Uniform

M hnh Uniform ch c duy nht mt lp QoS c thc hin t u n cui. Khi gi tr EXP ca nhn trn cng thay i, n s c sao chp vo trng EXP ca nhn mi c gn vo cng nh trng EXP ca nhn mi c g ra.

Hnh 52. M hnh Uniform trong MPLS DiffServ tunnel

V d i vi hnh trn, gi tin IP i vo min MPLS c gi tr DSCP l 34. Ti PE ng vo, mt nhn c gn vo v gi tr DSCP sao chp sang trng EXP. Tuy nhin, trng EXP ch c 3 bit nn ch c 3 bit CSCP trong trng DSCP c sao chp. V vy gi tr EXP y bng 4. Cc router P trung gian chuyn tip gi tin da trn gi tr EXP ca nhn trn cng trong ngn xp nhn. Gi s ti router D nh du li gi tr EXP bng 3. Khi ti router PE ng vo, y l router E, gi s khng c hnh ng PHP, gi tr EXP s c sao chp ngc tr li trng DSCP. Lc ny, gi tr DSCP s l 26 (tng ng vi PHB AF 31).
.2 M hnh Pipe

M hnh Pipe i x vi gi tr trng DSCP trong gi tin IP vi gi tr EXP trong nhn MPLS c lp vi nhau. Ti im u ca mt LSP, trng EXP c thit lp; vic thit lp ny c th dn xut t gi tr DSCP trong trng hp chuyn tip gi tin IP vo mng MPLS, hoc c th da vo gi tr EXP trong trng hp chuyn tip gi tin trong mng MPLS. Trn mt LSP, vic phn loi, nh du v nh du li c thc hin ch da trn gi tr EXP ca nhn ngoi cng. Khi nhn ngoi cng c g ra, ti im cui ca LSP (hoc ti router p cht, noi thc hin hnh ng PHP), gi tr EXP ca nhn g ra khng c sao chp vo trng DSCP ca gi tin IP hoc
Nguyn Hu Nguyn Ph Duy 58

Tm hiu cng ngh MPLS VPN Q oS

trng EXP ca nhn bn di. Tuy nhin, LER ng ra vn gi gi tr ca trng EXP trong gi tin nhn, v th n c th c s dng phn loi gi tin ti interface u ra.

Hnh 53. M hnh Pipe trong MPLS DiffServ tunnel .3 M hnh Short Pipe

M hnh Short Pipe gn ging nh m hnh Pipe, ch c mt im khc l: ti LER ng ra, vic phn loi gi tin khng da vo gi tr EXP m da vo gi tr DSCP trong gi tin IP.

Hnh 54. M hnh Short Pipe trong MPLS DiffServ tunnel Nguyn Hu Nguyn Ph Duy 59

Tm hiu cng ngh MPLS VPN Q oS

.II.5.7.

Thc hin QoS trong min MPLS

Min MPLS x l lu lng QoS theo ba giai on khi cc gi tin IP i vo min MPLS.
X l ti LER ng vo

LER ng vo trong min MPLS gii hn dng d liu ca ngi dng m bo rng dng d liu ph hp vi bng thng quy nh trong min MPLS. LER ng vo nh du cc gi tin IP vi u tin khc nhau ty thuc vo chnh sch v nh x trng DSCP trong gi tin IP vo trng EXP ca nhn MPLS.

Hnh 55. nh x gi tr DSCP vo cc bit EXP

Trong min IntServ, trng ToS (Type of Service) ca gi tin IP v trng EXP c th nh x mt mt v hai trng u cha 3 bit. Trong khi , trong min DiffServ, vic nh x mt nhiu c th xy ra v trng DSCP cha 6 bit v trng EXP ch cha 3 bit. i vi vic thc hin QoS c bn, 3 bit u tin ca trng DSCP, cn gi l CSCP, c nh x ti trng EXP v 3 bit cui c b qua.
X l ti cc LSR

Khi thc hin chuyn mch MPLS, LSR thc hin vic lp lch hng i da theo thng tin mang trong trng EXP ca nhn thuc gi tin n. iu ny cho php cc LSR cung cp cc dch v tt hn cho cc gi tin vi u tin cao hn.
X l ti LER ng ra

LER ng ra nh x trng EXP vo trng DSCP ca gi tin. Trong vic nh x chun, gi tr EXP c nh x vo 3 bit CSCP v 3 bit cui c thit lp l 0.

Nguyn Hu Nguyn Ph Duy

60

CHNG III

PHN TCH THIT K H THNG


.I
.I.1.

Phn tch trang web m phng chia s d liu trc tuyn


Thu thp yu cu

Hin nay, vi xu hng in ton m my, ngi dng c nhu cu lu tr d liu ca mnh trn mng Internet rt cao. Khng nhng vy, ngi dng Internet cn mun chia s d liu ca mnh cho ngi khc ngay trn mng thng qua cc lin kt m khng cn ti cc thit b lu tr d liu di ng nh USB, cng di ng. Hn na, vic lu tr d liu trn mng cng mang li nhiu li ch. Chng hn, mt nhn vin sau khi thao tc vi mt file Word ti cng ty, ht gi lm vic, nhn vin ny upload file ny vi trang lu tr trc tuyn. Sau , khi v nh, nu mun chnh sa trn file ny, nhn vin ny ch vic download file ny xung my tnh c nhn, ri upload ln li sau khi chnh sa. Nh vy, c th thy ngi dng c th m bo d liu ca mnh c an ton nh vic lu tr d liu trc tuyn. ng thi, vic lu tr ny cng mang tnh tng tc rt cao khi ngi dng c th chia s d liu ca h qua cc lin kt. T nhu cu trn, ta phn tch yu cu nh sau: Yu cu chc nng: u tin, ngi dng vo trang web chia s d liu. Sau , h c th thc hin cc thao tc upload, download, v xa d liu ca mnh. Yu cu phi chc nng: trang web chia s d liu phi bo m tnh n gin, d s dng, khng pht sinh li.

.I.2.
.I.2.1.

c t yu cu
Cc thut ng Thut ng FEAT REQ Kiu Technical Technical ngha M t chc nng M t yu cu

.I.2.2.

Yu cu chc nng

FEAT 001 Upload file


Thuc tnh M t 61 Nguyn Hu Nguyn Ph Duy

Tm hiu cng ngh MPLS VPN Q oS Tng qut

Trng thi : Proposed u tin :High Stereotype : Functional kh : Medium Loi : Requirement Phm vi: Private Mi : True
Cho php ngi dng upload d liu t my tnh c nhn ln server ca trang web

Ni dung

FEAT 002 Download file


Thuc tnh Tng qut M t

Trng thi : Proposed u tin :High Stereotype : Functional kh : Medium Loi : Requirement Phm vi: Private Mi : True
Cho php ngi dng download d liu upload ln server ca trang web v my tnh c nhn

Ni dung

FEAT 003 Xa file


Thuc tnh Tng qut M t

Trng thi : Proposed u tin :High Stereotype : Functional kh : Medium Loi : Requirement Phm vi: Private Mi : True
Cho php ngi dng xa d liu upload ln server ca trang web

Ni dung

.I.2.3.

Yu cu phi chc nng Giao din ngi dng: n gin, thn thin, d s dng. Tc : tc load trang web, upload v download file nhanh.

.1 Giao din ngi dng

.2 Yu cu phn mm

Chy trn mi h iu hnh, t Linux n Windows c ci sn mt trnh duyt web. Trnh h tr tng tc download (ty chn).

.3 Cng c thc hin

Ngn ng UML phn tch. Ngn ng PHP ci t. B cng c XAMPP ci t chng trnh.

Nguyn Hu Nguyn Ph Duy

62

Tm hiu cng ngh MPLS VPN Q oS

.I.3.
.I.3.1.

Xy dng biu Use Case


Nhn dng tc nhn

Tc nhn (actor) l thc th bn ngoi h thng, giao tip vi h thng thng qua giao din ra lnh v nhn kt qu t h thng. H thng ch c mt tc nhn duy nht l ngi dng. M t tc nhn:
Nguoi dung

Tc nhn Nguoi dung qun l ton b d liu ca h thng c cc chc nng upload, download, delete.

.I.3.2.

Nhn dng cc Use Case

.1 Chc nng upload

Dng cho Nguoi dung ti cc file t my tnh c nhn ln trang web. Cc s kin bao gm: H thng hin th ton b mn hnh qun l ca chng trnh. Ngi dng nhn nt Upload, sau chn File cn Upload, Nhn OK, h thng s hin th giao din thng bo Upload thnh cng. Ngi dng nhn nt Upload, sau chn File cn Upload, Nhn OK, Nu file khng hp l, chng trnh s xut ra thng bo li file, Ngi dng nhn Cancel ng thng bo, chng trnh quay v giao din ban u.
.2 Chc nng download

Dng cho Nguoi dung ti cc file hin c trn trang web v my tnh c nhn. Cc s kin bao gm: H thng hin th ton b cc file ang c trn trang web. Ngi dng nhn nt Download, hin th pop up xc nhn ti file v, chn th mc lu file v nhn OK.
.3 Chc nng xa file

Dng cho Nguoi dung xa nhng file khng mun chia s hin c trn trang web. Cc s kin bao gm: H thng hin th ton b cc file ang c trn trang web.
Nguyn Hu Nguyn Ph Duy 63

Tm hiu cng ngh MPLS VPN Q oS

Ngi dng nhn nt Delete, Hin th Form c chc chn xoa khi chng trnh khng?, Click Ok, File d liu s b xa khi mn hnh hin th. Ngi dng nhn nt Delete, Hin th Form c chc chn xoa khi chng trnh khng?, Click Cancel, Chng trnh s tr v mn hnh hin th. .I.3.3. Xy dng biu Use Case
Upload file

Download file

Nguoi dung

Delete file

Hnh 56. Biu Use Case chc nng ca Ngi dng

.I.4.
.I.4.1.

M hnh ha s tng tc gia cc i tng


Biu hot ng

.1 Upload file

Nguyn Hu Nguyn Ph Duy

64

Tm hiu cng ngh MPLS VPN Q oS

duyet trang web

hien thi cac chuc nang loi khi upload file chon chuc nang upload upload file thanh cong

hien thi cua so chon tap tin

chon file can upload

Hnh 57. Biu hot ng chc nng Upload file .2 Download file

Nguyn Hu Nguyn Ph Duy

65

Tm hiu cng ngh MPLS VPN Q oS

duyet trang web

hien thi cac file hien co tren trang web

upload file thanh cong

chon file can download

chon thu muc de luu file

Hnh 58. Biu hot ng chc nng Download file .3 Delete file
duyet trang web

hien thi cac file hien co tren trang web

huy bo viec delete file

delete file thanh cong

chon file can delete

xac nhan viec delete file

Hnh 59. Biu hot ng chc nng Delete file

Nguyn Hu Nguyn Ph Duy

66

Tm hiu cng ngh MPLS VPN Q oS

.I.4.2.

Biu tun t

.1 Upload file

Hnh 60. Biu tun t chc nng Upload file .2 Download file

Hnh 61. Biu tun t chc nngDownload file

.3 Delete file Nguyn Hu Nguyn Ph Duy 67

Tm hiu cng ngh MPLS VPN Q oS

Hnh 62. Biu tun t chc nng Delete file

.I.5.

Thit k c s d liu

Chng trnh qun l d liu nhm mc ch m phng QoS trn mng MPLS nn rt n gin ch bao gm 1 bng. Tbl_files
ID File_name File_type Orig_name File_ext File_size Dowloaded Bng 6. Bng c s d liu ca trang web

.II Phn tch bi m phng chia s d liu qua mng MPLS


.II.1. Phn tch yu cu
Dng s m phng nh l mt mng ISP thu nh c kt ni vi mng khch hng. M phng ng cch truyn gi tin c nhn.
Nguyn Hu Nguyn Ph Duy 68

Tm hiu cng ngh MPLS VPN Q oS

Cu hnh thit b ging vi mt mng ISP nhng vi quy m nh hn.

.II.2. Thit k m phng


Do hn ch v cu hnh phn cng v thit b, bi lab c xy dng vi quy m nh nhng vn m bo tnh ng n ca mt mng ISP c cc khch hng kt ni ti. M hnh trin khai

Min MPLS

M ng khch hng

M ng khch hng

FT Serv P er Web Serv er

Client

Hnh 63. M hnh mng thc t

.II.3. Cc giao thc s dng trong bi lab


Giao thc LDP: dng thit lp mi quan h lng ging gia cc LSR thc hin vic gn nhn v phn phi nhn. Giao thc EIGRP: giao thc nh tuyn ni dng trong mng ca ISP s dng thut ton distance vector v link state. Giao thc RIP: giao thc nh tuyn ni dng trong mng ca khch hng s dng thut ton distance vector. Giao thc BGP: giao thc dng path vector dng nh tuyn gia mng khch hng v mng ca ISP nm trong hai vng t tr khc nhau.

.II.4. Cc phn mm s dng trong bi lab


GNS3 0.7.4: phn mm gi lp cc thit b mng nh router, switch s dng cc IOS tht.
Nguyn Hu Nguyn Ph Duy 69

Tm hiu cng ngh MPLS VPN Q oS

VMWare Workstation 7.0: phn mm to ra cc my tnh o chy trn my tht dng gi lp cc my FTP Server, Web Server v my client. Internet Download Manager 6.05: phn mm h tr tng tc download. DU Meter: phn mm dng o dung lng d liu gi/nhn v o bng thng.

Nguyn Hu Nguyn Ph Duy

70

CH NG IV

KT QU TH NGHIM
.I
.I.1.

Kt qu trang web m phng chia s d liu trc tuyn


Trang ch
Sau khi g vo a ch trang web, ngi dng s c chuyn ti trang ch.

Hnh 64. Giao din chnh ca trang web

.I.2.

Chc nng upload

Sau khi ngi dng nhn vo nt upload s hin th ca s upload d liu t my tnh.

Nguyn Hu Nguyn Ph Duy

71

Tm hiu cng ngh MPLS VPN Q oS

Hnh 65. Giao din chc nng upload

.I.3.

Chc nng delete

Khi ngi dng nhn vo nt delete s hin th ca s xc nhn vic xa file.

Hnh 66. Chc nng delete

Nguyn Hu Nguyn Ph Duy

72

Tm hiu cng ngh MPLS VPN Q oS

.II Kt qu bi m phng vic trin khai QoS trong mng MPLS


.II.1. Quy hoch a ch IP cho cc thit b

Hnh 67. M hnh mng bi lab

Quy hoch cho my Server v my Client Server Client IP Address 192.168.3.2/30 192.168.3.14/30 Default Gateway 192.168.3.1 192.168.3.13

Bng 7. Bng quy hoch a ch IP cho my Server v my Client

Quy hoch cho cc router mng khch hng CE1 CE2 Fa1/0 192.168.3.5/30 192.168.3.10/30 Fa1/1 192.168.3.1/30 192.168.3.13/30 Loopback 0 192.168.1.1/32 192.168.2.1/32

Bng 8. Bng quy hoch a ch IP cho cc router CE

Quy hoch cho cc router ca nh cung cp dch v ISP


Nguyn Hu Nguyn Ph Duy 73

Tm hiu cng ngh MPLS VPN Q oS

PE1 P1 P2 PE2

Fa1/0 204.134.83.1/30 204.134.83.5/30 204.134.83.6/30 204.134.83.10/30

Fa1/1 192.168.3.6/30 204.134.83.2/30 204.134.83.9/30 192.168.3.9/30

Loopback 0 204.134.84.1/32 204.134.84.2/32 204.134.84.3/32 204.134.84.4/32

Bng 9. Bng quy hoch a ch IP cho cc LSR

.II.2. Kt qu
Trc tin, kim tra kt ni gia Server v Client xem thng hay cha bng cch thc hin vic ping gia 2 my. Ping t Server n Client

Ping t Client n Server

Hnh 68. Kt qu ping t Server n Client

Nguyn Hu Nguyn Ph Duy

74

Tm hiu cng ngh MPLS VPN Q oS

Hnh 69. Kt qu ping t Client n Server

Khi kt ni gia Server v Client thng sut, ti Server, ta s chy chng trnh XAMPP kch hot cc dch v FTP v Web. Ti Client, ta s thc hin vic download cc file hin c trn FTP Server v Web Server. Vic download s thc hin trong hai trng hp: mng cha p cc chnh sch QoS v mng p cc chnh sch QoS. Download file khi mng cha p cc chnh sch QoS

Nguyn Hu Nguyn Ph Duy

75

Tm hiu cng ngh MPLS VPN Q oS

Download file khi mng p cc chnh sch QoS

Hnh 70. Tc ti file khi cha p dng QoS

Nguyn Hu Nguyn Ph Duy

76

Tm hiu cng ngh MPLS VPN Q oS

Hnh 71. Tc ti file khi p dng QoS

Nguyn Hu Nguyn Ph Duy

77

KT LUN
.I
.I.1.

Kt qu t c
L thuyt

Qua ti nghin cu ny, chng em hiu r kin trc c bn ca cng ngh MPLS, cch thc phn phi nhn v cch truyn gi tin trong mng MPLS. Hiu thm v mt s m hnh VPN, nhng u im cng nh hn ch ca cng ngh MPLS VPN so vi m hnh VPN truyn thng. Hiu thm v cc kin trc QoS, s kt hp gia m hnh DiffServ v MPLS.

.I.2.

M phng

Thc hin thnh cng vic m phng trang web chia s d liu mc tng i n gin nhng vn m bo mt s chc nng chnh ca mt trang web chia s d liu. M phng chnh xc m hnh mng thu nh ca mt ISP s dng cng ngh MPLS trong mng li v p dng cc chnh sch QoS mt cch ng n.

.II Hn ch
Trang web chia s d liu cha thc hin c vic phn quyn cho ngi dng, cha c cc tnh nng nng cao nh tm kim file, lit k danh sch cc file c ti nhiu nht, lit k cc t kha c tm kim nhiu nht Do cng ngh MPLS c nn kin thc tri rng trn nhiu mng nn cn mt s mng chng em cha nghin cu ht nh TE, AtoM, MPLS trong mi trng IPv6

.III Hng pht trin


Nghin cu cc mng kin thc rng hn trong vn thc hin QoS nh TE, DS TE v trin khai trn thc t. Pht trin h thng Mng ng b cc phng ban t cp huyn n cp vng cho ton khu vc Min Trung - Ty Nguyn da trn nn tng cng ngh MPLS B sung cc chc nng nng cao cho trang web nh phn quyn ngi dng, tm kim

Nguyn Hu Nguyn Ph Duy

78

PH LC
PH LC A Cc hm chnh ca website function uploadify() { $file = $this->input->post('filearray'); $data['json'] = $file = json_decode($file); $newname = $this->_rename(BASEPATH . '../assets/upload/', $file->file_name); if (!$newname) { $newname = $file->file_name; } rename(BASEPATH . '../assets/upload/' . $file->file_name, BASEPATH . '../assets/upload/' . $newname); $this->file_model->save( array( 'file_name' => $newname, 'orig_name' => $file->file_name, 'file_ext' => $file->file_ext, 'file_size' => $file->file_size ) ); $result = $this->load->view('file/uploadify', $data); echo $result; } protected function _rename($path, $filename) { $file_ext = substr($filename, strrpos($filename, ".")); // file extension .mp3 mt_srand(); $filename = md5(uniqid(mt_rand())) . $file_ext; // check if file exist if (!file_exists($path . $filename)) { return $filename; } $filename = str_replace($file_ext, '', $filename); $new_filename = ''; for ($i = 1; $i < 100; $i++) { if (!file_exists($path . $filename . $i . $file_ext)) { $new_filename = $filename . $i . $file_ext; break; } } if ($new_filename == '') { i

ii

return FALSE; } else { return $new_filename; } } // basic upload public function upload() { $this->template->write_view('content', 'file/upload', array('error' => '')); // render template $this->template->add_js('assets/js/jquery-1.2.6.js'); $this->template->add_js('assets/js/jquery.MultiFile.min.js'); $this->template->write('title', 'Upload file'); $this->template->render(); } public function do_upload() { $config['upload_path'] = './assets/upload/'; $config['allowed_types'] = 'avi|mp3|doc|docx|rar|zip|pdf|txt'; $config['encrypt_name'] = TRUE; $this->load->library('upload', $config); $this->load->library('Multi_upload'); $files = $this->multi_upload->go_upload(); if (!$files) { $error = array('error' => $this->upload->display_errors()); $this->template->add_js('assets/js/jquery-1.2.6.js'); $this->template->add_js('assets/js/jquery.MultiFile.min.js'); $this->template->write('title', 'Upload file fail, try again'); $this->template->write_view('content', 'file/upload', $error); } else { $data = array('upload_data' => $files); // save db foreach ($files as $file) { $this->file_model->save($file); } $this->template->write_view('content', 'file/success', $data); $this->template->write('title', 'Upload successful'); } $this->template->render(); } // download filew public function download($id) { Nguyn Hu Nguyn Ph Duy ii

iii

// download + 1 $file = $this->file_model->get_by_id($id)->result_array(); $file[0]['downloaded'] = $file[0]['downloaded'] + 1; $this->file_model->update($id, $file[0]); redirect(base_url() . 'assets/upload/' . $file[0]['file_name'], 'refresh'); } public function delete($id) { $this->file_model->delete($id); redirect('file', 'refresh'); } }

Nguyn Hu Nguyn Ph Duy

iii

iv

PHC LC B

1. File cu hnh CE1 class-map match-all ftp-out match ip dscp af31 class-map match-all http-in match protocol http class-map match-all ftp-in match protocol ftp class-map match-all http-out match ip dscp af11 ! ! policy-map ip2mpls-in description *** Policy to set DSCP value for IP packets *** class http-in set ip dscp af11 class ftp-in set ip dscp af31 policy-map ip2mpls-out description *** Policy to shape traffic before coming into MPLS domain *** class http-out bandwidth percent 20 shape average 1000000 class ftp-out bandwidth percent 5 shape average 600000 class class-default bandwidth percent 50 ! interface Loopback0 ip address 192.168.1.1 255.255.255.255 !
Nguyn Hu Nguyn Ph Duy iv

interface FastEthernet0/0 no ip address shutdown duplex half ! interface FastEthernet1/0 description *** Connect to PE1 *** ip address 192.168.3.5 255.255.255.252 duplex auto speed auto service-policy output ip2mpls-out ! interface FastEthernet1/1 description *** Default Gateway *** ip address 192.168.3.1 255.255.255.252 duplex auto speed auto service-policy input ip2mpls-in ! router rip version 2 network 192.168.3.0 no auto-summary ! router bgp 65001 no synchronization bgp log-neighbor-changes redistribute connected neighbor 192.168.3.6 remote-as 65000 no auto-summary ! 2. File cu hnh CE2
Nguyn Hu Nguyn Ph Duy v

vi

! class-map match-all ftp-out match ip dscp af31 class-map match-all http-out match ip dscp af11 ! policy-map mpls2ip-out description *** Policy to forward packets base on DSCP value *** class http-out bandwidth percent 20 random-detect class ftp-out bandwidth percent 5 random-detect class class-default bandwidth percent 50 random-detect ! interface Loopback0 ip address 192.168.2.1 255.255.255.255 ! interface FastEthernet0/0 no ip address shutdown duplex half ! interface FastEthernet1/0 description *** Connect to PE2 *** ip address 192.168.3.10 255.255.255.252 duplex auto speed auto ! interface FastEthernet1/1
Nguyn Hu Nguyn Ph Duy vi

vii

description *** Default Gateway *** ip address 192.168.3.13 255.255.255.252 duplex auto speed auto service-policy output mpls2ip-out ! router rip version 2 network 192.168.3.0 no auto-summary ! router bgp 65002 no synchronization bgp log-neighbor-changes redistribute connected neighbor 192.168.3.9 remote-as 65000 no auto-summary ! 3. File cu hnh PE1 ! ip cef no ip domain lookup ! no mpls ip propagate-ttl mpls ldp explicit-null ! class-map match-all ftp-out match mpls experimental topmost 3 class-map match-all http-in match ip dscp af11 class-map match-all ftp-in match ip dscp af31
Nguyn Hu Nguyn Ph Duy vii

viii

class-map match-all http-out match mpls experimental topmost 1 class-map match-all mpls2mpls-out ! policy-map ip2mpls-in description *** Policy to police traffic coming into MPLS domain *** class http-in police cir 1000000 bc 100000 be 100000 conform-action set-mpls-exp-topmost-transmit 1 exceed-action drop violate-action drop class ftp-in police cir 600000 bc 100000 be 100000 conform-action set-mpls-exp-topmost-transmit 3 exceed-action drop policy-map mpls2mpls-out description *** Policy to forward packets base on EXP value *** class http-out set mpls experimental topmost 1 bandwidth percent 20 random-detect class ftp-out set mpls experimental topmost 3 bandwidth percent 5 class class-default bandwidth percent 50 random-detect ! interface Loopback0 ip address 204.134.84.1 255.255.255.255 ! interface FastEthernet0/0 no ip address
Nguyn Hu Nguyn Ph Duy viii

ix

shutdown duplex half ! interface FastEthernet1/0 description *** Connect to P1 Router *** ip address 204.134.83.1 255.255.255.252 duplex auto speed auto mpls label protocol ldp mpls ip service-policy output mpls2mpls-out ! interface FastEthernet1/1 description *** Link to CE1 *** ip address 192.168.3.6 255.255.255.252 duplex auto speed auto service-policy input ip2mpls-in ! router eigrp 2011 network 204.134.83.0 network 204.134.84.0 no auto-summary ! router bgp 65000 no synchronization bgp log-neighbor-changes neighbor 192.168.3.5 remote-as 65001 neighbor 204.134.84.4 remote-as 65000 neighbor 204.134.84.4 update-source Loopback0 neighbor 204.134.84.4 next-hop-self no auto-summary !
Nguyn Hu Nguyn Ph Duy ix

4. File cu hnh PE2 ! ip cef no ip domain lookup ! no mpls ip propagate-ttl mpls ldp explicit-null ! class-map match-all ftp-out match qos-group 3 class-map match-all http-in match mpls experimental topmost 1 class-map match-all ftp-in match mpls experimental topmost 3 class-map match-all http-out match qos-group 1 ! policy-map mpls2ip-in description *** Policy to map EXP value to DSCP value *** class http-in set qos-group mpls experimental topmost class ftp-in set qos-group mpls experimental topmost policy-map mpls2ip-out description *** Policy to forward packets base on DSCP value *** class http-out set ip dscp af11 bandwidth percent 20 random-detect class ftp-out set ip dscp af31 bandwidth percent 5
Nguyn Hu Nguyn Ph Duy x

xi

random-detect class class-default bandwidth percent 50 random-detect ! interface Loopback0 ip address 204.134.84.4 255.255.255.255 ! interface FastEthernet0/0 no ip address shutdown duplex half ! interface FastEthernet1/0 description *** Connect to P2 Router *** ip address 204.134.83.10 255.255.255.252 duplex auto speed auto mpls label protocol ldp mpls ip service-policy input mpls2ip-in ! interface FastEthernet1/1 description *** Link to CE2 *** ip address 192.168.3.9 255.255.255.252 duplex auto speed auto service-policy output mpls2ip-out ! router eigrp 2011 network 204.134.83.0 network 204.134.84.0 no auto-summary
Nguyn Hu Nguyn Ph Duy xi

xii

! router bgp 65000 no synchronization bgp log-neighbor-changes neighbor 192.168.3.10 remote-as 65002 neighbor 204.134.84.1 remote-as 65000 neighbor 204.134.84.1 update-source Loopback0 neighbor 204.134.84.1 next-hop-self no auto-summary ! 5. File cu hnh P1 ! ip cef no ip domain lookup ! no mpls ip propagate-ttl ! class-map match-all ftp-out match mpls experimental topmost 3 class-map match-all http-out match mpls experimental topmost 1 ! policy-map mpls2mpls-out description *** Policy to forward packets base on EXP value *** class http-out set mpls experimental topmost 1 bandwidth percent 20 random-detect class ftp-out set mpls experimental topmost 3 bandwidth percent 5 random-detect
Nguyn Hu Nguyn Ph Duy xii

xiii

class class-default set mpls experimental topmost 0 bandwidth percent 50 random-detect ! interface Loopback0 ip address 204.134.84.2 255.255.255.255 ! interface FastEthernet0/0 no ip address shutdown duplex half ! interface FastEthernet1/0 description *** Link to P2 Router *** ip address 204.134.83.5 255.255.255.252 duplex auto speed auto mpls label protocol ldp mpls ip service-policy output mpls2mpls-out ! interface FastEthernet1/1 description *** Link to PE1 *** ip address 204.134.83.2 255.255.255.252 duplex auto speed auto mpls label protocol ldp mpls ip ! router eigrp 2011 network 204.134.83.0 network 204.134.84.0
Nguyn Hu Nguyn Ph Duy xiii

xiv

no auto-summary !

Nguyn Hu Nguyn Ph Duy

xiv

TI LIU THAM KHO


[1] James Reagan. CCIP MPLS Study Guide. Sybex, 2002, 456 tr. [2] Eric Osborne, Ajay Simha. Traffic Engineering with MPLS. Cisco Press, 2002, 608 tr. [3] Santiago Alvarez. QoS for IP/MPLS Networks. Cisco Press, 2006, 336 tr. [4] John Evans, Clarence Filsfils. Deploying IP and MPLS QoS for Multiservice Networks: Theory and Practice. Morgan Kaufmann, 2007, 419 tr. [5] Luc De Ghein. MPLS Fundamentals. Cisco Press, 2007, 608 tr. [6] Tim Szigeti. End To End QoS Network Design. Cisco Press, 2004, 768 tr. [7] Jim Guichard, Ivan Pepelnjak. MPLS and VPN Architectures. Cisco Press, 2000, 448 tr. [8] http://vnpro.org/forum [9] http://wikipedia.org