Está en la página 1de 118

CHNG I. TNG QUAN V MNG MY TNH 1.1.

Gii thiu lch s pht trin Vo gia nhng nm 50 khi nhng th h my tnh u tin c a vo hot ng thc t vi nhng bng n in t th chng c kch thc rt cng knh v tn nhiu nng lng. Hi vic nhp d liu vo cc my tnh c thng qua cc tm ba m ngi vit chng trnh c l sn. Mi tm ba tng ng vi mt dng lnh m mi mt ct ca n c cha tt c cc k t cn thit m ngi vit chng trnh phi c l vo k t mnh la chn. Cc tm ba c a vo mt "thit b" gi l thit b c ba m qua cc thng tin c a vo my tnh (hay cn gi l trung tm x l) v sau khi tnh ton kt qu s c a ra my in. Nh vy cc thit b c ba v my in c th hin nh cc thit b vo ra (I/O) i vi my tnh. Sau mt thi gian cc th h my mi c a vo hot ng trong mt my tnh trung tm c th c ni vi nhiu thit b vo ra (I/O) m qua n c th thc hin lin tc ht chng trnh ny n chng trnh khc. Cng vi s pht trin ca nhng ng dng trn my tnh cc phng php nng cao kh nng giao tip vi my tnh trung tm cng c u t nghin cu rt nhiu. Vo gia nhng nm 60 mt s nh ch to my tnh nghin cu thnh cng nhng thit b truy cp t xa ti my tnh ca h. Mt trong nhng phng php thm nhp t xa c thc hin bng vic ci t mt thit b u cui mt v tr cch xa trung tm tnh ton, thit b u cui ny c lin kt vi trung tm bng vic s dng ng dy in thoi v vi hai thit b x l tn hiu (gi l Modem) gn hai u v tn hiu c truyn thay v trc tip th thng qua dy in thoi. Modem ng dy in thoi Modem

Thit b u cui

My tnh trung tm

Hnh 1.1. M hnh truyn d liu t xa u tin Nhng dng u tin ca thit b u cui bao gm my c ba, my in, thit b x l tn hiu, cc thit b cm nhn. Vic lin kt t xa c th thc hin thng qua nhng vng khc nhau v l nhng dng u tin ca h thng mng.

Trong lc a ra gii thiu nhng thit b u cui t xa, cc nh khoa hc trin khai mt lot nhng thit b iu khin, nhng thit b u cui c bit cho php ngi s dng nng cao c kh nng tng tc vi my tnh. Mt trong nhng sn phm quan trng l h thng thit b u cui 3270 ca IBM. H thng bao gm cc mn hnh, cc h thng iu khin, cc thit b truyn thng c lin kt vi cc trung tm tnh ton. H thng 3270 c gii thiu vo nm 1971 v c s dng dng m rng kh nng tnh ton ca trung tm my tnh ti cc vng xa. lm gim nhim v truyn thng ca my tnh trung tm v s lng cc lin kt gia my tnh trung tm vi cc thit b u cui, IBM v cc cng ty my tnh khc sn xut mt s cc thit b sau: Thit b kim sot truyn thng: c nhim v nhn cc bit tn hiu t cc knh truyn thng, gom chng li thnh cc byte d liu v chuyn nhm cc byte ti my tnh trung tm x l, thit b ny cng thc hin cng vic ngc li chuyn tn hiu tr li ca my tnh trung tm ti cc trm xa. Thit b trn cho php gim bt c thi gian x l trn my tnh trung tm v xy dng cc thit b logic c trng. Thit b kim sot nhiu u cui: cho php cng mt lc kim sot nhiu thit b u cui. My tnh trung tm ch cn lin kt vi mt thit b nh vy l c th phc v cho tt c cc thit b u cui ang c gn vi thit b kim sot trn. iu ny c bit c ngha khi thit b kim sot nm cch xa my tnh v ch cn s dng mt ng in thoi l c th phc v cho nhiu thit b u cui.
Thit b u cui

Thit b kim sot truyn thng My tnh trung tm Thit b kim sot nhiu u cui

Modem

Modem

Thit b kim sot nhiu u cui

Thit b u cui

Thit b u cui

Thit b u cui

Hnh 1.2. M hnh trao i mng ca h thng 3270 Vo gia nhng nm 1970, cc thit b u cui s dng nhng phng php lin kt qua ng cp nm trong mt khu vc c ra i. Vi nhng u im t nng cao tc truyn d liu v qua kt hp c kh nng tnh ton ca cc 2

my tnh li vi nhau. thc hin vic nng cao kh nng tnh ton vi nhiu my tnh cc nh sn xut bt u xy dng cc mng phc tp. Vo nhng nm 1980 cc h thng ng truyn tc cao c thit lp Bc M v Chu u v t cng xut hin cc nh cung cp cc dnh v truyn thng vi nhng ng truyn c tc cao hn nhiu ln so vi ng dy in thoi. Vi nhng chi ph thu bao chp nhn c, ngi ta c th s dng c cc ng truyn ny lin kt my tnh li vi nhau v bt u hnh thnh cc mng mt cch rng khp. y cc nh cung cp dch v xy dng nhng ng truyn d liu lin kt gia cc thnh ph v khu vc vi nhau v sau cung cp cc dch v truyn d liu cho nhng ngi xy dng mng. Ngi xy dng mng lc ny s khng cn xy dng li ng truyn ca mnh m ch cn s dng mt phn cc nng lc truyn thng ca cc nh cung cp. Vo nm 1974 cng ty IBM gii thiu mt lot cc thit b u cui c ch to cho lnh vc ngn hng v thng mi, thng qua cc dy cp mng cc thit b u cui c th truy cp cng mt lc vo mt my tnh dng chung. Vi vic lin kt cc my tnh nm trong mt khu vc nh nh mt ta nh hay l mt khu nh th tin chi ph cho cc thit b v phn mm l thp. T vic nghin cu kh nng s dng chung mi trng truyn thng v cc ti nguyn ca cc my tnh nhanh chng c u t. Vo nm 1977, cng ty Datapoint Corporation bt u bn h iu hnh mng ca mnh l "Attached Resource Computer Network" (hay gi tt l Arcnet) ra th trng. Mng Arcnet cho php lin kt cc my tnh v cc trm u cui li bng dy cp mng, qua tr thnh l h iu hnh mng cc b u tin. T n nay c rt nhiu cng ty a ra cc sn phm ca mnh, c bit khi cc my tnh c nhn c s dng mt cnh rng ri. Khi s lng my vi tnh trong mt vn phng hay c quan c tng ln nhanh chng th vic kt ni chng tr nn v cng cn thit v s mang li nhiu hiu qu cho ngi s dng. Ngy nay vi mt lng ln v thng tin, nhu cu x l thng tin ngy cng cao. Mng my tnh hin nay tr nn qu quen thuc i vi chng ta, trong mi lnh vc nh khoa hc, qun s, quc phng, thng mi, dch v, gio dc... Hin nay nhiu ni mng tr thnh mt nhu cu khng th thiu c.

1.2.

Mc ch hnh thnh mng my tnh

1.2.1. Khi nim mng my tnh Mng my tnh l tp hp cc my tnh n l c kt ni vi nhau bng cc ng truyn vt l (Transmission Medium) theo mt kin trc mng xc nh (Network Architecture). ng truyn vt l: dng chuyn cc tn hiu in t gia cc my tnh. Cc tn hiu in t biu th cc gi tr d liu di dng cc xung nh phn. Tt c cc tn hiu c truyn gia cc my tnh u thuc mt dng sng in t (EM) no , tri t cc tn s radio ti sng cc ngn (viba) v tia hng ngoi. Ty theo tn s ca sng in t c th dng cc ng truyn vt l khc nhau. C hai loi l ng truyn vt l l ng truyn hu tuyn v ng truyn v tuyn. Kin trc mng gm cu trc mng (Topology) v giao thc mng (Protocols). Topology l cu trc hnh hc ca cc thc th mng v giao thc mng l tp cc quy tc chun cc thc th hot ng truyn thng phi tun theo. Hu tuyn ng truyn vt l Mng my tnh
Cp ng trc Cp xon i Cp si quang Radio Viba V tinh

V tuyn

Kin trc mng im im Giao thc


OSI TCP/IP X25

Cu trc mng

Mng hnh sao Mng hnh cy y

Tnh ng

Qung b
- BUS - Vng -

Tp trung

Phn tn

Hnh 1.1. Cu trc mng my tnh 1.2.2. Mc ch hnh thnh mng my tnh Cng chia s cc ti nguyn chung, bt k ngi s dng no cng c quyn khai thc, s dng ti nguyn ca mng m khng ph thuc vo v tr a l ca n. 4

Nng cao tin cy ca h thng nh kh nng thay th khi mt s thnh phn ca mng xy ra s c k thut th vn duy tr s hot ng bnh thng ca h thng. To mi trng giao tip gia ngi vi ngi. Chinh phc c khong cch, con ngi c th trao i, tho lun vi nhau cch xa nhau hng nghn km. 1.2.3. ng dng v nh hng v mt x hi ca mng my tnh C th gim s lng my in, a cng v cc thit b khc. Kinh t trong vic u t xy dng cho mt h thng tin hc ca mt c quan, x nghip, doanh nghip, Dng chung ti nguyn t tin nh my in, phn mm ...Trnh d tha d liu, ti nguyn mng. C kh nng t chc v trin khai cc n ln thun li v d dng. Bo m cc tiu chun thng nht v tnh bo mt, an ton d liu khi nhiu ngi s dng ti cc thit b u cui khc nhau cng lm vic trn cc h c s d liu. 1.3. Cc dch v mng

1.3.1. Cc xu hng pht trin mng my tnh Cung cp cc dch v truy nhp vo cc ngun thng tin xa khai thc v x l thng tin. Cung cp cc dch v mua bn, giao dch qua mng... Pht trin cc dch v tng tc gia ngi vi ngi trn phm vi din rng. p ng nhu cu trao i thng tin a dch v, a phng tin. To cc kh nng lm vic theo nhm bng cc dch v th in t, video hi ngh, cha bnh t xa ... Xu hng pht trin cc dch v gii tr trc tuyn (Online) hin i. Cc hnh thc dch v truyn hnh, nghe nhc, chi game trc tuyn qua mng... 1.3.2. Cc dch v ph bin trn mng my tnh Dch v tp (File services) cho php chia s ti nguyn thng tin chung, chuyn giao cc tp d liu t my ny sang my khc. Tm kim thng tin v iu khin truy nhp. Dch v th in t E_Mail (Electronic mail) cung cp cho ngi s dng phng tin trao i, tranh lun bng th in t. Dch v th in t gi thnh h, chuyn pht nhanh, an ton v ni dung c th tch hp cc loi d liu. Dch v in n: C th dng chung cc my in t tin trn mng. Cung cp kh nng a truy nhp n my in, phc v ng thi cho nhiu nhu cu in khc nhau. Cung cp cc dch v FAX v qun l c cc trang thit b in chuyn dng.

Cc dch v ng dng hng i tng: S dng cc dch v thng ip (Message) lm trung gian tc ng n cc i tng truyn thng. i tng ch bn giao d liu cho tc nhn (Agent) v tc nhn s bn giao d liu cho i tng ch. Cc dch v ng dng qun tr lung cng vic trong nhm lm vic: nh tuyn cc ti liu in t gia nhng ngi trong nhm. Khi ch k in t c xc nhn trong cc phin giao dch th c th thay th c nhiu tin trnh mi hiu qu v nhanh chng hn. Dch v c s d liu l dch v ph bin v cc dch v ng dng, l cc ng dng theo m hnh Client/Server. Dch v x l phn tn lu tr d liu phn tn trn mng, ngi dng trong sut v d s dng, p ng cc nhu cu truy nhp ca ngi s dng. 1.4. Phng tin truyn dn vt l

1.4.1. c trng c bn ca ng truyn Bng thng (Bandwidth): Bng thng ca mt ng truyn l min tn s gii hn thp v tn s gii hn cao, tc l min tn s m ng truyn c th p ng c. V d bng thng ca cp thoi t 400 n 4000 Hz, c ngha l n c th truyn cc tn hiu vi tn s t 400 n 4000 chu k/giy. Bng thng ca cp ph thuc vo chiu di ca cp. Cp ngn bng thng cao v ngc li. V vy khi thit k lp t cp, chiu di cp sao cho khng vt qua gii hn cho php, v c th xy ra li trong qu trnh truyn. Thng lng (Throughput) Thng lng ca ng truyn l s lng cc bit (chui bit) c truyn i trong mt giy. Hay ni cch khc l tc ca ng truyn dn. K hiu l bit/s hoc bps. Tc ca ng truyn ph thuc vo bng thng v di ca n. Mt mng LAN Ethernet tc truyn 10 Mbps v c bng thng l 10 Mbps. Suy hao (Attenuation): L o s suy yu ca cc tn hiu trn ng truyn. Suy hao ph thuc vo di ca cp, cp cng di th suy hao cng cao. Khi thit k cp cng rt cn quan tm n gii hn chiu di cho php ca tng loi cp. 1.4.2. Cc loi cp mng Cp ng trc (Coaxial cable): L phng tin truyn cc tn hiu c ph rng v tc cao. Bng thng ca cp ng trc t 2,5 Mbps (ARCnet) n 10 Mbps (Ethernet).

Thng s dng lp t mng hnh BUS (cc loi mng LAN cc b Thick Ethernet, Thin Ethernet) v mng hnh sao (mng ARCnet). Cp ng trc gm: mt dy dn trung tm, mt dy dn ngoi, to nn ng ng bao quanh trc, tng cch in gia 2 dy dn v cp v bc ngoi. Cc loi cp ng trc Cp RC-8 v RCA-11, 50 Ohm dng cho mngThick Ethernet; Cp RC-58 , 50 Ohm dng cho mng Thin Ethernet; Cp RG-59 , 75 Ohm dng cho truyn hnh cp; Cp RC-62, 93 Ohm dng cho mng ARCnet. Cp xon i (Twisted Pair cable): Cp xon i c s dng trong cc mng LAN cc b. Gi thnh r, d ci t, c v bc trnh nhit , m v c loi c kh nng chng nhiu STP (Shield Twisted Pair). Cp c bn c 2 dy ng xon vo nhau, gim nhy ca cp vi EMI, gim bc x m nhiu tn s radio gy nhiu. Cc loi cp xon: Cp c mng chn (STP): Loi cp STP thng c tc truyn vo

khong 16 Mbps trong loi mng Token Ring. Vi chiu di 100 m tc t 155 Mbps (l thuyt l 500 Mbps). Suy hao cho php khong 100 m, c tnh EMI cao. Gi thnh cao hn cp Thin Ethernet, cp xon trn, nhng li r hn gi thnh loi cp Thick Ethernet hay cp si quang. Ci t i hi tay ngh v k nng cao. Loi cp khng c v bc UTP (Unshield Twisted Pair): Cp trn

khng c kh nng chng nhiu, tc truyn khong 100 Mbps. c tnh suy hao nh cp ng, gii hn di ti a 100m. Do thiu mng chn nn rt nhy cm vi EMI, khng ph hp vi mi trng cc nh my. c dng ph bin cho cc loi mng, gi thnh h, d lp t. Cp si quang (Fiber Optic Cable) rt l tng cho vic truyn d liu, bng thng c th t 2 Gbps, trnh nhiu tt, tc truyn 100 Mbps trn on cp di vi km. Cp si quang gm mt hoc nhiu si quang trung tm c bao bc bi mt lp v nha phn x cc tn hiu tr li, v vy hn ch s suy hao, mt mt tn hiu. Cp si quang ch truyn cc tn hiu quang. Cc tn hiu d liu c bin i thnh cc tn hiu quang trn ng truyn v khi nhn, cc tn hiu quang chuyn thnh cc tn hiu d liu. Cp si quang hot ng mt trong hai ch : ch n (Single Mode) v a 7

ch (Multi Mode). Ci t cp si quang i hi phi c k nng cao, quy trnh kh v phc tp. 1.4.3. Cc phng tin v tuyn Radio: Quang ph ca in t nm trong khong 10 KHz n 1GHz. C nhiu gii tn: Sng ngn (Short Wave), VHF (VeryHightFrequency)-Tivi&Radio FM v UHF (Ultra Hight Frequency)-Tivi c tnh truyn: tn s n, cng sut thp khng h tr tc d liu cc mng cc b LAN yu cu. Tn s n, cng sut cao d ci t, bng thng cao t 1 - 10 Mbps, suy hao chm. Kh nng nhiu t thp, bo mt km. Gi thnh cao trung bnh. Radio quang ph tri (Spread spectrum) tin cy cao, bo mt d liu. Bng thng cao, tc truyn c th t theo yu cu ca cc mng cc b. Viba: Truyn thng viba c hai dng: Viba mt t v v tinh. Viba mt t s dng cc trm thu v pht. K thut truyn thng v tinh s dng cc trm thu mt t (cc a v tinh) v cc v tinh. Tn hiu n v tinh v t v tinh n trm thu mt lt i hoc v 23.000 dm. Thi gian truyn mt tn hiu c lp vi khong cch. Thi gian truyn tn hiu t v tinh n cc trm nm vng trn 1/3 chu vi qu t l nh nhau, gi l tr lan truyn (Propagation Delay). Thng thng l 0,5 - 5 giy. Tia hng ngoi (Infrared system): C 2 phng thc kt ni mng Point - to Point v Multi Point. Point - to - Point tip sng cc tn hiu hng ngoi t thit b ny sang thit b khc.Gii tn t 100 GHz n 1000 THz, tc truyn khong 100 Kbps16 Mbps. Multi Point truyn ng thi cc tn hiu hng ngoi n cc thit b. Gii tn s t 100 GHz n 1000 THz, nhng tc truyn ch t ti a 1 Mbps. 1.5. Cu trc mng (Topology) Topology l cu trc hnh hc khng gian ca mng thc cht l cch b tr v tr vt l cc node v cch thc kt ni chng li vi nhau. C hai kiu cu trc mng: kiu im - im (Point to Point) v kiu qung b (Multi Point). 1.5.1. Kiu im - im ng truyn ni tng cp nt mng vi nhau v mi nt u c trch nhim lu tr tm thi sau chuyn tip d liu ti ch khi ng truyn rnh. Do cn c gi l mng lu tr v chuyn tip (store and forward). Mt s dng topo ca cu trc mng im im:

Hnh 1.2. Mt s topo mng kiu im im u im cn bn ca cu trc mng loi ny l t c kh nng xy ra ng thng lng tin (Collision) trn ng truyn vt l, nhng nhc im ln nht ca n l hiu sut s dng ng truyn khng cao, chim dng nhiu ti nguyn mng, tr ln, cn tiu tn nhiu thi gian thit lp ng truyn v x l ti cc node. 1.5.2. Kiu qung b Tt c cc nt phn chia chung mt ng truyn vt l. D liu c gi i t mt nt no ti tt c cc nt cn li, bi vy d liu phi c gn km a ch ch. C th c nhiu node cng truy nhp ng thi trn ng truyn chung, v vy cn thit phi c c ch gii quyt vn ng thng tin (Collision) Cc mng c cu trc qung b c phn chia: Qung b

Qung b tnh

Qung b ng

Qung b ng tp trung

Qung b ng phn tn

Hnh 1.3. Cu trc qung b Qung b tnh: Kiu cp pht tnh in hnh l ngi ta chia thi gian thnh nhiu khong ri rc v dng c ch quay vng (Round Robin) cp pht ng truyn cho cc node Qung b ng tp trung: Ngi ta thit k v ci t thm mt b phn trung gian c chc nng tip nhn yu cu truyn s liu v cp pht ng truyn cho cc node c nhu cu trao i thng tin

Qung b ng phn tn: Khng c b trung gian, cc node t quyt nh quyn truy nhp ng truyn ph thuc vo trng thi ca ng truyn 1.6. Khi nim v giao thc mng my tnh (Protocols)

1.6.1. Khi nim v giao thc Cc thc th ca mng mun trao i thng tin vi nhau phi bt tay, m phn v mt s th tc, quy tc... Cng phi ni chung mt ngn ng. Tp quy tc hi thoi c gi l giao thc mng (Protocols). Cc thnh phn chnh ca mt giao thc bao gm: C php: nh dng d liu, phng thc m ho v cc mc tn hiu. Ng ngha: thng tin iu khin, iu khin lu lng v x l li.. Trao i thng tin gia hai thc th c th l trc tip hoc gin tip. Trong hai h thng kt ni im - im, cc thc th c th trao i thng tin trc tip khng c s can thip ca cc thc th trung gian. Trong cu trc qung b, hai thc th trao i d liu vi nhau phi thng qua cc thc th trung gian. Phc tp hn khi cc thc th khng chia s trn cng mt mng chuyn mch, kt ni gin tip phi qua nhiu mng con. 1.6.2. Chc nng giao thc ng gi: Trong qu trnh trao i thng tin, cc gi d liu c thm vo mt s thng tin iu khin, bao gm a ch ngun v a ch ch, m pht hin li, iu khin giao thc... Vic thm thng tin iu khin vo cc gi d liu c gi l qu trnh ng gi (Encapsulation). Bn thu s c thc hin ngc li, thng tin iu khin s c g b khi gi tin c chuyn t tng di ln tng trn. Phn on v hp li: Mng truyn thng ch chp nhn kch thc cc gi d liu c nh. Cc giao thc cc tng thp cn phi ct d liu thnh nhng gi c kch thc quy nh. Qu trnh ny gi l qu trnh phn on. Ngc vi qu trnh phn on bn pht l qu trnh hp li bn thu. D liu phn on cn phi c hp li thnh thng ip thch hp tng ng dng (Application). V vy vn m bo th t cc gi n ch l rt quan trng. Gi d liu trao i gia hai thc th qua giao thc gi l n v giao thc d liu PDU (Protocol Data Unit). iu khin lin kt: Trao i thng tin gia cc thc th c th thc hin theo hai phng thc: hng lin kt (Connection - Oriented) v khng lin kt (Connectionless). Truyn khng lin kt khng yu cu c tin cy cao, khng yu

10

cu cht lng dch v v khng yu cu xc nhn. Ngc li, truyn theo phng thc hng lin kt, yu cu c tin cy cao, m bo cht lng dch v v c xc nhn. Trc khi hai thc th trao i thng tin vi nhau, gia chng mt kt ni c thit lp v sau khi trao i xong, kt ni ny s c gii phng. Gim st: Cc gi tin PDU c th lu chuyn c lp theo cc con ng khc nhau, khi n ch c th khng theo th t nh khi pht. Trong phng thc hng lin kt, cc gi tin phi c yu cu gim st. Mi mt PDU c mt m tp hp duy nht v c ng k theo tun t. Cc thc th nhn s khi phc th t cc gi tin nh th t bn pht. iu khin lu lng: lin quan n kh nng tip nhn cc gi tin ca thc th bn thu v s lng hoc tc ca d liu c truyn bi thc th bn pht sao cho bn thu khng b trn ngp, m bo tc cao nht. Mt dng n gin ca ca iu khin lu lng l th tc dng v i (Stop-and Wait), trong mi PDU pht cn phi c xc nhn trc khi truyn gi tin tip theo. C tin cy cao khi truyn mt s lng nht nh d liu m khng cn xc nhn. K thut ca s trt l th d c ch ny. iu khin lu lng l mt chc nng quan trng cn phi c thc hin trong mt s giao thc. iu khin li: l k thut cn thit nhm bo v d liu khng b mt hoc b hng trong qu trnh trao i thng tin. Pht hin v sa li bao gm vic pht hin li trn c s kim tra khung v truyn li cc PDU khi c li. Nu mt thc th nhn xc nhn PDU li, thng thng gi tin s phi c pht li. ng b ho: Cc thc th giao thc c cc tham s v cc bin trng thi v nh ngha trng thi, l cc tham s v kch thc ca s, tham s lin kt v gi tr thi gian. Hai thc th truyn thng trong giao thc cn phi ng thi trong cng mt trng thi xc nh. V d cng trng thi khi to, im kim tra v hu b, c gi l ng b ho. ng b ho s kh khn nu mt thc th ch xc nh c trng thi ca thc th khc khi nhn cc gi tin. Cc gi tin khng n ngay m phi mt mt khong thi gian lu chuyn t ngun n ch v cc gi tin PDU cng c th b tht lc trong qu trnh truyn. a ch ho: Hai thc th c th truyn thng c vi nhau, cn phi nhn dng c nhau. Trong mng qung b, cc thc th phi nhn dng nh danh ca n trong gi tin. Trong cc mng chuyn mch, mng cn nhn bit thc th ch nh tuyn d liu trc khi thit lp kt ni.

11

1.7.

Phn loi mng

1.7.1. Phn loi theo khong cch LAN (Local Area Network) - Mng cc b Mng cc b LAN: kt ni cc my tnh n l thnh mng ni b, to kh nng trao i thng tin v chia s ti nguyn trong c quan, x nhip... C hai loi mng LAN khc nhau: LAN ni dy (s dng cc loi cp) v LAN khng dy (s dng sng cao tn hay tia hng ngoi). c trng c bn ca mng cc b: Quy m ca mng: Nh, phm vi hot ng vo khong vi km. Cc my trong mt ta nh, mt c quan hay x nghip ni li vi nhau. Qun tr v bo dng mng n gin. Cng ngh truyn dn: Thng s dng qung b (Broadcast), bao gm mt cp n ni tt c cc my. Tc truyn d liu cao, t 10 100 Mbps n hng trm Gbps, thi gian tr nh (c 10s), tin cy cao, t s li bit t 10-8 n 10-11. Cu trc topo ca mng: Mng hnh BUS, hnh vng (Ring), hnh sao (Star) v cc loi mng kt hp, lai ghp.....

- Mng hnh BUS hot ng theo kiu qung b (Broadcast). Tt c cc


node truy nhp chung trn mt ng truyn vt l c u v cui (BUS). Chun IEEE 802.3 c gi l Ethernet, l mt mng hnh BUS qung b vi c ch iu khin qung b ng phn tn, trao i thng tin vi tc 10 Mbps hoc 100 Mbps.

Terminator

Computer B

Terminator

Bus

Computer A

Hnh 1.4. Cu trc mng hnh BUS Phng thc truy nhp ng truyn c s dng trong mng hnh BUS hoc TOKEN BUS, hoc a truy nhp s dng sng mang vi vic pht

12

hin xung t thng tin trn ng truyn CSMA/CD (Carrier Sense Multiple Access with Collision Detection). Mng hnh vng (RING) l mng qung b (Broadcast), tt c cc node

cng truy nhp chung trn mt ng truyn vt l. Tn hiu c lu chuyn trn vng theo mt chiu duy nht, theo lin kt im - im. D liu c chuyn mt cch tun t tng bit quanh vng, qua cc b chuyn tip. B chuyn tip c ba chc nng: chn, nhn v hy b thng tin. Cc b chuyn tip s kim tra a ch ch trong cc gi d liu khi i qua n.

My 2

My 3

My 4


My 6

My 5

My 1

Hnh 1.5. Cu trc mng hnh RING Mng hnh sao (Star) cc trm kt ni vi mt thit b trung tm c

chc nng iu khin ton b hot ng ca mng. D liu c truyn theo cc lin kt im - im. Thit b trung tm c th l mt b chuyn mch, mt b chn ng hoc n gin l mt HUB.
My 1

My 2

My 4

My 3

My 5 My 6

Hnh 1.6. Cu trc mng hnh sao (STAR) Mng LAN hng ngoi (Infrared) s dng sng hng ngoi truyn

d liu. Phm vi hot ng ca mng b hn ch trong mt phng, v tn hiu hng ngoi khng i xuyn qua tng. C hai phng php kt ni im im v kt ni qung b. Cc mng im - im hot ng bng cch chuyn tip cc tn hiu hng ngoi t mt thit b ti thit b k tip. Tc d liu

13

t khong 100Kb/s n 16Mb/s. Cc mng qung b hng ngoi c tc truyn d liu thc t ch t di 1Mb/s. Mng LAN tri ph (Spread spectrum) S dng k thut tri ph,

thng dng trong cng nghip v y t. Mng LAN vi ba bng hp: Hot ng vi tn s vi ba nhng khng

tri ph. C hai dng truyn thng: vi ba mt t v v tinh. Cc h thng vi ba mt t thng hot ng bng tn 4-6 GHz v 21- 23 GHz, tc truyn d liu khong vi chc Mbps. MAN (Metropolitan) - Mng th Mng th MAN hot ng theo kiu qung b, LAN to LAN. Mng cung cp cc dch v thoi v phi thoi v truyn hnh cp. Trong mt mng MAN, c th s dng mt hoc hai ng truyn vt l v khng cha thc th chuyn mch. Da trn tiu chun DQDB (Distributed Queue Dual Bus - IEEE 802.6) quy nh 2 cp n kt ni tt c cc my tnh li vi nhau, cc my bn tri lin lc vi cc my bn phi thng tin vn chuyn trn ng BUS trn. Cc my bn tri lin lc vi cc my bn phi, thng tin i theo ng BUS di.

Hng truyn d liu trn BUS A


BUS A Head - End

BUS B

Hng truyn d liu trn BUS B

Hnh 1.7. Cu trc mng th MAN WAN (Wide Area Networks) - Mng din rng c trng c bn ca mt mng WAN: Hot ng trn phm vi mt quc gia hoc trn ton cu. Tc truyn d liu thp so vi mng cc b. Li truyn cao. Mng tch s hp a dch v ISDN (Integrated Services Digital Network) 14

Mt s mng din rng in hnh

Mng X25 v chuyn mch khung Frame Relay Phng thc truyn khng ng b ATM (Asynchronous Transfer Mode) Mng hi t - mng th h sau NGN (Next Generation Network)

Kt ni lin mng (Internet Connectivity) Nhu cu trao i thng tin v chia s ti nguyn chung i hi cc hot ng truyn thng cn thit phi kt ni nhiu mng thnh mt mng ln, gi l lin mng. Lin mng (internet) l mng ca cc mng con, l mt tp cc mng LAN, WAN, MAN c lp c kt ni li vi nhau. Kt ni lin mng c mt s li ch sau: - Gim lu thng trn mng: Cc gi tin thng c lu chuyn trn cc mng con v cc gi tin lu thng trn lin mng khi cc mng con lin lc vi nhau. - Ti u ho hiu nng: Gim lu thng trn mng l ti u hiu nng ca mng, tuy nhin my ch (Server Load) s phi tng ti khi n c s dng nh mt Router. - n gin ho vic qun tr mng: C th xc nh cc s c k thut v c lp d dng hn trong mt mng c quy m nh, thng l trong mt mng cc b chng hn. - Hiu qu hn so vi mng WAN: c phm vi hot ng ln, chi ph gim, hiu nng lin mng tng v phc tp ca vic qun l nh hn. Mt trong nhng chc nng ch yu ca cc thit b kt ni lin mng l chc nng nh tuyn (Routing). C 3 phng thc kt ni lin mng c bn: - Kt ni cc mng LAN thun nht ti tng vt l to ra lin mng c phm vi hot ng rng v tng s lng cc node trn mng, gim bt lu lng trn mi mng con, hn ch tc nghn v ng thng tin. Cc mng con hot ng hiu qu hn. - Kt ni cc mng LAN khng thun nht ti tng 2 (Data Link) to ra mt lin mng bao gm mt s mng LAN cc b kt ni vi nhau bng cc b chuyn mch n cc my ch c lp vi tc cao. - Kt ni cc mng LAN cc kiu khc nhau ti tng 3 (Network Layer) to ra mt mng WAN n. Cc node chuyn mch kt ni vi nhau theo mt cu trc li. Mi mt node chuyn mch cung cp dch v cho tp hp cc thit b u cui (DTE) ca n. 15

1.7.2. Mng chuyn mch knh (Circuit Switched Networks) Trc khi trao i thng tin, h thng s thit lp kt ni gia 2 thc th bng mt ng truyn vt l. Thc th ch nu bn, kt ni ny s b hu b. Duy tr kt ni trong sut qu trnh 2 thc th trao i thng tin. Gii phng kt ni: Sau khi truyn xong d liu, kt ni s c hu b, gii phng cc ti nguyn b chim dng sn sng phc v cho cc yu cu kt ni khc. Nhc im l cn nhiu thi gian thit lp knh truyn, v vy thi gian thit lp knh chm v xc sut kt ni khng thnh cng cao. Khi c hai khng cn thng tin truyn, knh b b khng trong khi cc thc th khc c nhu cu. 1.7.3. Mng chuyn mch gi (Packet Switched Networks) Nguyn l chuyn mch gi: Thng ip (Message) ca ngi s dng c chia thnh nhiu gi nh (Packet) c di quy nh. di gi tin cc i (Maximum Transfer Unit) MTU trong cc mng khc nhau l khc nhau. Cc gi tin ca mt thng ip c th truyn c lp trn nhiu tuyn hng ch v cc gi tin ca nhiu thng ip khc nhau c th cng truyn trn mt tuyn lin mng. Ti mi node, cc gi tin c tip nhn, lu tr, x l ti b nh, khng cn phi lu tr tm thi trn b nh ngoi (nh a cng) v c chuyn tip n node k tip. nh tuyn cc gi tin qua mng nhanh hn v hiu qu hn. K thut chuyn mch gi c nhiu u im hn so vi chuyn mch knh: - Cc gi tin lu chuyn hng ch c lp, trn mt ng c th chia s cho nhiu gi tin. V vy hiu sut ng truyn cao hn. Cc gi tin c xp hng v truyn qua tuyn kt ni. Hai thc th c tc d liu khc nhau c th trao i cc gi vi tc Trong mng chuyn mch knh, khi lu lng tng th mng t chi

ph hp. thm cc yu cu kt ni (do nghn) cho n khi gim xung. Trong mng chuyn mch gi, cc gi tin vn c chp nhn, nhng tr phn pht gi tin c th tng ln. Cc cng ngh chuyn mch gi: Nu mt thc th gi mt gi d liu qua mng c di ln hn kch thc gi cc i MTU, n s c chia thnh cc gi nh c di quy nh v gi ln mng. C hai k thut c s dng trong cc mng chuyn

16

mch gi l k thut datagram trong mng khng lin kt (Connectionless) v k thut knh o cho mng hng lin kt (Connection - Oriented). Phng thc datagram s dng trong mng khng lin kt: Mi mt gi tin c lu chuyn v x l c lp, khng cn tham chiu n cc gi tin gi trc. Mi mt gi tin c xem nh l mt datagram. u, nhc im ca phng thc datagram: Giai on thit lp v gii phng kt ni s c b qua. Ph hp vi yu cu truyn khi lng d liu khng ln trong thi gian ngn. Phng thc linh hot hn so vi phng thc knh o. Nu xy ra nghn thng tin, cc datagram c th c nh tuyn ra khi vng nghn. V nu c node b hng, cc gi tin t tm mt tuyn khc lu chuyn hng ch, vic phn pht cc gi tin tin cy hn. Phng thc knh o VC (Virtual Circuit) s dng trong mng hng lin kt: Trc khi trao i thng tin, hai thc th tham gia truyn thng m phn vi nhau v cc tham s truyn thng nh kch thc ti a ca gi tin, cc ca s, ng truyn... . Mt knh o c hnh thnh thng qua lin mng v tn ti cho n khi cc thc th ngng trao i vi nhau. Ti mt thi im, c th c nhiu knh o i v n t nhiu hng khc nhau. Cc gi tin vn c m ti mi node v c xp hng u ra trn mt ng truyn, cc gi tin ca cc thng ip khc trn knh o khc c th chia s s dng ng truyn ny. u, nhc im ca phng php knh o: Mng c th cung cp cc dch v knh o, bao gm vic iu khin li v th t cc gi tin. Tt c cc gi tin i trn cng mt tuyn s n theo th t ban u. iu khin li m bo khng ch cc gi n ch theo ng th t m cho tt c cc gi khng b li. Mt u im khc l cc gi tin lu chuyn trn mng s nhanh hn v khng cn phi nh tuyn ti cc node. Tuy nhin s kh khn hn vic thch ng vi nghn. Nu c node b hng th tt c cc knh o qua node s b mt, vic phn pht datagram cng kh khn hn, tin cy khng cao. 1.8. M hnh tham chiu v giao thc trn mng

1.8.1. Kin trc phn tng Ti sao phi phn lp mng my tnh ? S khc bit v kin trc mng gy tr ngi cho ngi s dng khi kt ni lin mng, nh hng n sc sn xut v tiu th cc sn phm v mng. Cn xy dng m hnh chun lm c s cho cc nh nghin cu v thit k mng to ra cc sn phm m v mng v to iu kin cho vic pht trin v s dng mng. V vy cc t 17

chc tiu chun quc t ra i. Cc nh sn xut c ting ni chung cho cc sn phm ca h, l cc chun, cc khuyn ngh quy nh thit k v sn xut cc sn phm mng. Cc t chc tiu chun: ISO (International Standards Organization): T chc tiu chun quc t hot ng di s bo tr ca Lin Hip Quc. Chia thnh nhiu ban k thut - Technical Commitee- k hiu l TC, trong ban TC97 m nhn vic nghin cu chun ho x l thng tin. Cc sn phm ca n gi l cc chun - Standard - M hnh OSI - Open Systems Interconnection l sn phm in hnh ca t chc ny. CCITT (International Telegraphand Telephone Consultative Commintte): U ban t vn in tn & in thoi quc t nay l Hip hi Vin thng quc t ITU (International Telecommunication Union). L t chc bao gm cc c quan Bu chnh Vin thng ca cc nc. Cc sn phm c gi l cc khuyn ngh (Recommendation): - Khuyn ngh loi V: Tp cc tiu chun v truyn d liu bng Modem: V21 tc 300 bps, V32 tc 9600 - 14.400 bps, V90, V92 cho tc 56 Kbps. - Khuyn ngh loi X: Tp cc tiu chun lin quan n mng truyn s liu. Quy nh cc th tc giao din ngi s dng v giao din mng: X21, X25,... - Khuyn ngh loi I: Cc tiu chun lin quan n mng ISDN - IEEE (Institute of Electronical And Electronic Engineers): Vin cc k s in v in t. Tp cc th tc tng vt l. Kin trc phn tng Cc mng my tnh c thit k v ci t theo quan im c cu trc phn tng. Mi mt thnh phn ca mng c xem nh mt h thng gm nhiu tng v mi mt tng bao gm mt s chc nng truyn thng. Cc tng c chng ln nhau, s lng v chc nng ca cc tng ph thuc vo cc nh sn xut v thit k. Tuy nhin quan im chung l trong mi tng c nhiu thc th (cc tin trnh) thc hin mt s chc nng nhm cung cp mt s dch v, th tc cho cc thc th tng trn hot ng Cc quy tc phn tng - Khng nh ngha qu nhiu tng, s lng tng, vai tr v chc nng ca cc tng trong mi h thng ca mng l nh nhau, khng qu phc tp khi xc nh v ghp ni cc tng. Chc nng cc tng c lp vi nhau v c tnh m. - Trong mi h thng, cn xc nh r mi quan h gia cc tng k nhau, mi quan h ny gi l giao din tng (Interface). Mi quan h ny quy nh nhng thao tc 18

v dch v c bn m tng k di cung cp cho tng k trn v s cc tng tc qua li gia hai tng k nhau l nh nht. - Xc nh mi quan h gia cc ng tng thng nht v cc phng thc hot ng trong qu trnh truyn thng, mi quan h l tp cc quy tc v cc tho thun trong hi thoi gia cc h thng, gi l giao thc tng. - D liu khng c truyn trc tip t tng th i ca h thng pht sang tng th i ca h thng nhn (tr tng thp nht - tng vt l) m c chuyn t tng cao xung tng thp nht bn h thng pht v qua ng truyn vt l, d liu l chui bit khng cu trc c truyn sang tng thp nht ca h thng nhn v t d liu c chuyn ngc ln cc tng trn. Gia cc ng tng xc nh lin kt logic, gia cc tng vt l c lin kt vt l. Nh vy mi mt tng c hai quan h: quan h theo chiu ngang v quan h theo chiu dc. S lng cc tng v cc giao thc tng c gi l kin trc mng (Network Architecture). Quan h theo chiu ngang phn nh s hot ng ca cc ng tng. Cc ng tng trc khi trao i thng tin vi nhau phi bt tay, hi thoi v tha thun vi nhau bng cc tham s ca cc giao thc (hay l th tc), c gi l giao thc tng. Quan h theo chiu dc l quan h gia cc tng k nhau trong cng mt h thng. Gia chng tn ti giao din xc nh cc thao tc nguyn thy v cc dch v tng di cung cp cho tng trn. c gi l giao din tng. Trong mi mt tng c mt hoc nhiu thc th (Entity) hot ng. Cc thc th c th l mt tin trnh (Process) trong mt h a x l, hoc c th l mt chng trnh con ... Chng thc hin cc chc nng ca tng N v giao thc truyn thng vi cc thc th ng tng trong cc h thng khc. K hiu N_Entity l thc th tng N. Cc thc th truyn thng vi cc thc th tng trn n v cc thc th tng di n thng qua cc im truy nhp dch v trn cc giao din SAP (Service Access Point). Cc thc th phi bit n cung cp nhng dch v g cho cc hot ng tng trn k n v cc hot ng truyn thng ca n c s dng nhng dch v g do tng k di n cung cp thng qua cc li gi hm qua cc im truy nhp SAP trn giao din cc tng. Khi m t hot ng ca bt k giao thc no trong m hnh OSI, cn phi phn bit c cc dch v cung cp bi tng k di, hot ng bn trong ca tng v cc dch v m n khai thc. S tch bit gia cc tng gip cho vic b sung, sa i chc nng ca giao thc tng m khng nh hng n hot ng ca cc tng khc.

19

H thng A Tng N

Giao thc tng N

H thng B Tng N

Tng i +1 Tng i Tng i - 1

Giao thc tng i+1 Giao thc tng i Giao thc tng i-1

Tng i +1 Tng i Tng i - 1

Giao din i + 1/i Giao din i /i - 1

Tng 1

Giao thc tng 1 ng truyn vt l

Tng 1

Hnh 1.8. M hnh kin trc phn tng Lu chuyn thng tin gia cc tng: D liu khng truyn trc tip t tng i my ny sang tng i my kia (tr tng thp nht). Tng thp nht c ng truyn thng vt l ti tng thp nht ca my tng tng t d liu v thng tin iu khin li c chuyn ngc ln tng trn. Tng trn ch xc nh ng truyn thng logic (truyn thng o) truyn thng ng tng, gi tin khi chuyn xung qua cc tng s c b sung thm vo phn u bng thng tin iu khin ca tng. Vic thm Header vo u cc gi tin khi i qua mi tng trong qu trnh truyn d liu c gi l qu trnh Encapsulation. Qu trnh bn nhn s din ra theo chiu ngc li, khi i qua cc tng, gi tin s tch thng tin iu khin thuc n trc khi chuyn d liu ln tng trn. n v d liu c s dng trong cc tng bao gm: - Thng tin iu khin giao thc PCI (Protocol Control Information): Thng tin c thm vo u cc gi tin trong qu trnh hot ng truyn thng ca cc thc th. K hiu N_PCI l thng tin iu khin tng N. - n v d liu dch v SDU (Service Data Unit): L n v d liu truyn thng gia cc tng k nhau. K hiu N_SDU l n v d liu truyn t tng (N+1) xung tng N cha thm thng tin iu khin. - n v d liu giao thc PDU (Protocol Data Unit) : n v d liu giao thc tng. K hiu PDU = PCI + SDU, ngha l n v d liu giao thc bao gm thng tin iu khin PCI c thm vo u n v d liu dch v SDU.

20

Giao din tng, quan h cc tng k nhau v dch v Chc nng ca cc tng l cung cp dch v cho tng trn k n. Trong mi tng c mt hay nhiu thc th. Thc th tng N thc hin cc dch v m tng N+1 yu cu s dng, Cc thc th trao i dch v vi nhau qua cc im truy cp dch v SAP (Service Access Points). Cc thc th tng N cung cp dch v cho tng N+1 qua cc SAP trn giao din N+1/N. Mi mt SAP c mt nhn dng duy nht.

Hnh 1.9. Giao din v dch v trong mi trng cc h thng m Hai tng trao i thng tin vi nhau phi c nhng tho thun v thit lp cc quy tc giao din. Thc th ca tng N+1 chuyn mt PDU ti thc th tng N qua SAP. PDU bao gm mt n v d liu dch v SDU v thng tin iu khin PCI. SDU l thng tin gi qua mng ti thc th ng tng v sau a ln tng N+1. Nu di ca SDU ln hn di quy nh, cc thc th tng N chia SDU ra nhiu gi nh c di quy nh v thm Header PCI vo mi gi tin. Header ca PDU c cc thc th ng tng nhn dng PDU no cha d liu v PDU no cha thng tin iu khin... Hnh 1.9 minh ho giao din v dch v trong cc tng k nhau. Nh bit, thc th tng N t h thng A khng th truyn d liu trc tip sang tng N ca h thng B m phi chuyn tun t xung cc tng di n, cho ti tng thp nht, tng vt l. Bng phng tin truyn vt l, d liu l nhng chui bit 0 v 1 c truyn sang tng vt l ca h thng B. T y d liu c chuyn ln cc tng trn. Dch v v cht lng dch v Tng N s phi bit s dng dch v no ca tng N-1 v cung cp nhng dch v g cho tng N+1. Qu trnh cung cp dch v thng qua cc im truy nhp SAP trn cc giao din tng N/N+1. C hai loi dch v khc nhau: dch v hng lin kt (Connection Oriented) v dch v khng lin kt (Connectionless).

21

- Dch v hng lin kt (Connection Oriented): Cc dch v v giao thc trong cc m hnh h thng m thc hin truyn thng 3 giai on theo th t thi gian nh sau: Thit lp lin kt: Mt knh logic c thit lp gia cc thc th ng tng ca hai h thng khc nhau. Chng s m phn, thng lng vi nhau v tp cc tham s v s dng cc tham s ny nh th no trong qu trnh truyn s liu. Truyn d liu: D liu c truyn gia hai tng ng tng theo c ch kim sot v qun l qu trnh truyn d liu, thc hin vic ghp knh, ct hp d liu... bo m c th t truyn, pht hin li, kim sot lung d liu, pht hin tc nghn thng tin...nhm tng cng tin cy cao v hiu sut truyn. Gii phng lin kt: Sau khi kt thc qu trnh truyn d liu, cc ti nguyn ca h thng c cp pht cho qu trnh thit lp lin kt v truyn d liu s c gii phng, sn sng cp pht cho lin kt tip theo. - Dch v khng lin kt (Connectionless): Dch v khng lin kt khng cn tiu tn thi gian thit lp lin kt v gii phng lin kt gia cc thc th ng tng. Khng yu cu kim sot lung d liu, d liu c truyn vi tc cao nhng tin cy thp. Khng truyn li trong trng hp xy ra li ng truyn. Cc dch v khng lin kt ph hp vi cc yu cu truyn dung lng khng ln, cc cuc trao i thng tin ri rc v c lp. Mi dch v c c trng bi cht lng dch v. Mt s dch v yu cu c tin cy cao, bng cch yu cu thc th ch gi xc nhn phn hi sau khi nhn gi tin. V vy my thu lun bo m gi tin n ng v khng mt d liu. X l xc nhn phn hi i hi phi chn thm vo gi tin mt s thng tin iu khin v lm tng thi gian tr. Mt loi dch v hng lin kt tin cy l dch v truyn file vi yu cu mi bit gi n u chnh xc v ng th t nh khi gi i. Mt s loi dch v chp nhn c mt s li nhng yu cu yu cu tr nh nh thoi s, video. Vi dch v loi ny th khng cn xc nhn c bo nhn, nhm gim thi gian tr ti cc nt. Ngoi dch v hng lin kt v khng lin kt, cn c kiu dch v hi - p. My gi s gi cc thng tin cha yu cu xc nhn trong cc gi tin v yu cu my nhn tr li. Khi my nhn nhn c gi tin, s gi cc tr li n my gi. Dch v hi - p c s dng truyn thng trong m hnh khch-ch (Client-Server). My khch (Client) gi cc yu cu cho my ch (Server) v my ch tr li kt qu cho my khch.

22

Loi

Dch v

V d Gi cc trang sch theo ng th t. Truy nhp v khai thc t xa. Cc dch v thoi s Th in t, nhn tin Th c ng k, th khn Cu truy vn trong c s d liu

Truyn/nhn cc gi tin, yu cu c xc nhn. Hng Truyn/nhn dng byte, yu cu c lin kt xc nhn. Kt ni khng yu cu c xc nhn. Datagram khng xc nhn Khng Datagram c xc nhn lin kt Hi - p Cc hm dch v nguyn thy (Primitive)

Vic cung cp v nhn cc dch v gia cc thc th trong cc tng k nhau thng qua vic gi cc hm dch v nguyn thy. Mt dch v c c t hnh thc bng nhiu hm dch v nguyn thy. Cc hm dch v nguyn thy s dng nh ngha s tng tc gia cc tng k nhau, ch r chc nng cn thc hin v s dng chuyn d liu v thng tin iu khin. C th hn, cc hm dch v nguyn thy l c t cc thao tc cn thc hin mt yu cu hay tr li mt yu cu ca cc thc th ng tng. C bn kiu hm dch v nguyn thy c bn: 1. Request (Yu cu): c mt thc th s dng gi mt chc nng, yu cu cc phng tin cung cp dch v mng. 2. Indication (Ch bo): c mt thc th ch bo yu cu cung cp dch v. Ch bo yu cu bng cch: - Gi mt chc nng no . - Ch bo mt chc nng c gi ti mt im SAP. 3. Response (Tr li): c thc th yu cu s dng hon tt mt chc nng c gi bi hm Indication ti im truy nhp dch v. 4. Confirm (Xc nhn): c thc th cung cp dch v s dng xc nhn hon tt cc th tc c yu cu t trc bi hm dch v nguyn thy Request. Giao thc v dch v Mi mt lp giao thc c hai c trng: c trng dch v v c trng giao thc. c trng dch v l cc tham s dch v trong cc hm nguyn thy. Thng qua cc tham s dch v m cc tng trn c th giao tip vi ng tng trong h thng

23

khc. c trng giao thc bao gm: Khun dng PDU, cc tham s dch v s dng cho mi mt loi PDU v phng thc hot ca thc th giao thc. Dch v v giao thc l nhng khi nim khc nhau. Mt dch v l mt tp cc cc thao tc ca cc thc th (th tc..) ca tng cung cp dch v cho cc hot ng cc thc th ca tng trn k n. Dch v tng c nh ngha trong sut i vi i tng s dng dch v. Ngc li, mt giao thc l mt tp cc quy tc, quy c v kt ni, ng ngha, nh dng, ngha ca khung, gi hoc bn tin c cc thc th ng tng m phn, thng lng vi nhau. Cc thc th s dng giao thc thc hin s xc nh cc dch v. 1.8.2. Cc m hnh tham chiu c bn M hnh OSI M hnh OSI l m hnh cn bn v cc tin trnh truyn thng, thit lp cc tiu chun kin trc mng mc Quc t, l c s chung cc h thng khc nhau c th lin kt v truyn thng c vi nhau. M hnh OSI t chc cc giao thc truyn thng thnh 7 tng, mi mt tng gii quyt mt phn hp ca tin trnh truyn thng, chia tin trnh truyn thng thnh nhiu tng v trong mi tng c th c nhiu giao thc khc nhau thc hin cc nhu cu truyn thng c th. H thng m A 7 6 5 4 3 2 1 APPLYCATION PRESENTATION SESSION TRANSPORT NETWORK DATA LINK PHYSICAL H thng m B NG DNG TRNH DIN PHIN GIAO VN MNG LIN KT D LIU VT L 7 6 5 4 3 2 1

Giao thc tng 7 Giao thc tng 6 Giao thc tng 5 Giao thc tng 4 Giao thc tng 3 Giao thc tng 2 Giao thc tng 1

ng truyn vt l Hnh 1.10. M hnh OSI M hnh OSI tun theo cc nguyn tc phn tng nh sau:

- M hnh gm N =7 tng. OSI l h thng m, phi c kh nng kt ni


24

vi cc h thng khc nhau, tng thch vi cc chun OSI.

- Qu trnh x l cc ng dng c thc hin trong cc h thng m, trong


khi vn duy tr c cc hot ng kt ni gia cc h thng.

- Thit lp knh logic nhm thc hin vic trao i thng tin gia cc thc th.
Vai tr v chc nng ch yu ca cc tng trong m hnh OSI: Tng Vt l (Physical layer): Tng vt l l tng thp nht trong m hnh 7 lp OSI. Cc thc th tng giao tip vi nhau qua mt ng truyn vt l. Tng vt l xc nh cc chc nng, th tc v in, c, quang kch hot, duy tr v gii phng cc kt ni vt l gia cc h thng mng. Cung cp cc c ch v in, c hm, th tc ..., nhm thc hin vic kt ni cc phn t ca mng thnh mt h thng bng cc phng php vt l. m bo cho cc yu cu v chuyn mch hot ng nhm to ra cc ng truyn thc cho cc chui bit thng tin. Cc chun trong tng vt l l cc chun xc nh giao din ngi s dng v mi trng mng. Cc giao thc tng vt l c hai loi: truyn d b (Asynchronous) v truyn ng b (Synchronous). Tng lin kt d liu (Data link Layer): Chc nng ch yu ca tng lin kt d liu l thc hin thit lp cc lin kt, duy tr v hy b cc lin kt d liu. Kim sot li v kim sot lu lng. Chia thng tin thnh cc khung thng tin (Frame), truyn cc khung tun t v x l cc thng ip xc nhn (Acknowledgement Frame) t bn my thu gi v. Tho g cc khung thnh chui bt khng cu trc chuyn xung tng vt l. Tng 2 bn thu, ti to chui bt thnh cc khung thng tin. ng truyn vt l c th gy li, nn tng lin kt d liu phi gii quyt vn kim sot li, kim sot lung, kim sot lu lng, ngn khng nt ngun gy ngp lt d liu cho bn thu c tc thp hn. Trong cc mng qung b, tng con MAC (Medium Acces Sublayer) iu khin vic truy nhp ng truyn. Tng mng (Network Layer): Thc hin cc chc nng chn ng (Routing i cho cc gi tin t ngun ti ch c th trong cng mt mng hoc khc mng nhau. ng i c th c c nh, cng c th c nh ngha khi bt u hi thoi v c th ng i l ng (Dynamic) c th thay i vi tng gi tin ty theo trng thi ti tc thi ca mng. Trong mng kiu qung b (Broadcast) routing rt n gin. Mt chc nng quan trng khc ca tng mng l chc nng iu khin tc nghn (Congestion Control). Nu c qu nhiu gi tin cng lu chuyn trn cng mt ng th c th xy ra tnh trng tc nghn. Thc hin chc nng giao tip gia cc mng khi cc gi tin i t mng ny sang mng khc ti ch. 25

Tng vn chuyn (Transport Layer): L tng cao nht c lin quan n cc giao thc trao i d liu gia cc h thng m, kim sot vic truyn d liu t mt ti mt (End- to -End). Th tc trong 3 tng di (vt l, lin kt d liu v mng) ch phc v vic truyn d liu gia cc tng k nhau trong tng h thng. Cc thc th ng tng hi thoi, thng lng vi nhau trong qu trnh truyn d liu. Tng vn chuyn thc hin vic chia cc gi tin ln thnh cc gi tin nh hn trc khi gi i v nh s cc gi tin v m bo chng chuyn theo ng th t. L tng cui cng chu trch nhim v mc an ton trong truyn d liu nn giao thc tng vn chuyn ph thuc nhiu vo bn cht ca tng mng. Tng vn chuyn c th thc hin vic ghp knh (multiplex) mt vi lin kt vo cng mt lin kt ni gim gi thnh. Tng trnh by (Presentation Layer): Tng trnh by gii quyt cc vn lin quan n c php v ng ngha ca thng tin c truyn. Biu din thng tin ngi s dng ph hp vi thng tin lm vic ca mng v ngc li. Thng thng biu din thng tin cc ng dng ngun v ng dng ch c th khc nhau bi cc ng dng c chy trn cc h thng c th khc nhau. Tng trnh by phi chu trch nhim chuyn i d liu gi i trn mng t mt loi biu din ny sang mt loi khc. t c iu n cung cp mt dng biu din truyn thng chung cho php chuyn i t dng biu din cc b sang biu din chung v ngc li. Tng ng dng (Application Layer): Xc nh giao din gia ngi s dng v mi trng OSI. Bao gm nhiu giao thc ng dng cung cp cc phng tin cho ngi s dng truy cp vo mi trng mng v cung cp cc dch v phn tn. Khi cc thc th ng dng AE (Application Entity) c thit lp, n s gi n cc phn t dch v ng dng ASE (Application Service Element). Mi thc th ng dng c th gm mt hoc nhiu cc phn t dch v ng dng. Cc phn t dch v ng dng c phi hp trong mi trng ca thc th ng dng thng qua cc lin kt gi l i tng lin kt n SAO (Single Association Object). SAO iu khin vic truyn thng v cho php tun t ha cc s kin truyn thng. Tm tt chc nng cc tng nh sau: Tng Physical Data link Chc nng ch yu m bo cc yu cu truyn/nhn cc chui bt qua ng truyn vt l. To/g b khung thng tin (frame), kim sot lung Giao thc Giao din DTE - DCE Th tc

26

v kim sot li. Network Thc hin chn ng v trao i thng tin trong lin mng vi cng ngh chuyn mch thch hp. Vn chuyn thng tin gia cc my ch (End to End); Kim sot li v lung d liu. Qun l cc cuc lin lc gia cc thc th bng cch Sesion thit lp, duy tr, ng b ha v hy b cc phin truyn thng gia cc ng dng. Presentation Applycation Chuyn i c php d liu p ng nhu cu truyn thng ca cc ng dng. Giao tip ngi v mi trng mng.

kim sot Giao thc mng Giao thc vn chuyn Giao thc phin Giao thc bin i m ng dng

Transport

ng m gi tin trong m hnh OSI

Hnh 1.11. ng v m gi tin trong m hnh OSI M hnh TCP/IP TCP/IP (Transmission Control Protocol/Internet Protocol) l chng giao thc cng hot ng nhm cung cp cc phng tin truyn thng lin mng. Nm 1981, TCP/IP phin bn 4 (IPv4) c hon thnh v s dng ph bin trn my tnh s dng h iu hnh UNIX, tr thnh mt trong nhng giao thc c bn ca h iu hnh Windows 9x. Nm 1994, mt phin bn mi IPv6 c hnh thnh trn c s ci tin nhng hn ch ca IPv4.

27

M hnh TCP/IP Process Application Layer Host To Host Internet Layer Network Access Layer

M hnh OSI ng dng Application Presentation Session Transport Network Data link Physical

ng dng

Trnh by Phin Vn chuyn Mng Lin kt d liu Vt l

Vn chuyn Mng Truy nhp mng

Hnh 1.12. Tng quan m hnh OSI v m hnh TCP/IP Vai tr v chc nng cc tng trong m hnh TCP/IP Tng ng dng (Process/Application Layer): ng vi cc tng Session, Presentation v Aplication trong m hnh OSI. Tng mg dng h tr cc ng dng cho cc giao thc tng Host to Host. Cung cp giao din cho ngi s dng m hnh TCP/IP. Cc giao thc ng dng gm TELNET(truy nhp t xa), FTP (truyn File), SMTP (th in t),... Tng vn chuyn Host to Host: ng vi tng vn chuyn (Transport Layer) trong m hnh OSI, tng Host to Host thc hin nhng kt ni gia hai my ch trn mng bng 2 giao thc: giao thc iu khin trao i d liu TCP (Transmission Control Protocol) v giao thc d liu ngi s dng UDP (User Datagram Protocol).Giao thc TCP l giao thc kt ni hng lin kt (Connection - Oriented) chu trch nhim m bo tnh chnh xc v tin cy cao trong vic trao i d liu gia cc thnh phn ca mng, tnh ng thi v kt ni song cng (Full Duplex). Khi nim tin cy cao ngha l TCP kim sot li bng cch truyn li cc gi tin b li. Giao thc TCP cng h tr nhng kt ni ng thi. Nhiu kt ni TCP c th c thit lp ti mt my ch v d liu c th c truyn i mt cch ng thi v c lp vi nhau trn cc kt ni khc nhau. TCP cung cp kt ni song cng (Full Duplex), d liu c th c trao i trn mt kt ni n theo 2 chiu. Giao thc UDP c s dng cho nhng ng dng khng i hi tin cy cao. Tng mng (Internet Layer): ng vi tng mng (Network Layer) trong m hnh OSI, tng mng cung cp mt a ch logic cho giao din vt l mng. Giao thc thc hin ca tng mng trong m hnh DOD l giao thc IP kt ni khng lin kt (Connectionless), l ht nhn hot ng ca Internet. Cng vi cc giao thc nh tuyn

28

RIP, OSPF, BGP, tng tng mng IP cho php kt ni mt cch mm do v linh hot cc loi mng "vt l" khc nhau nh: Ethernet, Token Ring, X.25... Ngoi ra tng ny cn h tr cc nh x gia a ch vt l (MAC) do tng Network Access Layer cung cp vi a ch logic bng cc giao thc phn gii a ch ARP (Address Resolution Protocol) v phn gii a ch o RARP (Reverse Address Resolution Protocol). Cc vn c lin quan n chun on li v cc tnh hung bt thng lin quan n IP c giao thc ICMP (Internet Control Message Protocol) thng k v bo co. Tng trn s dng cc dch v do tng Lin mng cung cp. Tng tng truy nhp mng (Network Access Layer): Tng ng vi tng Vt l v Lin kt d liu trong m hnh OSI, tng truy nhp mng cung cp cc phng tin kt ni vt l cp, b chuyn i (Transceiver), Card mng, giao thc kt ni, giao thc truy nhp ng truyn nh CSMA/CD, Tolen Ring, Token Bus..). Cung cp cc dch v cho tng Internet phn on d liu thnh cc khung.

Hnh 1.13. M hnh OSI v m hnh kin trc ca TCP/IP 1.9. Mt s th d v mng

1.9.1. Mng Lan: Ethernet v Wireless LAN Ethernet Ethernet l cng ngh ca mng LAN cho php truyn tn hiu gia cc my tnh vi tc 10Mb/s n 10 Gigabit/s. Trong cc kiu Ethernet th kiu s dng cp xon i l hay thng dng nht. Hin nay c khong 85% mng LAN s dng cng ngh Ethernet. Nm 1980, Xerox, tp on Intel v tp on Digital Equipment a ra tiu chun Ethernet 10 Mbps (Tiu chun DIX).

29

IEEE (Institute of Electrical and Electronics Engineers, Inc- Vin cng ngh in v in t) a ra tiu chun v Ethernet u tin vo nm 1985 vi tn gi "IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD) Access Method and Physical Layer Specifications" Gn y, vi cc phng tin truyn dn v cng ngh mi, cng ngh Ethernet ngy cng pht trin v t c tc trao i s liu n 10 Gigabit trn giy. Thnh phn mng Ethernet bao gm: Data terminal Equipment (DTE): Cc thit b truyn v nhn d liu DTEs thng l PC, Workstation, File Server, Print Server ...; Data Communication Equipment (DCE): L cc thit b kt ni mng cho php nhn v chuyn khung trn mng. DCE c th l cc thit b c lp nh Repeter, Switch, Router hoc cc khi giao tip thng tin nh Card mng, Modem ; Interconnecting Media: Cp xon i, cp ng (mng/dy), cp quang.

Nhng c im c bn ca Ethernet Cu hnh truyn thng: Bus ng thng/ Star; Cu hnh khc Star bus; K thut truyn: Base band; Phng php truy nhp: CSMA/CD; Quy cch k thut: IEEE 802.3; Vn tc truyn 10Mbps, 100Mbps ... 10Gbps; Loi cp: Cp ng trc mnh, cp ng trc dy, cp xon i, cp quang .... Wireless LAN Mng LAN khng dy vit tt l WLAN (Wireless Local Area Network), l mt mng dng kt ni hai hay nhiu my tnh vi nhau m khng s dng dy dn. WLAN dng cng ngh tri ph, s dng sng v tuyn cho php truyn thng gia cc thit b trong mt vng no cn c gi l Basic Service Set. N gip cho ngi s dng c th di chuyn trong mt vng bao ph rng m vn kt ni c vi mng. 30

i vi nhng ngi s dng ti nh th WLAN ngy cng tr nn ph bin v s d dng ci t, v v cc chic laptop cng ngy cng c ph bin. Trong kinh doanh v kinh doanh cng cng nh cc ca hng cafe hay cc trung tm bun bn ln bt u cung cp dch v truy cp khng dy ti khch hng, thm ch mt s ni cung cp dch v min ph. Nhng d n mng khng dy ln ang c trin khai cc thnh ph ln. V d nh Google cung cp dch v min ph Mountain View, California, San Francisco. New York cng ang bt u chng trnh trin khai dch v truy cp Internet khng dy, ph sng ton b 5 khu vc ca thnh ph. Vo thng 7/1997, IEEE a ra chun cho WLAN. Chun ny c tn l IEEE 802.11, v vo thng 9/1999 IEEE thng qua chun 802.11b (tc cao). WLAN l mt h thng truyn d liu mm do, n c s dng trong nhng ng dng cn s di dng. S dng sng in t, WLAN gi v nhn d liu qua khng kh m khng cn bt c mt ng truyn vt l no. Cng ngh WLAN hin nay c th t ti tc 11Mbps. Mt cch tng th c th ni rng WLAN s l mt cng ngh truyn thng y ha hn trong tng lai. S pht trin ca my tnh c nhn vo nhng nm 80 dn ti s pht minh ra mng ni b (LAN) t nn mng cho php truyn thng v tuyn chng hn nh truyn thng gia cc t trong ton thnh ph. Ging nh my tnh c nhn vo nhng nm 80 v Internet vo nhng nm 90, mng LAN khng dy (WLAN) ang cung cp mt s pht trin ca cng ngh th h tip theo. WLAN d dng kt ni nhanh v hiu qu vi mng LAN c dy hay chun LAN. Ch cn n gin thit lp mt im truy cp (access point) trong mng LAN c dy, cc my tnh c nhn v nhng chic laptop c trang b cc card mng khng dy do c th kt ni vi mng LAN c dy vi tc cao v c th cch 300 yards so vi access point. Vi nm tr li y, hu ht cc mng WLAN u c trin khai theo chun 802.11b hot ng tn s tri ph l 2.4 GHz. Chun 802.11b cho php tc kt ni ln ti 11Mbps nhanh nhn nhng e-mail dung lng ln v chy nhng ng dng cn bng thng ln nh hi tho truyn hnh. Trong khi chun 802.11b hin nay ang chim u th trn th trng mng LAN khng dy, th cc chun khc ca 802.11 nh l 802.11a hay 802.11g ang c pht trin tng tc kt ni. Cc nh cung cp dch v WLAN ang cung cp cc chun khc nhau.

31

1.9.2. Mng Wan: X.25, Frame Relay v ATM Mng X.25 c CCITT cng b ln u tin vo 1970 lc lnh vc vin thng ln u tin tham gia vo th gii truyn d liu vi cc c tnh: - X25 cung cp quy trnh kim sot lung gia cc u cui em li cht lng ng truyn cao cho d cht lng ng dy truyn khng cao. - X25 c thit k cho c truyn thng chuyn mch ln truyn thng kiu im ni im. - c quan tm v tham gia nhanh chng trn ton cu. Trong X25 c chc nng dn knh (multiplexing) i vi lin kt logic (virtual circuits) ch lm nhim v kim sot li cho cc frame i qua. iu ny lm tng phc tp trong vic phi hp cc th tc gia hai tng k nhau, dn n thng lng b hn ch do tng ph x l mi gi tin tng ln. X25 kim tra li ti mi nt trc khi truyn tip, iu ny lm cho ng truyn ch cht lng rt cao gn nh phi li. Tuy nhin do vy khi lng tch ton ti mi nt kh ln, i vi nhng ng truyn ca nhng nm 1970 th iu l cn thit nhng hin nay khi k thut truyn dn t c nhng tin b rt cao th vic tr nn lng ph Mng Frame Relay Mi gi tin trong mng gi l Frame, do vy mng gi l Frame relay. c im khc bit gia mng Frame Relay v mng X25 mng Frame Relay l ch kim tra li ti hai trm gi v trm nhn cn trong qu trnh chuyn vn qua cc nt trung gian gi tin s khng c kim li na. Do vy thi gian x l trn mi nt nhanh hn, tuy nhin khi c li th gi tin phi c pht li t trm u. Vi an ton cao ca ng truyn hin nay th chi ph vic pht li ch chim mt t l nh nu so vi khi lng tnh ton c gim i ti cc nt nn mng Frame Relay tit kim c ti nguyn ca mng hn so vi mng X25. Frame relay khng ch l mt k thut m cn l th hin mt phng php t chc mi. Vi nguyn l l truyn mch gi nhng cc thao tc kim sot gia cc u cui gim ng k K thut Frame Relay cho php thng lung ti a t ti 2Mbps v hin nay n ang cung cp cc gii php tng ni cc mng cc b LAN trong mt kin trc xng sng to nn mi trng cho ng dng multimedia. Mng ATM (Cell relay)

32

Hin nay k thut Cell Relay da trn phng thc truyn thng khng ng b (ATM) c th cho php thng lng hng trm Mbps. n v d liu dng trong ATM c gi l t bo (cell). cc t bo trong ATM c di c nh l 53 bytes, trong 5 bytes dnh cho phn cha thng tin iu khin (cell header) v 48 bytes cha d liu ca tng trn. Trong k thut ATM, cc t bo cha cc kiu d liu khc nhau c ghp knh ti mt ng dn chung c gi l ng dn o (virtual path). Trong ng dn o c th gm nhiu knh o (virtual chanell) khc nhau, mi knh o c s dng bi mt ng dung no ti mt thi im. ATM kt hp nhng c tnh tt nht ca dng chuyn mch lin tc v dng chuyn mch gi, n c th kt hp di thng linh hot v kh nng chuyn tip cao tc v c kh nng qun l ng thi d liu s, ting ni, hnh nh v multimedia tng tc. Mc tiu ca k thut ATM l nhm cung cp mt mng dn knh, v chuyn mch tc cao, tr nh dp ng cho cc dng truyn thng a phng tin (multimecdia) Chuyn mch cell cn thit cho vic cung cp cc kt ni i hi bng thng cao, tnh trng tt nghn thp, h tr cho lp dch v tch hp lu thng d liu m thanh hnh nh. c tnh tc cao l c tnh ni bt nht ca ATM. ATM s dng c cu chuyn mch c bit: ma trn nh phn cc thnh t chuyn mch (a matrix of binary switching elements) vn hnh lu thng. Kh nng v hng (scalability) l mt c tnh ca c cu chuyn mch ATM. c tnh ny tng phn trc tip vi nhng g din ra khi cc trm cui c thm vo mt thit b lin mng nh router. Cc router c nng sut tng c nh c chia cho cc trm cui c kt ni vi chng. Khi s lng trm cui gia tng, nng sut ca router tng thch cho trm cui thu nh li. Khi c cu ATM m rng, mi thit b thu trm cui, bng con ng ca chnh n i qua b chuyn mch bng cch cho mi trm cui bng thng ch nh. Bng thng rng c ch nh ca ATM vi c tnh c th xc nhn khin n tr thnh mt k thut tuyt ho dng cho bt k ni no trong mng cc b ca doanh nghip. Nh tn gi ca n ch r, k thut ATM s dng phng php truyn khng ng b (asynchronouns) cc t bo t ngun ti ch ca chng. Trong khi , tng vt l ngi ta c th s dng cc k thut truyn thng ng b nh SDH (hoc SONET). 33

Nhn thc c v tr cha th thay th c (t nht cho n nhng nm u ca th k 21) ca k thut ATM, hu ht cc hng khng l v my tnh v truyn thng nh IBM, ATT, Digital, Hewlett - Packard, Cisco Systems, Cabletron, Bay Network,... u ang quan tm c bit n dng sn phm hng n ATM ca mnh tung ra th trng. C th k ra y mt s sn phm nh DEC 900 Multiwitch, IBM 8250 hub, Cisco 7000 rounter, Cablectron, ATM module for MMAC hub. Nhn chung th trng ATM si ng do nhu cu thc s ca cc ng dng a phng tin. S nhp cuc ngy mt ng ca cc hng sn xut lm gim ng k gi bn ca cc sn phm loi ny, t cng m rng thm th trng. Ngay Vit Nam, cc d n ln v mng tin hc u c thit k vi h tng chp nhn c vi cng ngh ATM trong tng lai. 1.9.3. Mng Internet Cng vi s pht trin ca NFSNET v ARPANET nht l khi giao thc TCP/IP tr thnh giao thc chnh thc duy nht trn cc mng trn th s lng cc mng, nt mun tham gia kt ni vo hai mng trn tng ln rt nhanh. Rt nhiu cc mng vng c kt ni vi nhau v cn lin kt vi cc mng Canada, chu u. Vo khong gia nhng nm 1980 ngi ta bt u thy c s hnh thnh ca mt h thng lin mng ln m sau ny c gi l Internet. S pht trin ca Internet c tnh theo cp s nhn, nu nh nm 1990 c khong 200.000 my tnh vi 3.000 mng con th nm 1992 c khong 1.000.000 my tnh c kt ni, n nm 1995 c hng trm mng cp vng, chc ngn mng con v nhiu triu my tnh. Rt nhiu mng ln ang hot ng cng c kt ni vo Internet nh cc mng SPAN, NASA network, HEPNET, BITNET, IBM network, EARN. Vic lin kt cc mng c thc hin thng qua rt nhiu ng ni c tc rt cao. Hin nay mt my tnh c gi l thnh vin ca Internet nu my tnh c giao thc truyn d liu TCP/IP, c mt a ch IP trn mng v n c th gi cc gi tin IP n tt c cc my tnh khc trn mng Internet. Tuy nhin trong nhiu trng hp thng qua mt nh cung cp dch v Internet ngi s dng kt ni my ca mnh vi my ch ca nh phc v v c cung cp mt a ch tm thi trc khi khai thc cc ti nguyn ca Internet. My tnh ca ngi c th gi cc gi tin cho cc my khc bng a ch tm thi v a ch s tr li cho nh cung cp khi kt thc lin lc. V my tnh ca ngi s dng

34

trong thi gian lin kt vi Internet cng c mt a ch IP nn ngi ta vn coi my tnh l thnh vin ca Internet. Vo nm 1992 cng ng Internet ra i nhm thc y s pht trin ca Internet v iu hnh n. Hin nay Internet c 5 dch v chnh: Th in t (Email): y l dch v c t khi mng ARPANET mi c thit lp, n cho php gi v nhn th in t cho mi thnh vin khc trong mng. Thng tin mi (News): Cc vn thi s c chuyn thnh cc din n cho php mi ngi quan tm c th trao i cc thng tin cho nhau, hin nay hin nay c hng nghn di n v mi mt trn Internet. ng nhp t xa (Remote Login): Bng cc chng trnh nh Telnet, Rlogin ngi s dng c th t mt trm ca Internet ng nhp (logon) vo mt trm khc nu nh ngi c ng k trn my tnh kia. Chuyn file (File transfer): Bng chng trnh FTP ngi s dng c th chp cc file t mt my tnh trn mng Internet ti mt my tnh khc. Ngi ta c th chp nhiu phn mm, c s d liu, bi bo bng cch trn. Dch v WWW (World Wide Web): WWW l mt dch v c bit cung cp thng tin t xa trn mng Internet. Cc tp tin siu vn bn c lu tr trn my ch s cung cp cc thng tin v dn ng trn mng cho php ngi s dng d dng Truy cp cc tp tin vn bn, ha, m thanh. Ngi s dng nhn c thng tin di dng cc trang vn bn, mt trang l mt n th nm trong my chu. y l dch v ang mang li sc thu ht to ln cho mng Internet, chng ta c th xy dng cc trang Web bng ngn ng HTML (Hypertext Markup Language) vi nhiu dng phong ph nh vn bn, hnh v, video, ting ni v c th c cc kt ni vi cc trang Web khc. Khi cc trang c t trn cc my ch Web th thng qua Internet ngi ta c th xem c s th hin ca cc trang Web trn v c th xem cc trang web khc m n ch n. Cc phn mm thng dng c s dng hin nay xy dng v duyt cc trang Web l Mosaic, Navigator ca Netscape, Internet Explorer ca Microsoft, Web Access ca Novell

35

CHNG II. MNG LAN V CC VN LIN QUAN N LP 1 V 2 2.1. Gii thiu

2.1.1. V tr cc chc nng ca mng LAN trong m hnh OSI Lp lin kt d liu: Tng lin kt d liu c chia thnh hai tng con l LLC (Logical Link Control) v MAC (Media Access Control). Tng con MAC m nhn iu khin vic truy nhp ng truyn trong khi tng con LLC m bo tnh c lp ca vic qun l cc lin kt d liu i vi ng truyn vt l v phng php truy nhp (MAC) c s dng. Lp vt l: Xc nh tc truyn, phng php m ho v phng tin truyn dn v cch thc kt ni vt l. Tng vt l ca IEEE 802.3 c phn chia l 2 phn: - Phn c lp vi ng truyn c t giao din gia tng MAC v tng vt l. - Phn ph thuc ng truyn v c t giao din vi ng truyn ca LAN v cc tn hiu trao i vi ng truyn. C nhiu tu chn khc nhau v kiu ng truyn, phng thc truyn tn hiu v tc truyn, cch thc m ho. 2.1.2. Vn chung ca mng LAN - Vn c bn: lm sao chia s mi trng trong mng LAN - Cc phng php chia s mi trng trong LAN

Hnh 2.1. Phng php chia s mi trng trong LAN

36

2.2.

Phn loi cc giao thc iu khin truy nhp ng truyn Giao thc dng nh gi kh nng ca mt mng c phn chia bi cc

trm nh th no. H s ny c quyt nh ch yu bi hiu qu s dng mi trng truy xut (medium access) ca giao thc Mi knh phng tin ch c th h tr mt ln tn hiu. Nu hai my tnh truyn trn knh cng mt lc, cc tn hiu ca chng s gy nhiu cho nhau. C hai phng php iu khin vic truy nhp phng tin khng xy ra s c gy nhiu: truy nhp ngu nhin v truy nhp c iu khin. 2.2.1. Loi truy nhp ngu nhin Trm c th truy nhp phng tin truyn vt l ty theo mun, bt k thi im ngu nhin no. a. K thut truy cp ngu nhin i vi dng bus - Phng php a truy nhp s dng sng mang (CSMA Carrier Sense Multiple Access). - Phng php a truy nhp s dng sng mang vi pht hin xung t (CSMA/CD with Collision Detection) b. K thut truy cp ngu nhin i vi dng vng - Phng php chn thanh ghi (Register insertion) - Phng php vng c ngn (Sloted ring) 2.2.2. Loi truy nhp c iu khin Phng php iu khin tranh chp thng thch hp vi cc mng c s trao i d liu khng lin tc v tng i t my tnh. y l dng thng dng trong cu trc mng cc b. - K thut bus vi th bi (Token Bus): dng cho cc mng LAN - K thut vng vi th bi (Token Ring): dng cho cc mng LAN - K thut trnh xung t: dng cho cc mng cc b tc cao. 2.3. Cc phng php truy nhp ng truyn vt l

2.3.1. Phng php CSMA Cn c gi l phng php LBT (Listen Before Talk Nghe trc khi ni). Mt trm c d liu cn truyn trc ht phi nghe xem phng tin truyn ri hay 37

bn. Nu ri th bt u truyn tin, cn nu bn th thc hin mt trong ba gii thut sau: - Gii thut non persisten: Trm rt lui (khng kin tr) ch i mt thi gian ngu nhin no ri li bt u nghe ng truyn. Gii thut ny c hiu qu trnh xung t nhng c thi gian cht. - Gii thut 1 persistent: Trm tip tc nghe n khi phng tin truyn ri th tin hnh truyn d liu i (vi xc sut 1). Gii thut ny gim thi gian cht, xong nu c nhiu trm cng ch v tin hnh pht d liu cng mt ln th s xy ra xung t. - Gii thut p persistent: Trm tip tc nghe, n khi phng tin truyn ri th tin hnh pht tin vi mt xc sut nht nh no (mi trm c gn mt h s u tin) ngc li trm rt lui trong mt thi gian c nh ri truyn vi xc sut p hoc tip tc ch i vi xc sut 1 p. Gii thut ny phc tp nhng gim c ti a xung t v thi gian cht. Phng php CSMA ch nghe trc khi ni, khng c kh nng pht hin xung t trong qu trnh truyn, dn n lng ph ng truyn. 2.3.2. Phng php CSMA/CD Phng php CSMA/CD c ngun gc t h thng radio pht trin trng i hc Hawai vo khong nm 1970, gi l ALOHANET, cn c gi l LWT (Listen While Talk Nghe c trong khi ni). Cc va chm lun xy ra ti mt cp no trn cc mng, vi s lng gia tng theo mt t l thun khi cc phin truyn gia tng. Phng php CSMA/CD ngoi cc chc nng CSMA cn b sung cc quy tc sau: - Khi ang truyn vn tip tc nghe ng dy. - Nu pht hin c xung t th ngng truyn v tip tc gi sng mang thm mt thi gian na bo m cc trm u c th nghe c s kin xung t. - Sau khi ch i mt thi gian ngu nhin th trm th truyn li bng cch s dng cc phng php ca CSMA. Vi phng php CSMA/CD thi gian chim dng v ch ng truyn gim xung bng thi gian dng pht hin mt ng . CSMA/CD s dng ba gii thut presistent trn. Trong gii thut 1 presistent c s dng

38

trong mng Ethernet, Mitrenet v c chn c trong chun IEEE.802. Ngoi ra mi chun LAN cn c thm cc c ch b sung. 2.3.3. iu khin truy nhp bus vi th bi Cc trm trn bus to nn mt vng logic, c xc nh v tr theo mt dy th t, trong trm cui s tip lin ngay sau trm u tin. Mi trm c bit a ch ca cc trm k sau v k trc n. Th bi dng cp pht quyn truy nhp, c lu chuyn trong vng logic. Khi trm nhn c th bi th c trao quyn s dng phng tin trong mt thi gian xc nh truyn d liu. Khi truyn xong hoc ht thi hn, trm s chuyn th bi ti trm k tip trong vong logic. Cc trm khng s dng th bi vn c mt trn bus nhng chng ch c th tr li cho yu cu xc nhn (nu chng l ch ca gi tin no ). Th t vt l ca trm trn bus l khng quan trng, c lp vi th t logic A B C D

Bus H G F E

ng truyn vt l Vng logic Hnh 2.2. V d vng logic trong mng bus Trong v d trn, cc trm A v E nm ngoi vng logic, ch c th tip nhn d liu dnh cho chng. Vic thit lp vng logic trong chng trnh l khng kh, nhng vic duy tr n theo trng thi thc t ca mng mi l kh. C th phi thc hin c cc chc nng sau: - Khi to vng logic: khi thit lp mng hoc khi vng logic b gy. - B sung trm vo vng logic (xem xt nh k) bng cch mi nt ng sau nhp vng. Loi b mt trm ra khi vng logic bng cch ni trm trc v sau n vi nhau.

39

- Qun l li: trng a ch, t vng (cc trm b treo, ri vo trng thi ch ln nhau), bi nt gi Token - Khi ang gi th m c trm khc nhn c gi tin th chng t nt khc c th, lc n s b th bng cch chuyn sang trng thi nghe. - Khi nt hon thnh cng vic, n gi th n nt ng sau, nu nt tip sau hot ng th n gi th chuyn sang trng thi b ng. Nu ngc li, n gi th ch nt k tip ln na. Nu hai ln gi khng c th xem nh nt k tip hng v gi i gi tin tm nt k tip tm nt tip theo. - Nu khng thnh cng th nt b xem l c s c. Nt ngng hot ng v nghe trn bus Dng bn tin ca mng Token bus Bt u iu khin tin 1 byte gi tin 1 byte a ch ngun a ch ch TIN FSC 4 bytes Kt thc tin 1 byte

2 6 bytes 2 6 bytes

Khung tin cc i 8191 bytes So snh Token Bus vi CSMA/CD

Tc c th l 1; 5; 10Mbps

- Token bus qun l phc tp hn so vi CSMA/CD. Trong trng hp ti nh th khng hiu qu bng CSMA/CD (do phi qua nhiu trm) - Tuy nhin Token Bus c hiu qu trong trng hp ti nng, d iu ha lu thng trn mng Token Bus. Khng quy nh di ti thiu ca gi tin, khng cn nghe trc khi ni. 2.3.4. iu khin truy nhp vng vi th bi y l giao thc thng dng c dng trong cc LAN c cu trc vng (Ring). Phng php ny s dng mt khi tn hiu c bit gi l Token di chuyn vng quanh mng theo mt chiu xc nh. Mt trm mun truyn phi i cho n khi nhn c th bi. Khi mt trm ang chim Token th n c th pht i mt gi d liu. Khi pht ht gi d liu cho php hoc khng cn g pht na th trm chuyn khung th bi n cho trm k tip trn mng. Trong Token c cha mt a ch ch v c lun chuyn ti cc trm theo mt trt t nh trc. i vi cu hnh mng dng xoay vng th trt t ca s truyn Token tng ng vi trt t vt l ca cc trm xung quanh vng. 40

Cc chun mng s dng phng php iu khin truy nhp th bi: - Chun IEEE 802.5, cn gi l chun Token Ring. - FDDI l chun si quang 100 Mps s dng phng php chuyn th bi v vng trn. Phng php chuyn th bi thch hp trong cc iu kin nh sau: - Khi mng ang ti d liu quan trng v thi gian do phng php ny cung cp kh nng bn giao. Khi mng c s dng nhiu, do trnh c xung t. chuyn th bi c th p dng cc mc u tin cho trm ngn cm mt trm bt k khng c c quyn v mng. - Do th bi lun chuyn quanh mng nn mi trm c th truyn theo qung thi gian ti thiu. Phng php chuyn th bi i hi c ch iu khin phc tp v chi ph u t phn cng cao. Nhng c thit k vi tin cy cao. Tuy vy hin nay Ethernet vn l chun LAN thng dng, chng t c u im ca phng php tranh chp khi s dng trn cc mng LAN. Giao thc truyn token c trt t hn nhng cng phc tp hn CSMA/CD, c u im l vn hot ng tt khi lu lng truyn thng ln. Giao thc truyn token tun th ng s phn chia ca mi trng mng, hot ng da vo s xoay vng ti cc trm. Vic truyn token s khng thc hin c nu vic xoay vng b t on. Giao thc phi cha cc th tc kim tra token cho php khi phc li token b mt hoc thay th trng thi ca token v cung cp cc phng tin sa i logic (thm vo, bt i hoc nh li trt t ca cc trm. Khung tin cc i l 16KB ch truyn 16Mbps v 4KB ch truyn 4Mbps. Dng bn tin vi mng Token Ring: Bt u tin iu khin thm nhp iu khin gi tin 26 bytes Trng thi gi tin 1 byte

- Khi mt vi trm c mc u tin cao hn so vi cc trm khc. Phng php

a ch ngun

a ch ch

TIN

FSC

Kt thc tin

1 byte 1 byte

26 bytes

26 bytes

4 bytes

1 byte

41

Phng php iu khin truy nhp d bo: D bo (polling) l mt phng php iu khin truy nhp s dng mt thit b trung tm iu khin ton b vic truy nhp mng. y l phng php c s dng ph dng nht trn cc mng my tnh ln. Thit b trung tm c tn l thit b chnh s yu cu d liu t cc thit b khc trn mng c tn l thit b th cp (secondaries). Sau khi c d bo, thit b th cp c th truyn mt lng d liu c xc nh bi cc giao thc dng trn mng. Mt thit b th cp khng th truyn tr khi n c thit b chnh d bo. Phng php d bo c nhiu u im ca phng php chuyn th bi nh: - D on c cc ln truy nhp nh sn. - Gn c cc mc u tin, trnh c va chm. So snh phng php d bo v phng php chuyn th bi: k thut d bo tp trung ha quyn iu khin. Nhn di gc qun l th y l mt u im, nhng nu c ch iu khin tp trung b hng, mng s ngng hot ng. Phng php chuyn th bi s dng cc chc nng iu khin phn phi hn do t b hng tp trung ti mt im. Bn cnh , phng php d bo i khi lng ph cc lng bng thng ln do phi d bo tng thit b th cp, cho d cc thit b khng c g truyn. 2.3.5. Mng LAN khng dy v chun IEEE 802.11 a. Wireless LAN (WLAN) Lch s pht trin ca WLAN

Nm 1971, nhng nh nghin cu ti i hc Hawaii pht trin h thng WLAN u tin c tn l ALOHAnet (mng ALOHA). Mng hnh sao 2 hng ca h thng bao gm 7 my tnh c dn tri trn 4 o giao tip vi my tnh trung tm t trn o Oahu m khng s dng ng dy in thoi. Phn cng ca WLAN nguyn thy t n ni n ch c s dng thay th cho mng LAN c dy khi mng trin khai mng LAN c dy l kh khn v khng th thc hin c. S pht trin u tin bao gm nhng gii php c th trong cng nghip v nhng giao thc c quyn, nhng n cui nhng nm 90 chng c thay th bi nhng chun, ch yu l nhng phin bn khc nhau ca IEEE 802.11 (Wi-Fi). Trong khi vic ni mng Ethernet hu tuyn din ra t 30 nm tr li y th ni mng khng dy vn cn l tng i mi i vi th trng gia nh. Trn thc t, 42

chun khng dy c s dng rng ri u tin, 802.11b, c Vin k thut in v in t M (Institue of Electric and Electronic Engineers) IEEE ph chun ch 8 nm trc y (nm 1999). Vo thi im , phn cng ni mng khng dy cn rt t v ch nhng cng ty giu c v c nhu cu bc thit mi c kh nng ni mng khng dy. Mt im truy nhp (hay trm c s - Access Point), hot ng nh mt cu ni gia mng hu tuyn v mng khng dy, c gi khong 1000 la M vo thi im nm 1999, trong khi cc card khng dy my khch ginh cho cc my tnh s tay c gi khong 300 la. Vy m by gi bn ch phi tr 55 la cho mt im truy nhp c s v 30 la cho mt card my khch 802.11b v l l do ti sao m vic ni mng khng dy li ang c mi ngi a chung n vy. Rt nhiu my tnh s tay-thm ch c nhng my thuc loi cu hnh thp-by gi cng c sn card mng khng dy c tch hp, v vy bn khng cn phi mua mt card my khch na. Mng khng dy l c mt qu trnh pht trin di, ging nh nhiu cng ngh khc, cng ngh mng khng dy l do pha qun i trin khai u tin. Qun i cn mt phng tin n gin v d dng, v phng php bo mt ca s trao i d liu trong hon cnh chin tranh. Khi gi ca cng ngh khng dy b t chi v cht lng tng, n tr thnh ngun kinh doanh sinh li cho nhiu cng ty trong vic pht trin cc on mng khng dy trong ton h thng mng. Cng ngh khng dy m ra mt hng i tng i r trong vic kt ni gia cc trng i hc vi nhau thng qua mng khng dy ch khng cn i dy nh trc y. Ngy nay, gi ca cng ngh khng dy r hn rt nhiu, c kh nng thc thi on mng khng dy trong ton mng, nu chuyn hon ton qua s dng mng khng dy, s trnh c s lan man v s tit kim thi gian v tin bc ca cng ty. Trong gia nh c thu nhp thp, mng khng dy vn cn l mt cng ngh mi m. By gi nhiu ngi to cho mnh nhng mng khng dy mang li thun li trong cng vic, trong vn phng hoc gii tr ti nh. Khi cng ngh mng khng dy c ci thin, gi ca s sn xut phn cng cng theo h thp gi thnh v s lng ci t mng khng dy s tip tc tng. Nhng chun ring ca mng khng dy s tng v kh nng thao tc gia cc phn v tng thch cng s ci thin ng k. Khi c nhiu ngi s dng mng khng dy, s khng tng thch s lm cho mng khng dy tr nn v dng, v s thiu thao tc gia cc phn s gy cn tr trong vic ni kt gia mng cng ty vi cc mng khc.

43

Nm 1997, the Institute of Electrical and Electronic Engineers (IEEE) phc tho chun 802.11 cho WLANs (Wireless Local Area Networking). WLAN l mng cc b khng dy cho php kt ni khng dy ethernet hot ng theo chun 802.11 ca IEEE (Hip hi in v in t Hoa K). Nm 1999, chun 802.11b c phc tho v c cng nhn bi mng li cng nghip, v nhng sn phm t mng khng dy trn khp tn s 2.4GHz bt u tn ti. WLAN hot ng trong ph tn s m y ban truyn thng ca M (FCC) cho php t do s dng khng phi ng k. Bt k ai cng c th vn hnh nhiu loi thit b khc nhau trong nhng bng tn ny m khng cn phi tn km xin cp bn quyn. u im ca WLAN

- S thun tin: Tnh cht khng dy ca mng cho php ngi s dng c th truy cp ti nguyn t bt c v tr no trong mi trng mng ( nh hoc vn phng). Vi s tng n mc bo ha ca cc my tnh kiu laptop (di ng), th s thun tin trn cng tr nn d thc hin. - S di ng: Vi s ni ln ca cc mng khng dy cng cng, ngi s dng c th truy cp Internet ngay bn ngoi ni lm vic ca h. Hu ht ti cc qun cafe, khch hng c th truy cp Internet vi gi rt thp hoc min ph. Kt ni Internet bng WLAN l rt hp l cho bt c cng ty no m khng th trin khai c mng LAN c dy v d nh b gii hn bi khng gian ca mt ta nh, hoc nhng ni cho thu hoc nhng ni tm thi. Cng ngh WLAN cho php mng c th ti bt c ni u m dy dn khng th ti c. Nhng ngi s dng cc thit b di ng c th d dng di chuyn trong ton b khng gian mng ph sng m vn kt ni c vi mng WLAN. - Nng sut: Ngi s dng kt ni vi mng khng dy c th duy tr mt mi quan h gn nh khng thay i vi mng khi h di chuyn t ch ny sang ch khc. i vi kinh doanh, mt nhn vin c th tng nng sut ca cng vic v h c th hon thnh cng vic ca h bt c v tr thun tin no. - S trin khai: Ci t ban u ca mt mng khng dy c bn yu cu thp hn so vi mt im truy cp n (access point). Ni cch khc, mng c dy cn thm chi ph v

44

phc tp hn khi hot ng nhiu v tr (v d trong 1 ta nh, thm ch khng th trin khai mng c dy y). WLAN r rng tt hn so vi mng LAN c dy truyn thng trong thi gian thit lp. Thi gian cn thit thit lp mng WLAN l rt ngn. Tc ca cc mng hin i l kh cao (c th ln ti 54 Mbps) bng cch s dng vng ph rng. - Kh nng m rng: Mng khng dy c th phc v vi s lng tng ln bt ng ca cc my trm (clients). Cn i vi mng c dy th khi mun thm cc clients th yu cu phi thm dy. Vi s gip ca cc thit b khng dy, mng WLAN c th kt ni d dng vi cc mng c dy truyn thng. - Chi ph: Trong khi vn u t ban u cho phn cng ca mng WLAN l cao hn so vi mng LAN truyn thng tuy nhin chi ph ci t tng th v chi ph ton b chu trnh c th thp hn mt cch ng k. Li ch kinh t trong mt thi gian di l rt ln trong nhng mi trng ng yu cu thay i v di chuyn thng xuyn. Hu ht cc thit b WLAN l cc thit b plug-and-play (cm v chi), do gip gim chi ph cho vic ci t, duy tr thit b v loi b cc thit b tha trong trng hp h thng b ph hy. Nhc im ca WLAN

- An ninh mng: S nguy him i vi ngi s dng cng ngh khng dy ngy cng tng nhanh v cng ngh ny cng tr nn ph bin. Ngy nay c mt s lng ln nhng mi nguy him v bo mt trong cng ngh khng dy. Nhng mi nguy him ang ngy cng tng nhanh. Nhng crackers bit rng h thng s b tn thng rt ln nu b tn cng vo cc giao thc khng dy, cc phng php m ha hay s bt cn v thiu kinh nghim ca ngi s dng. Cc phng php crack cng ngy cng tinh vi v sng to hn. Vic crack cng ngy cng n gin v d thc hin bng cc cng c trn nn Windows v Linux, trn cc trang web m t c chm sc. - Phm vi ph sng: Phm vi ph sng in hnh ca mng 802.11g vi cc thit b chun l vi chc mt. Gii hn trn ch trong phm vi mt ngi nh nhng li khng trong mt khng gian ln hn. c phm vi ph sng rng hn ta cn phi 45

mua cc b lp hoc cc im truy cp (access point). Chi ph cho cc thit b ny c th tng ln rt nhanh. Cc cng ngh khc ang trong giai on pht trin, tuy nhin vi thuc tnh tng phm vi ph sng hy vng s khc phc nhc im ny mt cch thch ng. - tin cy: Ging nh truyn ti sng radio, tn hiu mng khng dy b nh hng bi nhiu rt ln v cc hiu ng truyn dn v tuyn (nh hin tng phn tp a ng, c bit l hin tng fading) khi xa trung tm iu khin ca qun tr mng. Trong cc mng in hnh, ngi ta thng dng phng php iu ch kha dch pha (PSK) hoc QAM lm gim nhiu v cc hin tng thu pht v tuyn. Do vy m cc ti nguyn mng quan trng nh my phc v (server) rt him khi c kt ni khng dy. Cc thit b WLAN khng th gi v nhn d liu chnh xc trong trng hp c sng m dy c hoc bo bi. Cc thit b WLAN kh m gi v nhn d liu ng thi gian khi c mt vt th bay qua khu vc mng. Hu ht mi trng vn phng v nh u c xy dng bng vt liu tng i trong sut vi sng radio tn s 2.4 GHz v th phm vi s khng b gii hn, tuy nhin chng li c bao bc bi nhng mi trng phn x v khc x nn s b gii hn c bn gy ra bi hin tng phn tp a ng. Thiu s tng thch gia cc sn phm WLAN ca cc nh sn xut khc nhau. Sn phm WLAN ca cc nh sn xut khc nhau thng l khng tng thch vi nhau. Chun Ethernet 802.11 c in b b qua trong qu trnh pht trin nhng sn phm WLAN ngy nay. - Tc : Tc ca hu ht cc mng khng dy (in hnh l t 1 54 Mbps) l rt chm so vi tc chm nht ca mng c dy (t 100Mbps ti vi Gbps). Tuy nhin ngi s dng hu nh vn cha khai thc ht tc ny, tc ny thng vn ln hn nhiu so vi tc truyn Internet. V d, tc ti a ca ng truyn ADSL l 8Mbps c a ra bi cc cng ty vin thng ti khch hng th vn chm hn nhiu so vi tc chm nht ca mng LAN khng dy. Ta hon ton c th s dng mng LAN khng dy truy cp Internet tc cao. Tuy nhin trong mt s trng hp c bit, s dng ng truyn c dy vn l cn thit.

46

Do gii hn v bng thng, cng ngh WLAN khng th h tr hi ngh truyn hnh Video Teleconference (VTC). Tuy nhin, nhng nh chuyn mn cho rng WLAN s h tr Video Teleconference (VTC) trong nhng nm ti. Yu im ca WLAN l nhy cm vi nhiu dng ca cc giao tip ngoi v chi ph ca cc trm truyn dn. Thm vo , M, nhng nh chc trch quc t v nhng hip c qui nh mt cch nghim khc hu ht bng thng c th h tr truyn tc cao. S dng nhng bng thng ny i hi phi c bn quyn rt t tin. b. Chun IEEE 802.11 Cu trc giao thc - PHY

Cc chc nng ca lp PHY( Chc nng vt l ) - M ho v gii m tn hiu - Tip nhn v truyn ti bit - Bao gm ch dn k thut v a hnh v cch thc truyn ti

Hnh 2.3. Tng quan m hnh OSI v chun 802 Cu trc giao thc - MAC

47

Cc chc nng ca lp MAC: - Chi phi truy cp n mi trng truyn dn LAN - Khi truyn dn, MAC lp rp d liu vo mt khung vi cc trng a ch v sa li - C kh nng pht hin li v xo cc khung b li nh dng khung MAC: - iu khin MAC : bao gm thng tin v giao thc MAC - a ch MAC ch : im gn vt l ch - a ch MAC ngun : im gn vt l ngun - D liu :bao gm thng tin iu khin t lp LLC - CRC : kim tra m vng Dng thc chung ca khung MAC:

Hnh 2.4. Cu trc khung - MAC Cu trc giao thc-LLC

Chc nng lp iu khin kt ni logic(LLC): - Cung cp giao din ti lp cao hn - iu khin lung v li - Truyn li cc khung khng thnh cng 48

Cc c tnh ca LLC khng c trong cc giao thc iu khin khc : - Tip nhn mt vi chi tit ca truy nhp kt ni bi lp MAC - Phi h tr a truy nhp Khng ging cc giao thc lp kt ni lp khc , 802.11 kt hp cng ACKs: Tt c cc khung c pht phi l ACK Cc dch v LLC : - Dch v mt kt ni khng c tha nhn C ch iu khin li v khng dng Phn phi d liu khng m bo - Dch v mu kt ni Thit lp kt ni logic gia 2 ngi s dng iu khin li v dng c cung cp - Dch v khng kt ni c tha nhn H tr gia 1-2 Biu tha nhn Khng thit lp u tin logic Phn bit LLC v MAC

- Mc logic cn thit qun l truy cp ti mt mi trng chia s kt ni khng tn ti trong cc lp in hnh (iu khin kt ni d liu) - Vi cng LLC, c th cung cp vi la chn MAC Chun IEEE 802

Hnh 2.5: Chun IEEE 802 49

Cu trc IEEE 802.11 - H thng phn phi - im truy cp - Mi trng khng dy - Trm

Mng 802.11 bao gm 4 thit b vt l chnh sau :

Trm H thng phn phi im truy cp Mi trng khng dy

Hnh 2.6. Cu trc n gin ca mt h thng mng 802.11 1. H thng phn phi (DS) - Thit b logic ca 802.11 c dng ni cc khung ti ch ca chng - 802.11 khng xc nh bt k cng ngh nht nh no i vi DS - Hu ht trong cc ng dng qung co , Ethernet c dng nh l mi trng DS - Trong ngn ng ca 802.11, xng sng Ethernet l mi trng h thng phn phi. Tuy nhin , khng c ngha n hon ton l DS - tm phn cn li ca DS , cn tm c cc im truy cp (Aps ) + Hu ht cc APs qung co u hot ng nh cc cu ni + Chng c t nht mt giao din mng khng dy v t nht mt giao din mng Ethernet 2. im truy cp (APs) - Khung ca mng 802.11 phi c chuyn i thnh 1 dng khung dng cho phn phi - APs c chc nng cu ni gia khng dy thnh c dy

50

3. Mi trng khng dy - c s dng chuyn khung t cc trm vi nhau - Mt vi lp vt l khc nhau c xc nh dng h tr cho MAC 802.11 - Trn thc t , hai lp RF PHY v 1 lp IR PHY c dng xc nh 4. Trm - Tnh ton cc thit b vi cc giao din mng + Cc thit b di ng dng pin nh my tnh xch tay + Cc trm c th c coi nh l cc thit b tnh 5. Cc kiu mng - Cc khi c bn ca mng 802.11 c gi l BSS - Dng dch v c s + Vng dch v c bn - BSSs c tha hng 2 tnh nng : + IBSS : mng BSS c lp 2.4. Giao thc mc lin kt d liu Tng lin kt d liu cung cp cc phng tin truyn thng tin qua lin kt vt l m bo tin cy thng qua cc c ch ng b ha, kim sot li v kim sot lung d liu. Cc giao thc c xy dng cho tng lin kt d liu (DLP Data Link Protocol) c phn thnh hai loi: Giao thc d b (Asynchronous DLP): cho php mt k t d liu c truyn i bt k lc no m khng cn quan tm n cc tn hiu ng b trc . Giao thc ng b (Synchoronous DLP): chn cc k t iu khin hoc cc c gia cc d liu ca ngi s dng bo cho bn nhn. C hai nhm giao thc ng b: i. ii. ng b hng k t (character oriented) ng b hng bit (bit oriented)

Cc h thng truyn thng i hi hai mc ng b ha: - Mc vt l: gi ng b gia cc ng h ngi gi v ngi nhn

51

- Mc lin kt d liu: phn bit d liu ca ngi s dng vi cc c v cc vng thng tin iu khin khc Sau y ta xt hai loi giao thc ng b l giao thc truyn tin ng b nh phn BSC (Binary Synchronous Control) v giao thc iu khin lin kt d liu mc cao HDLC (Highlevel Data Link Control). 2.4.1. Giao thc BSC y l giao thc hng k t (COP Character Oriented Protocol) c xy dng da trn cc k t c bit ca mt b m chun no nh (ASCII hoc EBCDIC) hot ng theo phng thc hai chiu lun phin. c. Tp k t iu khin ENQ (05): Enquire ACK (06): Acknowledgement NAK (15): Negative ACK STX (02): Start of text ETX (03): End of text ETB (17): End of transmission block SOH (01): Start of heading EOT (04): End of transmission lin kt DLE (10): Data Link Escape tin khc SYN (16): Synchronous K t ng b bn tin duy tr ng b gia 2 bn thay i ngha ca cc k t k truyn Yu cu tr li t mt trm xa Thng bo tip nhn tt thng tin Thng bo tip nhn khng tt thng tin Kt thc phn Header v bt u phn d liu Kt thc phn d liu Kt thc on tin (khi d liu) Bt u phn header ca bn tin Kt thc qu trnh truyn tin v gii phng

d. Khun dng tng qut bn tin ca giao thc BSC Header SYN SYN SOH
Ni nhn Number Control Seq Bin nhn

TIN STX S k t (Rng 5-8 bit) ETX/ETB CRC

thng sut bn tin, c th dng thm cc byte m: SYN SYN DLE DLE DLE ETX/ETB CRC

Khi pht nu k t pht trng vi DLE th ta chn thm DLE. Khi thu, DLE chn thm s c kh b. 52

V d: A Yu cu ni B

SYN . ENQ
SYN . AKC

Tr li ni

Chuyn d liu

DLEETX .STX...DLE.
SYN . AKC

Tr li nhn

Yu cu ngt kt ni

SYN . EOT

2.4.2. Giao thc HDLC (High Data Link Control) Giao thc HDLC l giao thc hng bit (Bit Oriented Protocol BOP) c cc phn t ca giao thc (n v d liu, th tc) c xy dng t cc cu trc nh phn (xu bit) v khi nhn d liu s c tip nhn ln lt tng bit mt. y l giao thc c v tr quan trng nht, c ISO pht trin s dng trong c hai trng hp: im im v im a im, cho php truyn thng hai chiu ng thi. a. Khun dng tng qut bn tin ca giao thc HDLC
Hng truyn

Flag 01111110

HEADER Address 8 bits Control 8 bits

IINFORMATION S cc bit 128 1024 bytes

FCS (16 bit)

Flag 01111110

Trong : - Flag (01111110): l c dng nhn bit im bt u v kt thc bn tin. trnh s xut hin ca m c trong mt ni dung ca bn tin, ngi ta ci t c ch cng c cc chc nng sau: o Khi truyn tin c sau 5 bits 1 lin tip th t ng thm 1 bit 0 vo. o Khi nhn tin, nu pht hin c bit 0 sau 5 bits 1 lin tip th t ng loi b bt 0 i. - Address: vng cha a ch trm ch ca khung tin. - Information: vng ghi thng tin truyn i, c kch thc khng xc nh.

53

- FCS (Frame Check Sequence): vng ghi m kim sot li (checksum) cho ni dung khung tin, dng phng php CRC vi a thc sinh l: CRC CCITT = x16 + x12 + x5 + 1. - Control: vng nh danh cho cc loi khung tin khc nhau ca HDLC, c ba dng nh sau: o Dng I : Hiu lc truyn tin tc Information o Dng S: hiu lc iu hnh s ni Supervisor o Dng N: chc nng ph trch ca iu hnh ni Unnumbered. b. Phng thc trao i thng tin Giao thc HDLC c 3 phng thc trao i thng tin chnh, ng vi mi phng phc c cc giao thc khung tin tng ng l SNRM, SARM hoc SABM: - Phng thc tr li chun SNRM (Set Normal Response Mode): c s dng trong trng hp cu hnh khng cn bng, c mt trm iu khin chung (master), cc trm cn li (slave) ch c th truyn tin khi trm master cho php. - Phng thc tr li d b SARM (Set Asynchronous Response Mode): cng c s dng trong trng hp cu hnh khng cn bng nh trng hp trn, nhng cc trm slave c php truyn tin m khng cn s cho pho ca trm master. Phng thc ny c s dng trong trng hp im im vi lin kt 2 chiu, cho php trm slave gi ti cc gi tin (frame) khng ng b vi trm master. - Phng thc tr li d b cn bng SABM (Set Asynchronous Balanced Mode): s dng trong trng hp im im, lin kt hai chiu. Trong cc trm u c vai tr tng ng. c. Cc giao thc dn xut ca HDLC - LAP (Link Access Procedure): tng ng vi phng thc tr li d b (ARM). - LAP-B (Link Access Procedure Balanced): tng ng vi phng thc tr li d b cn bng (ABM), c dng hu ht trong cc mng truyn d liu cng cng X25.

54

- LAP-D (Link Access Procedure D channel): c xy dng t LAP-B v c dng nh giao thc lin kt d liu cho cc mng ISDN - SDLC (Synchronous Data Link Control) - ADCCP (Advanced Data Communication Control Procedure) d. So snh BOP v COP - BOP nhn ln lt tng bit mt, do mm do, d dng tng thch vi cc h khc nhau. - BOP c overhead (ph tri) ngn, s bt b sung v s tn hiu iu khin t do c tc cao. - Th tc iu khin trn bt nh phn m bo khng ph thuc m dng. Cch gii quyt ny mm do v cho php gii quyt v s yu cu khc. - Th tc HDLC c coi l chun quc t v s thng tr trong thi gian ti, n thch ng vi cc h thng phc tp. i vi cc thit b t phc tp c th dng HDLC n gin ha m bo s tng thch vi HDLC v s pht trin m rng ca h thng sau ny. 2.5. Bi tp

55

CHNG III. KT NI MNG LP 2 3.1. Kt ni mng lp 2

3.1.1. Khi nim a ch MAC Trong m hnh OSI (Open Systems Interconnection) hay m hnh tham chiu kt ni cc h thng m th a ch MAC (Media Access Control) nm lp 2 (lp lin kt d liu hay Data Link Layer). Ni mt cch n gin, a ch MAC l a ch vt l hay cn gi l s nhn dng (Identification number) ca thit b. Mi thit b (card mng, modem, router...) c nh sn xut ch nh v gn sn 1 a ch nht nh; thng c vit theo 2 dng: MM:MM:MM:SS:SS:SS hay: MM-MM-MM-SS-SS-SS

Hnh 3.1. a ch MAC 3.1.2. Mt s tnh cht ca a ch MAC - Thch hp trong mi trng qung b (broadcast domain) a ch MAC l mt s 48 bit (tng ng vi 2 48 = 281.474.976.710.656 a ch MAC) c biu din bng 12 s hexa (h s thp lc phn), trong 24 bits u (MM:MM:MM) l m s ca nh sn xut (NSX) (Linksys, 3COM...) v 24 bits sau (SS:SS:SS) l s seri ca tng card mng c NSX gn. Nh vy s khng xy ra 56

trng hp hai thit b trng nhau a ch vt l v s nhn dng ID ny c lu trong chip ROM trn mi thit b trong qu trnh sn xut, ngi dng khng th thay i c. - a ch n hng (unicast address) L a ch dng nhn dng tng Node mt (Node - im Nt l tp hp cc thit b chuyn mch nm trung tm nh Router chng hn), c th l mt gi s liu c gi ti mt a ch n hng s c chuyn ti Node mang a ch n hng - Unicast . - a ch a hng (multicast address) L a ch dng nhn dng mt "Tp hp Node" bao gm nhiu Node khc nhau hp thnh, c th l mt gi s liu c gi ti mt a ch" a hng" s c chuyn ti tt c cc Node trong Tp hp Node mang a ch Multicast . - a ch qung b (broadcast address) L mt a ch logic m tt c cc thit b kt ni vi mt a truy cp mng truyn thng c kch hot nhn d liu. Mt tin nhn gi n mt a ch qung b l thng c nhn bi tt c cc host thuc mng, thay v mt my ch c th. Cc gi tin c gi t mt my ngun n mt a ch ch broadcast. a ch ch c th l a ch tt c cc hosts (255.255.255.255) hoc l mt phn ca a ch subnet. Mt router hoc mt L3 switch s khng cho php chuyn cc d liu broadcast ny. Mt thit b L2 s cho php pht tn broadcast traffic ra tt c cc cng ca n. 3.1.3. Ti sao phi kt ni mng lp 2 Trong bt k mng no, vn then cht lun l cch thc ngi ta quyt nh ai c quyn truy cp knh truyn ti mt thi im. lm r vn hn, hy xem xt v d sau: C su ngi ang hp thng qua h thng in thoi, mi ngi u c ni kt c th nghe v ni vi nhng ngi khc. Khi mt ngi ngng ni m c hai ngi hoc nhiu hn cng pht biu tip s to ra tnh trng ln xn. Trong cc cuc hp dng gp mt trc tip, tnh trng ln xn ny c th c gii quyt bng cch a tay xin pht biu. Nhng trong h thng hi tho thng qua in thoi ny, khi m ng truyn rnh, vic quyt nh ai s ni tip c v kh lm hn. c nhiu giao thc dng gii quyt vn trn. V chng chnh l ni dung trnh

57

by ca phn ny. Ni mt cch khc, cc knh truyn dng qung b thnh thong cn c gi l cc knh a truy cp (multiaccess channels) hay l cc knh truy cp ngu nhin (random access channels). Cc giao thc c s dng quyt nh ai c quyn truy cp ng truyn qung b trc c gom vo trong mt lp con ca tng lin kt d liu gi l lp con MAC. Lp con MAC l c bit quan trng trong mng LAN, do nhiu mng LAN s dng ng truyn dng qung b nh l phng tin truyn thng nn tng. Cc mng WAN, theo xu hng ngc li, li dng cc ni kt dng im-im (ngoi tr cc mng dng v tinh). V c bn, c ba phng php iu khin truy cp ng truyn : Chia knh, truy cp ngu nhin (Random Access) v phn lt ("Taking-turns"). Do vic kt ni mng lp 2 ny cho ta thy nhng u im ni bt: - Hn ch v di knh truyn ti a - Hn ch v s trm - Hn ch v ti 3.1.4. Khi nim cu ni (bridge) Bridge l mt thit b hot ng tng 2 trong m hnh OSI. Bridge lm nhim v chuyn tip cc khung t nhnh mng ny sang nhnh mng khc. iu quan trng l Bridge thng minh, n chuyn frame mt cch c chn lc da vo a ch MAC ca cc my tnh. Bridge cn cho php cc mng c tng vt l khc nhau c th giao tip c vi nhau. Bridge chia lin mng ra thnh nhng vng ng nh, nh ci thin c hiu nng ca lin mng tt hn so vi lin mng bng Repeater hay Hub. C th phn Bridge thnh 3 loi: Transparent Bridge(Cu ni trong sut ): Cho php ni cc mng Ethernet/ Fast Ethernet li vi nhau; Source Routing Bridge (Cu ni xc nh ng i t ngun): Cho php ni cc mng Token Ring li vi nhau; Mixed Media Bridge(Cu ni trn ln): Cho php ni mng Ethernet v Token Ring li vi nhau. 3.2. Transparent bridge Cu ni trong sut c s dng ni cc mng Ethernet li vi nhau. Ngi ta gi l cu ni trong sut bi v s hin din v hot ng ca n th trong sut vi 58

cc my trm. Khi lin mng bng cu ni trong sut, cc my trm khng cn phi cu hnh g thm c th truyn ti thng tin qua lin mng. Nguyn l hot ng Khi cu ni trong sut c m in, n bt u hc v tr ca cc my tnh trn mng bng cch phn tch a ch my gi ca cc khung m n nhn c t cc cng ca mnh. V d, nu cu ni nhn c mt khung t cng s 1 do my A gi, n s kt lun rng my A c th n c nu i ra hng cng 1 ca n. Da trn tin trnh ny,cu ni xy dng c mt Bng a ch cc b (Local address table) m t a ch ca cc my tnh so vi cc cng ca n.
a Ch my tinh (MAC) 00-2C-3A-4F-EE-07 00-2C-3A-5D-5C-2F Cng hng n my tnh 1 2

Cu ni s dng bng a ch cc b ny lm c s cho vic chuyn tip khung. Khi khung n mt cng ca cu ni, cu ni s c 6 bytes u tin ca khung xc nh a ch my nhn khung. N s tm a ch ny trong bng a ch cc b v s ng x theo mt trong cc trng hp sau: o Nu my nhn nm cng mt cng vi cng nhn khung, cu ni s b

qua khung v bit rng my nhn nhn c khung. o Nu my nhn nm trn mt cng khc vi cng nhn khung, cu ni

s chuyn khung sang cng c my nhn. o Nu khng tm thy a ch my nhn trong bng a ch, cu ni s gi

khung n tt c cc cng cn li ca n, tr cng nhn khung. Trong mi trng hp, cu ni u cp nht v tr ca my gi khung vo trong bng a ch cc b. 3.3. Source routing bridge Cu ni SRB c gi tn nh th bi v chng qui nh rng: ng i y t my tnh gi n my nhn phi c a vo bn trong ca khung d liu gi i bi my gi (Source). Cc cu ni SRB ch c nhim v lu v chuyn cc khung nh c ch dn bi ng i c lu trong trong khung. 59

Nguyn l hot ng: Gi s rng my X mun gi mt khung d liu cho my Y. u tin X cha bit c Y c nm cng LAN vi n hay khng. xc nh iu ny, X gi mt Khung kim tra (Test Frame). Nu khung kim tra tr v X m khng c du hiu nhn ca Y,X s kt lun rng Y nm trn mt nhnh mng khc. xc nh chnh xc v tr ca my Y trn mng xa, X gi mt Khung thm d Explorer Frame). Mi cu ni khi nhn c khung thm d (Bridge 1 v Bridge 2 trong trng hp ny) s copy khung v chuyn n sang tt c cc cng cn li. Thng tin v ng i c thm vo khung thm d khi chng i qua lin mng. Khi cc khung thm d ca X n c Y, Y gi li cc khung tr li cho tng khung m n nhn c theo ng i thu thp c trong khung thm d. X nhn c nhiu khung tr li t Y vi nhiu ng i khc nhau. X s chn mt trong s ng i ny, theo mt tiu chun no . Thng thng ng i ca khung tr li u tin s c chn v y chnh l ng i ngn nht trong s cc ng i (tr v nhanh nht). Sau khi ng i c xc nh, n c a vo cc khung d liu gi cho Y trong trng thng tin v ng i (RIF- Routing Information Field). RIF ch c s dng n i vi cc khung gi ra bn ngoi LAN.

60

CHNG IV. KT NI MNG INTERNET 4.1. Gii thiu

4.1.1. nh ngha - Internet l mt tp hp ca cc my tnh c lin kt ni li vi nhau thng qua h thng dy cp mng v ng in thoi trn ton th gii vi mc ch trao i, chia s d liu v thng tin. Bt c ngui no trn h thng cng c th tip cn v i vo xem thng tin t bt c mt my tnh no trn h thng ny hay h thng khc. - Trc y mng Internet c s dng ch yu cc t chc chnh ph v trong cc trng hc. Ngy nay mng Internet c s dng bi hng t ngi bao gm c c nhn cc doanh nghip ln, nh, cc trng hc v tt nhin l nh nc v cc t chc chnh ph. Phn ch yu nht ca mng Internet l World Wide Web. - Mng Internet l ca chung iu c ngha l khng ai thc s s hu n vi t cch c nhn. Mi phn nh ca mng c qun l bi cc t chc khc nhau nhng khng ai khng mt thc th no cng nh khng mt trung tm my tnh no nm quyn iu khin mng. Mi phn ca mng c lin kt vi nhau theo mt cch thc nhm to nn mt mng ton cu. - Internet l mt mng ton cu bao gm nhiu mng LAN (Local Area Network), MAN (Metropolitan Area Network) v WAN (Wide Area Network) trn th gii kt ni vi nhau. Mi mng thnh vin ny c kt ni vo Internet thng qua mt router. 4.1.2. Lch s pht trin ca mng Internet - Vo cui nm 1960 B Quc phng M tin hnh xy dng mt mng my tnh din rng trn ton nc M. Mng my tnh ny c tn gi l ARPANET (Advanced Research Project Agency Network) , mc tiu xy dng ca mng my tnh ny l cho php cc t chc chnh ph M chia s ti nguyn nh my in, my ch, c s d liu trn mng. - Vo u nm 1980 giao thc TCP/IP c pht trin v nhanh chng tr thnh giao thc mng chun c dng trn mng ARPANET. H iu hnh c dng trn mng lc ny l BSD UNIX cng c tch hp s dng giao thc TCP/IP. H iu hnh ny nhanh chng tr thnh mt cng c hu hiu pht trin mng my tnh.

61

- Vi cc cng ngh mi ny s lng mng my tnh pht trin nhanh chng. Mng ARPANET ban u tr thnh mng ng trc (backbone) cho mng my tnh chy trn giao thc TCP/IP gm hng ngn my thuc cc mng cc b khc nhau. Mng my tnh ny chnh l mng Internet. - Tuy nhin vo nm 1988, DARPA quyt nh tin hnh cc th nghim khc, B Quc phng M bt u hy b mng ARPANET v thay vo bng mng my tnh NSFNET. - Pht trin t mng ARPANET, ngy nay mng Internet gm hng trm ngn my tnh c ni vi nhau trn ton th gii. Mng ng trc hin ti c th ti c lu lng ln gp hng ngn ln so vi mng ARPANET trc . 4.2. Kt ni mng lp 3

4.2.1. Kt ni mng lp 3 Vic pht trin v s lng ca cc mng, cng vi s gia tng v kch thc ca chng i hi mt s lng host ln trn cng mt on mng, dn ti hin tng tc nghn v khng s dng c, gii quyt vn bt buc phi phn chia cc mng ny thnh cc mng con. Vic kt ni cc mng con ny li vi nhau s dng cc thit b lp 3 da trn cu trc a ch phn cp l iu bt buc p ng yu cu s dng cng nh nhu cu hin ti. B nh tuyn (router) c s dng kt ni cc mng khc nhau, Layer IP trong mi router s xc nh chng tip theo (router tip theo)

Hnh 4.1. Kt ni cc mng bng b nh tuyn router 4.2.2. B nh tuyn router B nh tuyn l thit b c s dng trn mng thc thi cc hot ng x l truyn ti thng tin trn mng. C th xem b nh tuyn l mt thit b my tnh c thit k c bit m ng c vai tr x l truyn ti thng tin trn mng 62

ca n v do n cng bao gm cc CPU, tri tim ca mi hot ng, b nh ROM, RAM, cc giao tip, cc bus d liu, h iu hnh v.v... B nh tuyn Router l mt thit b hot ng trn tng mng, n c th tm c ng i tt nht cho cc gi tin qua nhiu kt ni i t trm gi thuc mng u n trm nhn thuc mng cui. Router c th c s dng trong vic ni nhiu mng vi nhau v cho php cc gi tin c th i theo nhiu ng khc nhau ti ch. Khc vi Bridge hot ng trn tng lin kt d liu nn Bridge phi x l mi gi tin trn ng truyn th Router c a ch ring bit v n ch tip nhn v x l cc gi tin gi n n m thi. Khi mt trm mun gi gi tin qua Router th n phi gi gi tin vi a ch trc tip ca Router (Trong gi tin phi cha cc thng tin khc v ch n) v khi gi tin n Router th Router mi x l v gi tip. Khi x l mt gi tin Router phi tm c ng i ca gi tin qua mng. lm c iu Router phi tm c ng i tt nht trong mng da trn cc thng tin n c v mng, thng thng trn mi Router c mt bng ch ng (Router table). Da trn d liu v Router gn v cc mng trong lin mng, Router tnh c bng ch ng (Router table) ti u da trn mt thut ton xc nh trc. Ngi ta phn chia Router thnh hai loi l Router c ph thuc giao thc (The protocol dependent routers) v Router khng ph thuc vo giao thc (The protocol independent router) da vo phng thc x l cc gi tin khi qua Router. Router c ph thuc giao thc: Ch thc hin vic tm ng v truyn gi tin t mng ny sang mng khc ch khng chuyn i phng cch ng gi ca gi tin cho nn c hai mng phi dng chung mt giao thc truyn thng. Router khng ph thuc vo giao thc: c th lin kt cc mng dng giao thc truyn thng khc nhau v c th chuyn i gi tin ca giao thc ny sang gi tin ca giao thc kia, Router cng chp nhn kch thc cc gi tin khc nhau (Router c th chia nh mt gi tin ln thnh nhiu gi tin nh trc truyn trn mng). 4.3. Cu trc phn lp ca a ch IP

4.3.1. Cu trc v s phn lp a ch IP a ch IP phn cp l loi a ch c t chc theo kiu phn cp v do rt thun tin cho qun l v d tm. Ta hy c hnh dung nh a ch nh ring c qun l by gi vy. Trc y, cch qun l cha thng nht nn nu a ra mt a 63

ch nh l rt kh tm, th gi y mun tm c mt a ch nh no , ta cn bit cc thng tin v Ph - Ng Ngch - Hm - S nh l c th tm ra d dng. a ch IP l mt phn quan trng trong h giao thc TCP/IP. Giao thc TCP/IP c pht trin t mng ARPANET v Internet v c dng nh giao thc mng v vn chuyn trn mng Internet. TCP (Transmission Control Protocol) l giao thc thuc tng vn chuyn v IP (Internet Protocol) l giao thc thuc tng mng ca m hnh OSI. Hin nay cc my tnh ca hu ht cc mng c th s dng giao thc TCP/IP lin kt vi nhau thng qua nhiu h thng mng vik thut khc nhau. Giao thc TCP/IP thc cht l mt h giao thc cho php cc h thng mng cng lm vic vi nhau thng qua vic cung cp phng tin truyn thng lin mng. Nhim v chnh ca giao thc IP l cung cp kh nng kt ni cc mng con thnh lin kt mng truyn d liu, vai tr ca IP l vai tr ca giao thc tng mng trong m hnh OSI. Giao thc IP l mt giao thc kiu khng lin kt (connectionlees) c ngha l khng cn c giai on thit lp lin kt trc khi truyn d liu S a ch ha nh danh cc trm (host) trong lin mng c gi l a ch IP 32 bits (32 bit IP address hay chnh l ach IP phn cp). Mi giao din trong 1 my c h tr giao thc IP u phi c gn 1 a ch IP (mt my tnh c th gn vi nhiu mng do vy c th c nhiu a ch IP). Mi a ch IP c di 32 bits c tch thnh 4 vng (mi vng 1 byte), c th biu th di dng thp phn, bt phn, thp lc phn hay nh phn. Cch vit ph bin nht l dng k php thp phn c du chm (dotted decimal notation) tch cc vng. Mc ch ca a ch IP l nh danh duy nht cho mt my tnh bt k trn lin mng. a ch IP gm : Network ID: a ch ca mng Host ID: a ch ca my
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Octet 1 Octet 2 Octet 3 1111 1111.1111 1111.1111 1111.1111 1111 = 255.255.255.255 0 0 0 0 0 0 0 0 Octet 4

a ch IP chia ra 5 lp A,B,C, D, E. Hin ti dng ht lp A, B v gn ht lp C, cn lp D v E t chc Internet th gii ang dnh cho mc ch khc khng phn, nn chng ta ch nghin cu 3 lp u. 64

Netid trong a ch mng dng nhn dng tng mng ring bit. Cc mng lin kt phi c a ch mng (netid) ring cho mi mng. y cc bit u tin ca byte u tin c dng nh danh lp a ch : Nh phn: 0 - lp A; 10 - lp B; 110 - lp C; 1110- lp D; 11110 - lp E Thp phn: 0 127 lp A; 128 191 lp B; 192 223 lp C; 224 239 lp D; 241 255 lp E). a ch lp A Dng 7 bit chia a ch mng nn c 127 2 = 126 a ch mng cho lp A vi s my ti a l 224 - 2 = 16.777.214 cho mi a ch mng lp A. Lp A s dng byte u tin ca 4 byte nh du a ch mng. Nh hnh trc n c nhn ra bi bit u tin l 0 v 7 bit cn li c dng nh a ch cc my trong mng. Nguyn nhn ch c 126 a ch mng l do trong khi dng 8 bit u tin nh a ch mng, cc a ch no ton 0 hoc ton1 u b loi b. Cc gi tr netid ton 0 khi chuyn sang thp phn l s 0 v khng c ngha. Cn netid ton 1 th dng truyn thng trong mng. i vi vic ch c 16.777.214 my c s dng trong khi dng 24 bit nh a ch host cng c gii thch nh sau : Mt a ch c hostid = 0 c dng hng ti mng nh danh bi vng netid. Ngc li, mt a ch c vng hostid gm ton s 1 c dng hng ti tt c cc host ni vo mng netid, v nu vng netid cng gm ton s 1 th n hng ti tt c cc host trong lin mng (cn gi l a ch broadcast trong ni b mng). a ch lp A s c dng : Network.Host.Host.Host V d: a ch 10.12.12.12 nm trong mng lp A c a ch 10.0.0.0 v c gn hostid l 12.12.12. a ch lp B Mt a ch lp B c nhn ra bi 2 bit u tin ca byte th nht mang gi tr 10. Lp B s dng 2 byte u tin trong 4 byte nh a ch mng v 2 byte cui cng dng nh a ch my trong mng. Nh vy, vn theo quy tc tnh nh i vi lp A th s c: 214 - 2 = 16.382 a ch mng trong lp B v mi mng s c ti a 216 - 2 = 65.534 my.

65

a ch lp B c dng : Network.Network.Host.Host. V d: a ch 129.12.12.12 nm trong mng lp B c a ch 129.0.0.0 v c gn hostid l 12.12.12. a ch lp C Mt t chc quy m nh c th xin cp pht a ch lp C.Mt a ch lp C s dng 3 byte u nh a ch mng v mt byte cui nh a ch my trong mng. Nh vys c 221 - 2 = 2.097.150 a ch mng lp C v trong mi mng c ti a 28 - 2 = 254 my. a ch lp C c dng : Network.Network.Network.Host. V d: a ch 198.12.12.12 nm trong mng lp C c a ch 198.0.0.0 v c gn hostid l 12.12.12. a ch lp D a ch mng lp D th s chy trong di 224.0.0.0 n 239.255.255.255 khi ta quy i ra cch c bng s thp phn. Cc a ch mng lp D dng cho mc ch multicast, khc vi cc a ch lp A, B, C. Nh vy chng ta s c 268.435.456 cc nhm multicast khc nhau. a ch lp E a ch mng lp E th s chy trong di 240.0.0.0 n 255.255.255.255 khi ta quy i racch c bng s thp phn. C th thy a ch 255.255.255.255 l mt a ch c bit v c s dng cho mc ch c bit khc. Cc a ch mng lp E dng cho mc ch trong tng lai ch hin nay cha c s dng 4.3.2. Mt s a ch IP c bit - a ch mng (Network Address): l a ch IP m gi tr ca tt c cc bits phn nhn dng my tnh u l 0, c s dng xc nh mt mng. V d : 10.0.0.0; 172.18.0.0 ; 192.1.1.0 - a ch qung b (Broadcast Address) : L a ch IP m gi tr ca tt c cc bits phn nhn dng my tnh u l 1, c s dng ch tt c cc my tnh trong mng. V d : 10.255.255.255, 172.18.255.255, 192.1.1.255 - Mt n mng chun (Netmask) : L a ch IP m gi tr ca cc bits phn nhn dng mng u l 1, cc bits phn nhn dng my tnh u l 0. Nh vy ta c 3 mt n mng tng ng cho 3 lp mng A, B v C l : 66

Mt n mng lp A : 255.0.0.0 Mt n mng lp B : 255.255.0.0 Mt n mng lp C : 255.255.255.0 Ta gi chng l cc mt n mng mc nh (Default Netmask) Lu : a ch mng, a ch qung b, mt n mng khng c dng t a ch cho cc my tnh - a ch mng 127.0.0.0 l a ch c dnh ring t trong phm vi mt my tnh. N ch c gi tr cc b ( trong phm vi mt my tnh). Thng thng khi ci t giao thc IP th my tnh s c gin a ch 127.0.0.1. a ch ny thng thng kim tra xem giao thc IP trn my hin ti c hot ng khng. - a ch dnh ring cho mng cc b khng ni kt trc tip Internet : Cc mng cc b khng ni kt trc tip vo mng Internet c th s dng cc a ch mng sau nh a ch cho cc my tnh trong mng ca mnh : Lp A : 10.0.0.0 Lp B : 172.16.0.0 n 172.32.0.0 Lp C : 192.168.0.0 4.3.3. ngha ca Netmask Vi mt a ch IP v mt Netmask cho trc, ta c th dng php ton AND BIT tnh ra c a ch mng m a ch IP ny thuc v. Cng thc nh sau : Network Address = IP Address & Netmask V d : Cho a ch IP = 198.53.147.45 v Netmask = 255.255.255.0. Ta thc hin php ton AND BIT (&) hai a ch trn: Biu din thp phn IP Address Netmask Network Address 198.53.147.45 255.255.255.0 198.53.147.0 Biu din nh phn 11000110 00110101 10010011 0101101 11111111 11111111 11111111 0000000 11000110 00110101 10010011 0000000

4.3.4. Phn mng con (Subnetting) Phn mng con l mt k thut cho php nh qun tr mng chia mt mng thnh nhng mng con nh, nh c c cc tin li sau :

67

n gin ha vic qun tr : Vi s tr gip ca cc router, cc mng c th c chia ra thnh nhiu mng con (subnet) m chng c th c qun l nh nhng mng c lp v hiu qu hn.

C th thay i cu trc bn trong ca mng m khng lm nh hng n cc mng bn ngoi. Mt t chc c th tip tc s dng cc a ch IP c cp m khng cn phi ly thm khi a ch mi.

Tng cng tnh bo mt ca h thng : Phn mng con s cho php mt t chc phn tch mng bn trong ca h thnh mt lin mng nhng cc mng bn ngoi vn thy l mt mng duy nht.

C lp cc lung giao thng trn mng : Vi s tr gip ca cc router, giao thng trn mng c th c gi mc thp nht c th.

Phng php phn mng con Nguyn tc chung thc hin phn mng con l : Phn nhn dng mng (Network Id) ca a ch mng ban u c gi nguyn. Phn nhn dng my tnh ca a ch mng ban u c chia thnh 2 phn: Phn nhn dng mng con (Subnet Id) v Phn nhn dng my tnh trong mng con (Host Id).

Hnh 4.2. Cu trc a ch IP khi phn mng con phn mng con, ngi ta phi xc nh mt n mng con (subnetmask). Mt n mng con l mt a ch IP m gi tr cc bit phn nhn dng mng (Network Id) v Phn nhn dng mng con (Subnet Id) u l 1 trong khi gi tr ca cc bits Phn nhn dng my tnh (Host Id) u l 0. Hnh sau m t mt n phn mng con cho mt mng lp C.

Hnh 4.3. Mt n mng con khi phn mng con

68

Khi c c mt n mng con, ta c th xc nh a ch mng con (Subnetwork Address) m mt a ch IP c tnh bng cng thc sau : Subnetwork Address = IP & Subnetmask C hai chun thc hin phn mng con l : Chun phn lp hon ton (Classfull standard) v chun Vch ng lin min khng phn lp CIDR (Classless Inter-Domain Routing ). Thc t, CIDR ch mi c a s cc nh sn xut thit b v h iu hnh mng h tr nhng vn cha hon ton chun ha. Phng php phn lp hon ton (Classfull Standard)

Chun ny qui nh a ch IP khi phn mng con s gm 3 phn : Phn nhn dng mng ca a ch ban u (Network Id): Phn nhn dng mng con (Subnet Id) : c hnh thnh t mt s bits c trng s cao trong phn nhn dng my tnh (Host Id) ca a ch ban u V cui cng l phn nhn dng my tnh trong mng con (Host Id) bao gm cc bit cn li. V d : Hnh sau m t cu trc a ch IP lp C khi thc hin phn mng con

Hnh 4.4. a ch IP phn mng con theo chun Phn lp hon ton S lng bits thuc phn nhn dng mng con xc nh s lng mng con. Gi s phn nhn dng mng con chim 4 bits. Nh vy, v mt l thuyt ta c th phn ra thnh 24 =16 mng con. Tuy nhin phn nhn dng mng con gm ton bit 0 hoc bit 1 khng c dng nh a ch cho mng con v n trng vi a ch mng v a ch qung b ca mng ban u. V d : Cho a ch mng lp C : 192.168.1.0 vi mt n mng mc nh l 255.255.255.0.

69

Xt trng hp phn mng con cho mng trn s dng 2 bits lm phn nhn dng mng con. Mt n mng trong trng hp ny l 255.255.255.192. Khi ta c cc a ch mng con nh sau : a ch IP Biu din dng thp phn 1100 0000 1100 0000 1100 0000 1100 0000 1100 0000 Biu din dng nh phn 1010 1000 1010 1000 1010 1000 1010 1000 1010 1000 0000 0001 0000 0001 0000 0001 0000 0001 0000 0001 0000 0000 0000 0000 0100 0000 1000 0000 1100 0000

Mng ban u 192.168.1.0 Mng con 1 Mng con 2 Mng con 3 Mng con 4 192.168.1.0 192.168.1.64 192.168.1.128 192.168.1.192

Ta nhn thy rng: a ch mng con th nht 192.168.1.0 trng vi a ch mng ban u. a ch mng con th t 192.168.1.192 c a ch qung b trng vi a ch qung b ca mng ban u . Chnh v th m hai a ch ny ( c phn nhn dng mng con ton bit 0 hoc ton bit 1) khng c dng nh a ch cho mng con. Ni tm li, vi n bits lm phn nhn dng mng con ta ch c th phn ra c 2n - 2 mng con m thi. Mi mng con cng c a ch qung b. l a ch m cc bits phn nhn dng my tnh u c gi tr l 1. V d : a ch IP Mng con 1 Mng con 3 Biu din dng Biu din dng nh phn thp phn 192.168.1.64 1100 0000 1010 1000 0000 0001 0100 0000 1100 0000 1010 1000 0000 0001 0111 1111 1100 0000 1010 1000 0000 0001 1000 0000 1100 0000 1010 1000 0000 0001 1011 1111 192.168.1.128

a ch qung b 192.168.1.127 a ch qung b 192.168.1.191

Nh vy qui trnh phn mng con c th c tm tt nh sau : Xc nh s lng mng con cn phn, gi s l N. Biu din (N+1) thnh s nh phn. s lng bit cn thit biu din (N+1) chnh l s lng bits cn dnh cho phn nhn dng mng con. V

70

d N=6, khi biu din ca (6+1) di dng nh phn l 111. Nh vy cn dng 3 bits lm phn nhn dng mng con To mt n mng con Lit k tt c cc a ch mng con c th, tr hai a ch m phn nhn dng mng con ton cc bits 0 v cc bit 1. Chn ra N a ch mng con t danh sch cc mng con lit k.

Phng php Vch ng lin min khng phn lp CIDR (Classless InterDomain Routing ) CIDR l mt s nh a ch mi cho mng Internet hiu qu hn nhiu so vi s nh a ch c theo kiu phn lp A, B v C. CIDR ra i gii quyt hai vn bc xc i vi mng Internet l : Thiu a ch IP Vt qu kh nng cha ng ca cc bng chn ng.

Vn thiu a ch IP Vi s nh a ch truyn thng, cc a ch c phn ra thnh cc lp A, B v C. Mi a ch c 2 phn, phn nhn dng mng v phn nhn dng my tnh. Khi s lng mng v s my tnh ti a cho tng mng c thng k nh bng sau: Lp mng A B C S lng mng 126 65.000 Hn 2 triu S my tnh ti a trong mng 16.777.214 65.534 254

Bi v cc a ch ca mng Internet thng c gn theo kch thc ny dn n tnh trng lng ph. Trng hp bn cn 100 a ch, Bn s c cp mt a ch lp C. Nh vy cn 154 a ch khng c s dng. Chnh iu ny dn n trnh trng thiu a ch IP cho mng Internet. Theo thng k, ch c khong 3% s a ch c cp pht c s dng n. Chnh v th s nh a ch mi CIDR ra i khc phc tnh trng trn. Vn vt qu kh nng cha ng ca cc bng chn ng Khi s lng mng trn mng Internet tng cng ng ngha vi vic tng s lng router trn mng. Trong nhng nm gn y, ngi ta d on rng cc router ng trc ca mng Internet ang nhanh chng tin n mc ngng ti a s lng

71

router m n c th chp nhn c. Thm ch vi nhng cng ngh hin i dng sn xut cc router th v mt l thuyt kch thc ti a ca mt bng chn ng cng ch n 60.000 mc t (ng i). Nu khng c nhng ci tin th cc router ng trc s t n con s ny v nh th khng th m rng mng Internet hn na. gii quyt hai vn trn, cng ng Internet a ra cc gii php sau : - Sa i li cu trc cp pht a ch IP tng hiu qu - Kt hp vic chn ng c cu trc gim ti a s lng cc mc t trong bng chn ng. Sa i li cu trc cp pht a ch IP CIDR c s dng thay th cho s cp pht c vi vic qui nh cc lp A, B, C. Thay v phn nhn dng mng c gii hn vi 8, 16 hoc 24 bits, CIDR s dng phn nhn dng mng c tnh tng qut t 13 n 27 bits. Chnh v th cc khi a ch c th c gn cho mng nh nht vi 32 my tnh n mng ln nht hn 500.000 my tnh. iu ny p ng gn ng yu cu nh a ch ca cc t chc khc nhau. a ch CIDR Mt a ch theo cu trc CIDR, gi tt tt a ch CIDR, bao gm 32 bits ca a ch IP chun cng vi mt thng tin b sung v s lng cc bit c s dng cho phn nhn dng mng. V d : Vi a ch CIDR 206.13.01.48/25 th chui s "/25" ch ra rng 25 bits u tin trong a ch IP c dng nhn dng duy nht mt mng, s bits cn li dng nhn dng mt my tnh trong mng. Bng sau so snh gia s nh a ch theo kiu CIDR v s nh a ch theo chun phn lp hon ton. S bits nhn dng mng Lp tng ng trong chun trong a ch CIDR phn lp hon ton /27 /26 /25 /24 /23 /22 /21 /20 /19 1/8 lp C 1/4 lp C 1/2 lp C 1 lp C 2 lp C 4 lp C 8 lp C 16 lp C 32 lp C S lng my tnh trong mng 32 64 128 256 512 1.024 2.048 4.096 8.192

72

/18 /17 /16 /15 /14 /13 ng.

64 lp C 128 lp C 256 lp C (=1 lp B) 512 lp C 1024 lp C 2048 lp C

16.384 32.768 65.536 131.072 262.144 524.288

Kt hp vic chn ng c cu trc gim ti a s lng cc mc t trong bng chn

S nh a ch theo theo CIDR cng cho php kt hp cc ng i, mc t trong bng chn ng mc cao c th i din cho nhiu router mc thp hn trong cc bng chn ng tng th. S ny ging nh h thng mng in thoi mng c thit lp theo kin trc phn cp. Mt router mc cao (quc gia), ch quan tm n m quc gia trong s in thoi, sau n s vch ng cho cuc gi n router ng trc ph trch mng quc gia tng ng vi m quc gia . Router nhn c cuc gi nhn vo phn u ca s in thoi, m tnh, vch ng cho cuc gi n mt mng con tng ng vi m tnh , v c nh th. Trong s ny, cc router ng trc ch lu gi thng tin v m quc gia cho mi mc t trong bng chn ng ca mnh, mi mc t nh th i din cho mt s khng l cc s in thoi ring l ch khng phi l mt s in thoi c th. Thng thng, cc khi a ch ln c cp cho cc nh cung cp dch v Internet (IP- Internet Service Providers) ln, sau h li cp li cc phn trong khi a ch ca h cho cc khch hng ca mnh. Hin ti, mng Internet s dng c hai s cp pht a ch Classfull standard v CIDR. Hu ht cc router mi u h tr CIDR v nhng nh qun l Internet th khuyn khch ngi dng ci t s nh a ch CIDR. 4.4. Mi lin h gia a ch lp 2 v a ch lp 3 Trong mng cc b, b phn iu hp chu trch nhim phn pht cc gi tin n tng thit b, cc thit b trong mng cc b lin kt trc tip qua a ch phn cng (a ch MAC). mng din rng, b phn iu hp b qu ti khi s lng thit b phn cng ln, nn n s dng a ch logic (a ch IP) cung cp kh nng chia nh, qun l cc mng con.

73

Mng LAN nh hot ng trn 2 lp 1 v 2 (m hnh OSI) Trong cc giao thc lin mng (interwork) a ch lp 3 (network) c s dng do s u vit hn a ch lp 1 v 2 a ch MAC: Thuc lp Datalink l a ch 48bit a ch IP: Thuc lp Network l a ch 32bit Vic nh x trc tip MAC/IP gp kh khn. ARP c pht trin nhm gii quyt vn trn v to lp mt c ch linh hot trong s dng. o ARP (Address Resolution Protocol): Giao thc ny cho php xc nh a ch MAC ca mt host thng qua IP. o RARP (Reverse Address Resolution Protocol): Giao thc RARP cung cp kh nng nh a ch IP ti thi im khi ng ca thit b. 4.4.1. nh x a ch IP vo a ch MAC Giao thc TCP/IP s dng ARP tm a ch vt l ca trm ch. V d khi cn gi mt gi d liu IP cho mt h thng khc trn cng mt mng vt l Ethernet, h thng gi cn bit a ch Ethernet ca h thng ch tng lin kt d liu xy dng khung gi d liu. Thng thng, mi h thng lu gi v cp nht bng thch ng a ch IP-MAC ti ch (cn c gi l bng ARP Cache). Bng thch ng a ch c cp nht bi ngi qun tr h thng hoc t ng bi giao thc ARP sau mi ln nh x c mt a ch tng ng mi. Trc khi trao i thng tin vi nhau, node ngun cn phi xc nh a ch vt l MAC ca node ch bng cch tm kim trong bng a ch IP. Nu khng tm thy, node ngun gi qung b(Broadcast) mt gi yu cu ARP(ARP Request) c cha a ch IP ngun, a ch IP ch cho tt cc cc my trn mng. Cc my nhn, c, phn tch v so snh a ch IP ca n vi a ch IP ca gi. Nu cng a ch IP, ngha l node ch tm trong bng thch ng a ch IP - MAC ca n v tr li bng mt gi ARP Reply c cha a ch MAC cho node ngun. Nu khng cng a ch IP, n chuyn tip gi yu cu nhn c di dng qung b cho tt c cc trm trn mng. Tm li tin trnh ca ARP c m t nh sau: - IP yu cu a ch MAC. - Tm kim trong bng ARP. - Nu tm thy s tr li a ch MAC. 74

- Nu khng tm thy, to gi ARP yu cu v gi ti tt c cc trm. - Tu theo gi tin tr li, ARP cp nht vo bng ARP v gi a ch MAC cho IP. 4.4.2. nh x a ch MAC vo a ch IP RARP l giao thc phn gii a ch ngc. Qu trnh ny ngc li vi qu trnh ARP trn, ngha l cho trc a ch mc lin kt, tm a ch IP tng ng. Nh vy RARP c s dng pht hin a ch IP, khi bit a ch vt l MAC. V cng c s dng trong trng hp trm lm vic khng c a Khun dng gi tin RARP tng t nh khun dng gi ARP trnh by, ch khc l trng Opcode c gi tr 00003 cho m lnh yu cu(RARP Request) v c gi tr 00004 cho m lnh tr li(RARP Reply). Nguyn tc hot ng ca RARP ngc vi ARP, ngha l my bit trc a ch vt l MAC tm a ch IP tng ng ca n. Hnh 4.5 minh ha hot ng ca giao thc RARP. My A cn bit a IP ca n, n gi gi tin RARP Request cha a ch MAC cho tt c cc my trong mng LAN. Mi my trong mng u c th nhn gi tin ny nhng ch c Server mi tr li RARP Reply cha a ch IP ca n.

Hnh 4.5. V d v hot ng ca giao thc RARP 4.5. BOOTSTRAP v DHCP

4.5.1. Gii thiu Trong mng my tnh, giao thc Bootstrap, hay BOOTP, l mt giao thc mng m my client s dng ly a ch IP t mt my server. Giao thc BOOTP c ch nh trong RFC 951.

75

(RFC l vit tt ca Request For Comment, l tp hp nhng ti liu v kin ngh, xut v nhng li bnh lun lin quan trc tip hoc gin tip n cng ngh, nghi thc mng INTERNET. Cc ti liu RFC c chnh sa, thay i n khi tt c cc k s thnh vin ca IETF(Internet Engineering Task Force) ng v duyt, sau nhng ti liu ny c xut bn v c cng nhn l 1 chun, nghi thc cho Internet. Ti liu RFC ni ting v lm to c ting vang ln nht l ti liu RFC s 822 v Internet Email bi Dave Crocker.)

BOOTP thng c s dng trong tin trnh bootstrap khi my tnh ang khi ng. Server cu hnh BOOTP gn a ch IP cho tng my client t mt dy a ch . BOOTP s dng giao thc UDP (User Datagram Protocol) lm giao thc vn chuyn. V phng din lch s, BOOTP c s dng cho cc my trm khng a cng vi h iu hnh UNIX ( hoc tng t) tm thy c v tr ca file boot my ngoi vic nhn c a ch IP, v cng bi giao thc ny m cc c quan x nghip dng trn khai vic ci t mi h iu hnh (v d :h iu hnh Windows) cho cc my tnh c nhn (PC) cha c h iu hnh. Lc ban u ngi ta phi chng trnh ca giao thc ny trong a mm gi l a mm boot. a mm ny khi ng thit lp cc kt ni mng s khi. Sau ny vic sn xut ra cc cc mng tch hp giao thc ny trong BIOS cng nh l tch hp trong bo mch ch vi nhng cc mng on-board, nh th cho php my boot trc tip qua cc mng. DHCP (Dynamic Host Configuration Protocol) l mt giao thc cao cp hn cho cng mc ch v thay th cho BOOTP. Phn ln cc DHCP servers h tr thm BOOTP. 4.5.2. BOOTP Tng quan, lch s v chun v BOOTP B giao thc TCP/IP c mt gn 3 thp k, v vn lm th no t ng ha vic cu hnh cc thng s cho cc my s dng a ch IP c t lu. Vo u thp nin 1980, cc mng in ton cn nh v tng i n gin. Vic cu hnh t ng TCP/IP khng c coi l quan trng lm mc du c s kh khn trong cu hnh cc thng s bng tay. N quan trng ch khng c cch no khc cu hnh cc my trm khng c a cng. Nh chng ta bit, nu khng c mt dng no ct gi d liu bn trong my, mt thit b phi cy vo mt ngi no hay mt ci g bn ngoi ni cho n bit n l ai(a ch ca n) v phi vn hnh nh th no mi ln m my. Khi mt thit b nh th c bt ln , n phi mt tnh th kh khn: n cn phi s dng 76

IP lin lc vi mt thit b khc nh thit b ny cung cp thng tin cho n bit lm sao lin lc vi nhau bng cch s dng IP! Tin trnh ny c gi l bootstrapping hay ni cho gn booting, t bootstrap ngha en l dy gn vo pha trn gt giy , n d mt ngi dng mt vt nh ko mt vt ln hn l chic giy vo chn. Cng nh vy, mt chng trnh nh dng ko mt chng trnh ln hn l h iu hnh vo b nh. BOOTP: sa sai cc yu km ca RARP Giao thc RARP (Reverse Address Resolution Protocol) l giao thc u tin c to ra gii quyt vn bootstrap. RARP ra i nm 1984, l mt s bin th trc tip t giao thc cp thp ARP (Address Resolution Protocol), mt giao thc kt buc a ch IP vi a ch tng data-link. RARP c kh nng cp a ch IP cho thit b khng c a cng, bng cch dng s trao i n gin bng mt truy vn v mt tr li trong mi quan h client/server . Qu nhiu hn ch ca RARP tr thnh mt kh khn cho mng: - N hot ng bng broadcasts tng data-link, v vy n i hi phi c s iu chnh cho ph hp vi tng phn cng ca nh sn xut khc nhau. - Mt server RARP i hi phi nm trn mi mng vt l p ng cho cc broadcast tng 2. - Mi server RARP phi c mt ngi Admin cp a ch IP bng tay trn server. - V iu km ci nht l RARP ch cp a ch IP v khng cho thm mt thng tin no khc m my client rt cn. RARP r rng l khng sc cung cp thng tin cu hnh TCP/IP cho cc my tnh. h tr va cho cc my tnh khng c a cng va cho vic cu hnh TCP/IP t ng, v th m BOOTP (Bootstrap) c to ra. BOOTP c chun ha trong RFC 951, xut bn thng 9 nm 1985. Giao thc ny c pht trin gii quyt cc hn ch ca RARP: - N vn cn da vo quan h client/server, nhng n c trin khai tng cao hn, dng UDP cho vic vn chuyn. N khng cn ph thuc vo phn cng c bit no ca nh sn xut nh l RARP. - H tr gi thm thng tin ti my client ngoi a ch IP.Thng tin thm ny thng c gi trong mt thng ip duy nht.

77

- N c th s dng trong mi trng client v server trong nhng h thng mng gm nhiu NetID khc nhau. iu ny cho php qun l a ch IP tp trung mt server. BOOTP ch gii quyt giai on u ca Bootstrapping Chng ta cng cn phi lu rng mc d c tn l BOOTP, m ch rng n c mi th cn thit my tnh khng c a cng c th boot c, nhng iu ny thc s khng ng. V chnh BOOTP t m t, bootstrapping i hi hai giai on: - Giai on u tin, my client c cung cp a ch IP v cc thng s khc. - Giai on hai, my client download phn mm, nh l h iu hnh v cc drivers, n c th hot ng trn mng v thc hin cc cng tc m n c giao. BOOTP thc s ch gii quyt c giai on u tin: gii quyt vic cp a ch v thng s cu hnh. Giai on hai mc nh xy ra bng cch s dng mt giao thc khc dng vn chuyn file nh l TFTP (Trivial File Transfer Protocol) Cc thng s c trng cho nh sn xut Ngi ta c mt quyt nh sng sut khi pht trn BOOTP l vic thm vo trong giao thc phn c trng ca nh sn xut phn cng. iu ny nhm c mt ch cho nhng nh sn xut c th ch nh cc thng s lin quan ti sn phm phn cng ca ring h. Khi phc tp ca b giao thc TCP/IP tng ln, ngi ta nhn ra rng ny qu li ch v c th c dng ch nh thm phng php truyn t cc thng s n cc my TCP/IP , v thc t l n tr nn c lp vi nh sn xut. iu ny c ngh ln u tin trong RFC 1048 S kin m BOOTP c th c dng cung cp nhiu thng tin cho my client ngoi a ch IP lm cho n tht ch li ngay c trong nhng trng hp m my client c a ch IP ri. BOOTP c th c dng gi cc thng tin m ngi qun l mun mi my u c, m bo chng s dng mng mt cch thng nht. Ngoi ra , trong trng hp cc thit b c a cng bn trong (v v vy khng cn BOOTP ly a ch IP), BOOTP vn c th c dng cho nhng thit b ny ly c tn ca file boot cho giai on hai ca tin trnh boot my. Nhng s thay i i vi BOOTP v s pht trin ca DHCP

78

BOOTP l giao thc cu hnh TCP/IP c la chn hng u t gia thp nin 1980 cho n cui thp nin 1990. Phn m rng cho nh sn xut c a vo trong RFC 1048 l mt s ph bin, sau khi tri qua nhiu nm c thm nhiu phn m rng cho nh sn xut c ch nh; RFC 1048 c thay th bng RFC 1084, 1395 v 1497 k tip nhau. Th l s ln ln cng pht sinh khi tri qua nm thng trong vic gii thch mt vi phn trong RFC 951 (RFC 951 khi to ra giao thc BOOTP) v lm sao mt vi tnh nng ca BOOTP c th thc hin c. Trong hon cnh nh vy, RFC 1542 (Lm sng t v cc phn m rng cho giao thc Bootstrap) ra i vo thng 10 nm 1993 gii quyt nhng vn m h , ln ln ca cc RFC c trc v cng a thm vo mt vi thay i nh cho hot ng ca giao thc BOOTP (RFC 1542 thc cht l s chnh sa mt RFC tng t trc l RFC 1532, nhng v chun ny c mt vi li nh trong nn khng tip tc c.) Trong lc BOOTP rt thnh cng mt cch hin nhin nhng n cng c mt vi nhc m ca ring n. Mt trong nhng thiu st quan trng l khng cp c a ch IP cp nht ng. Nhu cu cp a ch ng tr thnh r rt hn bao gi ht khi Internet thc s khi u ct cnh vo cui thp nin 1990. Chnh iu ny trc tip dn ti s pht trin giao thc DHCP (Dynamic Host Configuration Protocol) DHCP thay th BOOTP lm giao thc cu hnh TCP/IP , tht l sai lm khi cho rng BOOTP hon ton ra i. Ngy nay n vn cn c s dng trong nhiu mng khc nhau. Hn na, DHCP ly BOOTP lm nn tng v chng c nhiu thuc tnh chung, k c nh dng cc thng ip cng ging nhau. Nhng phn m rng cho nh sn xut phn cng trong BOOTP tr thnh phn Options ca DHCP, chng hot ng cng mt cch nhng DHCP c nhiu kh nng hn. Trn thc t, RFC 1497(RFC v phn m rng ca BOOTP) k tha RFC 1533 (RFC v cc Options ca DHCP v phn m rng ca BOOTP) chnh thc kt hp phn m rng ca BOOTP v phn Options ca DHCP thnh mt chun chung. 4.5.3. DHCP (Dynamic Host Configuration Protocol) V mt phng din no chng ta c th ni tin b ca cngngh l mt hnh trnh ch khng th no l mt ch n. Khi mt cng ngh c th no c tinh chnh hay thay th bng mt ci khc siu hng hn th ch l vn thi gian, n cng li b mt ci khc tt hn thay th n. V iu ny rt ng cho BOOTP. Trong lc BOOTP c nhiu kh nng vt tri hn giao thc m n thay th l RARP, th n lt n, sau mt vi nm, chnh n li b giao thc DHCP thay th. 79

Ngi ta coi BOOTP l mt cuc cch mng, mt s thay i ln t RARP, th DHCP l mt s tin ha vt bc ca BOOTP. DHCP ly BOOTP lm nn tng, c cng nh dng ca cc thng ip. Ci thm vo c ngha nht trong DHCP l kh nng cp a ch IP ng cho cc my clients v qun l tp trung chng. Chnh tnh nng ny m va cho n ci tn (Dynamic) va lm cho n thm quyn lc. Ngy nay DHCP l giao thc chun cp cu hnh TCP/IP cho cc my v c s dng bao sn ht t mng ch c mt my client gia nh cho n nhng lin mng to ln ca cc c quan x nghip. Tng quan, ng lc, lch s v chun ca DHCP BOOTP biu th mt s tin b y ngha so vi RARP v n gii quyt c tht nhu hn ch ca RARP. BOOTP l mt giao thc nm tng cao hn, c lp vi phn cng khng nh l RARP. N c kh nng h tr gi thm thng tin ngoi a ch IP cho my client. Ngoi ra, thng qua vic s dng BOOTP relay agents, n lm cho mt mng ln ch s dng mt hay hai BOOTP servers phc v cho cc my clients nm ri trn nhiu mng vt l khc NetID. Nhu cu ca vic gn a ch IP ng BOOTP thng thng s dng mt phng php tnh xc nh a ch IP no gn cho thit b. Khi my client gi thng ip yu cu th thng ip bao gm c a ch vt l, ri server tra a ch trong bng a ch xc nh a ch IP no cho my client.(BOOTP cn c th s dng nhng phng php khc xc lp mi quan h gia a ch IP v a ch vt l, nhng cho tng ng tnh l phng php thng s dng). iu ny c ngha l BOOTP lm vic tng i tt trong mi trng tnh, ni m nhng s thay i v a ch IP ca cc thit b khng thng xy ra. Nhng mng nh th l thng thng trong thp nin 1980 v u thp nin 1990. Tri qua nm thng, nhiu mng my tnh ri xa khi m hnh ny v mt s l do: - Khi cc my tnh ngy cng nh v nh hn th tht d cho chng c di chuyn t mng ny n mng khc. mng khc chng li cn mt a ch khc vi Network ID ca mng mi. - Cc my tnh xch tay nh l Laptop hay palmtop c th di chuyn t mng ny n mng khc nhiu ln trong ngy.

80

- Mt vn ln khc l s cn kit khng gian a ch IP. Trong nhiu c quan , vic gn a ch IP tnh v dng mi cho mi my chng kt ni vo mng l mt ph phm. - Trong nhiu c quan, vic theo di nhng s thay i a ch c nh tr nn mt cng vic nn lng. BOOTP, vi bng nh x a ch tnh gia a ch vt l v a ch IP khng thch hp cho cng vic ny. N cng khng c cch no s dng li cc a ch; mi ln m mt a ch cp, my tnh s gi mi a ch , ngay c khi n khng cn cn dng n na. DHCP:Mt giao thc xy dng trn sc mnh ca BOOTP Ngi ta cn mt giao thc cu hnh TCP/IP mi phc v cho nhng mng in ton hin i hn. T chc IETF p ng iu ny bng giao thc DHCP (Dynamic Host Configuration Protocol), ln u tin c xut bn trong RFC 1541, thng 10 nm 1993. (Thc ra, chun trong giao thc c ni n trong RFC 1531 xut bn trong cng thng nhng v c mt vi li nh trong chun ny nn ngi ta hiu chnh v xut bn RFC 1541) D nhin, khc vi BOOTP l mt protocol cn km ci. DHCP hot ng rt tt v cng c s dng rng ri nhiu ni khc nhau. Cc yu t ny cho thy giao thc ny tip ni BOOTP v c b sung thm nhiu theo nm thng . DHCP gm hai thnh phn chnh: - C ch cp a ch IP. - C ch cho php my client yu cu v server cung cp thng tin cu hnh. DHCP thc hin c hai chc nng ny cng mt cch nh BOOTP nhng c nhiu ci tin hn. Tng quan cc tnh nng ca DHCP S thay i c ngha nht trong lnh vc cp a ch IP, chnh l tnh nng cp a ch IP ng (i lp vi vic ngi admin phi to bng nh x gia a ch vt l v a ch IP trn BOOTP server). - DHCP s dng mt dy a ch IP m ngi admin cu hnh v t cp cho my client khng cn phi ghp sn trc. - ng thi DHCP h tr cho vic nh x a ch IP vi a ch vt l khi no thy cn (ta gi tnh nng ny l Reservation)

81

Cn v vic thng tin lin lc gia my client v server, tng th m ni, n li tng t vi BOOTP nhng vn c s thay i. Cng cng giao thc hi/p bng cch s dng UDP lin lc thng tin cu hnh, nhng li c thm cc gi thng ip c to ra h tr nhng tnh nng c tng cng ca DHCP. DHCP c th dng BOOTP relay agents cng mt cch tng t m my client v server BOOTP s dng. Phn m rng thng tin cho nh sn xut phn cng cng c gi li, nhng c hnh thc ho v t tn li l DHCP Options, v c m rng thm truyn c nhiu thng tin hn. Kt qu ca mi n lc ny l mt giao thc cu hnh TCP/IP c s chp nhn rng ri, ph bin nhng vn gi li tnh tng thch vi BOOTP trong khi li m rng thm nhng tnh nng y ngha. DHCP c s dng cho mi th t vic cp a ch IP cho nhng mng hng ngn my tnh n vic cho php thit b nh tuyn (router) truy cp Internet t ng cung cp thng tin cu hnh Internet cho ch mt my tnh duy nht c mt ngi dng. Thng s k thut ca DHCP nguyn thy c hiu chnh vo thng 3 nm 1997 trong RFC 2131, vn gi li tn Dynamic Host Configuration Protocol. Trong chun ny nh ngha thm mt loi thng ip DHCP mi cho php cc my ang c a ch IP c th gi yu cu cp thm thng tin cu hnh. ng thi n cng to ra mt vi thay i nh cho giao thc ny. T lc ti nay, c nhiu RFC khc lin quan ti DHCP c xut bn, phn ln chng hoc l ch nh nhng loi DHCP Option mi (mt loi thng tin khc m DHCP servers c th gi cho DHCP client) hoc l chnh li cch m DHCP c s dng trong cc ng dng. 4.6. Giao thc IP (Internet Protocol)

4.6.1. c im chung ca IP Nhim v chnh ca giao thc IP l cung cp kh nng kt ni cc mng con thnh lin kt mng truyn d liu, vai tr ca IP l vai tr ca giao thc tng mng trong m hnh OSI. Giao thc IP l mt giao thc kiu khng lin kt (connectionlees) c ngha l khng cn c giai on thit lp lin kt trc khi truyn d liu. S a ch ha nh danh cc trm (host) trong lin mng c gi l a ch IP 32 bits (32 bit IP address). Mi giao din trong 1 my c h tr giao thc IP u phi c gn 1 a ch IP (mt my tnh c th gn vi nhiu mng do vy c th c nhiu a ch IP). a ch IP gm 2 phn: a ch mng (netid) v a ch my

82

(hostid). Mi a ch IP c di 32 bits c tch thnh 4 vng (mi vng 1 byte), c th biu th di dng thp phn, bt phn, thp lc phn hay nh phn. Cch vit ph bin nht l dng k php thp phn c du chm (dotted decimal notation) tch cc vng. Mc ch ca a ch IP l nh danh duy nht cho mt my tnh bt k trn lin mng. Do t chc v ln ca cc mng con (subnet) ca lin mng c th khc nhau, ngi ta chia cc a ch IP thnh 5 lp, k hiu l A, B, C, D v E. Trong lp A, B, C cha a ch c th gn c. Lp D dnh ring cho lp k thut multicasting. Lp E c dnh nhng ng dng trong tng lai. Netid trong a ch mng dng nhn dng tng mng ring bit. Cc mng lin kt phi c a ch mng (netid) ring cho mi mng. y cc bit u tin ca byte u tin c dng nh danh lp a ch (0 - lp A, 10 - lp B, 110 - lp C, 1110 - lp D v 11110 - lp E). y ta xt cu trc ca cc lp a ch c th gn c l lp A, lp B, lp C Cu trc ca cc a ch IP nh sau: Mng lp A: a ch mng (netid) l 1 Byte v a ch host (hostid) l 3

byte. Mng lp B: a ch mng (netid) l 2 Byte v a ch host (hostid) l 2

byte. Mng lp C: a ch mng (netid) l 3 Byte v a ch host (hostid) l 1

byte. 0 1 Lp A 0 7 netid 8 15 16 Hostid 23 24 31

Lp B 1 0 Lp C 1 1 0 Lp D 1 1 1 0 Lp E 1 1 1 1 0

netid netid (network identifier)

hostid (host identifier) Hostid

multicast address Reserved for future use Hnh 4.6. Cu trc ca cc lp a ch IP 83

Lp A cho php nh danh ti 126 mng, vi ti a 16 triu host trn mi mng. Lp ny c dng cho cc mng c s trm cc ln. Lp B cho php nh danh ti 16384 mng, vi ti a 65534 host trn mi mng. Lp C cho php nh danh ti 2 triu mng, vi ti a 254 host trn mi mng. Lp ny c dng cho cc mng c t trm. Mt s a ch c tnh cht c bit: Mt a ch c hostid = 0 c dng hng ti mng nh danh bi vng netid. Ngc li, mt a ch c vng hostid gm ton s 1 c dng hng ti tt c cc host ni vo mng netid, v nu vng netid cng gm ton s 1 th n hng ti tt c cc host trong lin mng 00001010 00001010 00001010 00001010 = 10.0.0 (lp A) netid = 10 10000000 00000011 00000010 00000011 = 128.3.2.3 (lp B) netid = 128.3 hostid = 2.3 11000000 00000000 00000001 11111111 = 192.0.1.255 (lp C) Netid = 192.0.1 hostid = 255 hng ti tt c cc host Hnh 4.7. V d cu trc cc lp a ch IP Cn lu rng cc a ch IP c dng nh danh cc host v mng tng mng ca m hnh OSI, v chng khng phi l cc a ch vt l (hay a ch MAC) ca cc trm trn mt mng cc b (Ethernet, Token Ring.). Trong nhiu trng hp, mt mng c th c chia thnh nhiu mng con (subnet), lc c th a thm cc vng subnetid nh danh cc mng con. Vng subnetid c ly t vng hostid, c th i vi lp A, B, C nh v d sau: Bit 0 7 8 15 16 Netid Subnetid Netid Netid 23 24 26 27 Hostid hostid Subnetid hostid 31 (Lp A) (Lp B) (Lp C)

Subnetid

Hnh 4.8. V d a ch khi b sung vng subnetid 84

n v d liu dng trong IP c gi l gi tin (datagram), c khun dng Bit 0 3 4 7 8 15 16 VER IHL Type of service Identification Flags Time to live Protocol Source address Destintion address Option + Padding Data 31 Fragment offset

Hnh 4.9. Dng thc ca gi tin IP ngha ca thng s nh sau: VER (4 bits): ch version hin hnh ca giao thc IP hin c ci t, Vic c ch s version cho php c cc trao i gia cc h thng s dng version c v h thng s dng version mi. IHL (4 bits): ch di phn u (Internet header Length) ca gi tin datagram, tnh theo n v t ( 32 bits). Trng ny bt but phi c v phn u IP c th c di thay i ty . di ti thiu l 5 t (20 bytes), di ti a l 15 t hay l 60 bytes. Type of service (8 bits): c t cc tham s v dch v nhm thng bo cho mng bit dch v no m gi tin mun c s dng, chng hn u tin, thi hn chm tr, nng sut truyn v tin cy. Hnh sau cho bit ngh ca trng 8 bits ny. 0 1 2 Precedence 3 D 4 T 5 R 6 7 Reserved

o Precedence (3 bit): ch th v quyn u tin gi datagram, n c gi tr t 0 (gi tin bnh thng) n 7 (gi tin kim sot mng). o D (Delay) (1 bit): ch tr yu cu trong D = 0 gi tin c tr bnh thng D = 1 gi tin tr thp o T (Throughput) (1 bit): ch thng lng yu cu s dng truyn gi tin vi la chn truyn trn ng thng sut thp hay ng thng sut cao. 85

T = 0 thng lng bnh thng T = 1 thng lng cao o R (Reliability) (1 bit): ch tin cy yu cu R = 0 tin cy bnh thng R = 1 tin cy cao Total Length (16 bits): ch di ton b gi tin, k c phn u tnh theo n v byte vi chiu di ti a l 65535 bytes. Hin nay gii hn trn l rt ln nhng trong tng lai vi nhng mng Gigabit th cc gi tin c kch thc ln l cn thit. Identification (16 bits): cng vi cc tham s khc (nh Source Address v Destination Address) tham s ny dng nh danh duy nht cho mt datagram trong khong thi gian n vn cn trn lin mng. Flags (3 bits): lin quan n s phn on (fragment) cc datagram, Cc gi tin khi i trn ng i c th b phn thnh nhiu gi tin nh, trong trng hp b phn on th trng Flags c dng iu khin phn on v ti lp ghp b d liu. Ty theo gi tr ca Flags s c ngha l gi tin s khng phn on, c th phn on hay l gi tin phn on cui cng. Trng Fragment Offset cho bit v tr d liu thuc phn on tng ng vi on bt u ca gi d liu gc. ngha c th ca trng Flags l: 0 O 1 2 DF MF

bit 0: reserved - cha s dng, lun ly gi tr 0. bit 1: (DF) = 0 (May Fragment) = 1 (Don't Fragment) bit 1: (DF) = 0 (May Fragment) = 1 (Don't Fragment) Fragment Offset (13 bits): ch v tr ca on (fragment) trong datagram tnh theo n v 8 bytes, c ngha l phn d liu mi gi tin (tr gi tin cui cng) phi cha mt vng d liu c di l bi s ca 8 bytes. iu ny c ngha l phi nhn gi tr ca Fragment offset vi 8 tnh ra lch byte.

86

Time to Live (8 bits): qui nh thi gian tn ti (tnh bng giy) ca gi tin trong mng trnh tnh trng mt gi tin b qun trn mng. Thi gian ny c cho bi trm gi v c gim i (thng qui c l 1 n v) khi datagram i qua mi router ca lin mng. Thi lng ny gim xung ti mi router vi mc ch gii hn thi gian tn ti ca cc gi tin v kt thc nhng ln lp li v hn trn mng. Sau y l 1 s iu cn lu v trng Time To Live: Nt trung gian ca mng khng c gi 1 gi tin m trng ny c gi tr= 0. Mt giao thc c th n nh Time To Live thc hin cuc ra tm ti nguyn trn mng trong phm vi m rng. Mt gi tr c nh ti thiu phi ln cho mng hot ng tt.

Protocol (8 bits): ch giao thc tng trn k tip s nhn vng d liu trm ch (hin ti thng l TCP hoc UDP c ci t trn IP). V d: TCP c gi tr trng Protocol l 6, UDP c gi tr trng Protocol l 17

Header Checksum (16 bits): M kim sot li ca header gi tin IP. Source Address (32 bits): a ch ca my ngun. Destination Address (32 bits): a ch ca my ch Options ( di thay i): khai bo cc la chn do ngi gi yu cu (tu theo tng chng trnh).

Padding ( di thay i): Vng m, c dng m bo cho phn header lun kt thc mt mc 32 bits.

Data ( di thay i): Trn mt mng cc b nh vy, hai trm ch c th lin lc vi nhau nu chng bit a ch vt l ca nhau. Nh vy vn t ra l phi thc hin nh x gia a ch IP (32 bits) v a ch vt l (48 bits) ca mt trm.

4.6.2. Cc bc hot ng ca giao thc IP Nu a ch ch ca gi tin IP khng nm trn cng mng vi my ch ngun th giao thc IP trong my ch hng gi tin n b nh tuyn ni b. Nu b nh tuyn ny khng ni n mng ch, gi tin s c gi n mt b nh tuyn khc. C nh 87

th cho n khi ti trm ch. Vic quy nh truyn theo ng truyn no ca router da trn bng ng truyn (routing table). Cc b nh tuyn c th pht hin: Mt mng mi c thm vo lin mng ng dn n cc trm ch b hng

Cc bc thc hin bi mt thc th IP nh sau: i vi thc th IP my ngun, khi nhn c mt yu cu gi t tng trn, n thc hin cc bc sau y: - To mt IP datagram da trn tham s nhn c. - Tnh checksum v ghp vo header ca gi tin. - Ra quyt nh chn ng: hoc l trm ch nm trn cng mng hoc mt gateway s c chn cho chng tip theo. - Chuyn gi tin xung tng di truyn qua mng. i vi router, khi nhn c mt gi tin i qua, n thc hin cc ng tc sau: - Tnh chesksum, nu sai th loi b gi tin. - Gim gi tr tham s Time - to Live. nu thi gian ht th loi b gi tin. - Ra quyt nh chn ng. - Phn on gi tin, nu cn. - Kin to li IP header, bao gm gi tr mi ca cc vng Time - to Live, Fragmentation v Checksum. - Chuyn datagram xung tng di chuyn qua mng. Cui cng khi mt datagram nhn bi mt thc th IP trm ch, n s thc hin bi cc cng vic sau: - Tnh checksum. Nu sai th loi b gi tin. - Tp hp cc on ca gi tin (nu c phn on) - Chuyn d liu v cc tham s iu khin ln tng trn. 4.7. ICMP (Internet Control Message Protocol) Giao thc IP khng c c ch kim sot li v kim sot lung d liu. Cc nt mng cn bit tnh trng cc nt khc, cc gi d liu pht i c ti ch hay khng

88

Cc chc nng chnh: ICMP l giao thc iu khin ca tng IP, s dng trao i cc thng tin iu khin dng d liu, thng bo li v cc thng tin trng thi khc ca b giao thc TCP/IP. iu khin lu lng (Flow Control): Khi cc gi d liu n qu nhanh, thit b ch hoc thit b nh tuyn gia s gi mt thng ip ICMP tr li thit b gi, yu cu thit b gi tm thi ngng vic gi d liu. Thng bo li: Trong trng hp khng ti c a ch ch th h thng s gi mt thng bo li "Destination Unreachable". nh hng li cc tuyn (Redirect Router): Mt Router gi mt thng ip ICMP cho mt trm thng bo nn s dng Router khc. Thng ip ny c th ch c dng khi trm ngun trn cng mt mng vi hai thit b nh tuyn. Kim tra cc trm xa: Mt trm c th gi mt thng ip ICMP "Echo" kim tra trm c hot ng hay khng. Nhm Loi bn tin Hi v phc p Echo (Echo Request v Echo Reply) Hi v phc p nhn thi gian Thng ip truy vn (ICMP Queries) (Timestamp Request v Timestamp Reply) Yu cu v phc p mt n a ch (Address mask Request v Address mask Reply) Yu cu v qung b b nh tuyn (Router soliciation v Router advertisement) Khng th t ti ch (Destination Unreachable) Thng ip thng bo li (ICMP Error Reports) Yu cu ngng hoc gim tc pht (Source Quench) nh hng li (Redirection) Vt ngng thi gian (Time Exceeded) Type 8/0 13/14 17/18 10/9 3 4 5 11

Cc loi thng ip ICMP: Cc thng ip ICMP c chia thnh hai nhm: cc thng ip truy vn v cc thng ip thng bo li. Cc thng ip truy vn gip cho ngi qun tr mng nhn cc thng tin xc nh t mt node mng khc. Cc thng ip thng bo li lin quan n cc vn m b nh tuyn hay trm pht hin ra 89

khi x l gi IP. ICMP s dng a ch IP ngun gi thng ip thng bo li cho node ngun ca gi IP. 4.8. Tn v a ch Cho n by gi, chng ta vn dng a ch nh danh cc host. Trong khi rt thun tin cho vic x l ca cc router, cc a ch s khng thn thin vi ngi dng lm. V l do ny, cc host thng c gn cho mt ci tn thn thin v dch v tn c s dng nh x t ci tn thn thin vi ngi dng ny sang a ch s vn rt thn thin vi cc router. Dch v nh vy thng l ng dng u tin c ci t trong mt mng my tnh do n cho php cc ng dng khc t do nh danh cc host bng tn thay v bng a ch. Dch v tn thng c gi l phn trung gian (middleware) v n lp y khong cch gia cc ng dng khc v lp mng pha di. Tn host v a ch host khc nhau hai im quan trng. Th nht, tn host thng c di thay i v d gi nh, v th n gip ngi dng d nh hn. Th hai, tn thng khng cha thng tin g gip mng nh v (chuyn cc gi tin n) host. a ch, ngc li, li hm cha thng tin vch ng trong . Trc khi i vo chi tit cch thc t tn cho cc host trong mng nh th no, chng ta i nh ngha mt s thut ng trc: Khng gian tn (name space) nh ngha tp cc tn c th c. Mt khng gian tn c th l phng (flat) mt tn khng th c chia thnh cc thnh phn nh hn, hoc phn cp. H thng tn duy tr mt tp cc nh x (collection of bindings) t tn sang gi tr. Gi tr c th l bt c th g chng ta mun h thng tn tr v khi ta cp cho n mt tn nh x; trong nhiu trng hp gi tr chnh l a ch host. Mt c ch phn gii (resolution mechanism) l mt th tc m khi c gi vi tham s l mt tn, s tr v mt gi tr tng ng. Mt server tn (name server) l mt kt qu ci t c th ca mt c ch phn gii lun sn dng trn mng v c th c truy vn bng cch gi n n mt thng ip. Mng Internet c sn mt h thng t tn c pht trin tt, gi l h thng tn min (domain name system DNS). V th chng ta s dng DNS lm c s tho lun v vn t tn cho cc host. 90

Khi ngui dng a mt tn host n mt ng dng (c th tn host l mt phn ca mt tn hn hp nh a ch email chng hn), ng dng ny s lin h vi h thng tn dch tn host sang a ch host. Sau ng dng lin to mt ni kt n host thng qua giao thc TCP chng hn. Hin trng c m t nh sau: 2 et.vinhuni.edu.vn Name server 203.162.36.138 3 Ngi dng 1 hsp@et.vinhuni.edu.vn 4

Mail Program 203.162.36.138 TCP 203.162.36.138 TCP

Hnh 4.10. Tn my c dch sang a ch (trnh t 1-5) 4.8.1. Min phn cp DNS ci t khng gian tn phn cp dng cho cc i tng trn Internet. Cc tn DNS c x l t phi sang tri, s dng cc du chm (.) lm k t ngn cch. (Mc d cc tn DNS c x l t phi qua tri, ngi dng thng c chng t tri sang phi). V d tn min ca mt host l mail.et.vinhuni.edu.vn. Ch rng cc tn min c s dng t tn cc i tng trn Internet, khng phi ch c dng t tn my. Ta c th mng tng cu trc phn cp ca DNS ging nh hnh dng cy. Hnh sau l mt v d. edu com cisco yahoo gov mil org net uk vn

edu vinhuni bku et mail www kt vl

Hnh 4.11. Cy phn cp tn min

91

C th thy rng, cy phn cp khng qu rng mc u tin. Mi quc gia c mt tn min, ngoi ra cn c 6 min ln khc gm: edu, com, gov, mil, org v net. Su min ln ny nm M. Nhng tn min khng ch ra tn nc mt cch tng minh th mc nhin l nm M. 4.8.2. Cc server phc v tn Mt cu trc tn min phn cp hon chnh ch tn ti trong nim. Vy th trong thc t cu trc phn cp ny c ci t nh th no? Bc u tin l chia cu trc ny thnh cc cy con gi l cc vng (zone). V d, hnh 4.8 ch ra cch thc cu trc phn cp trong hnh 4.7 c chia thnh cc vng nh th no.

edu

com cisco yahoo

gov

mil

org

net

uk

vn

edu vinhuni bku et mail www kt vl

Hnh 4.12. Cu trc min phn cp c chia thnh cc vng Mi mt vng c th c xem l n v qun l mt b phn ca ton h thng phn cp. V d, vng cao nht ca h thng phn cp c qun l bi NIC (Network Information Center), vng et c qun l bi Trng i hc Vinh. Mt vng lun c mi lin h n cc n v ci t c bn trong DNS - cc server tn. Thng tin cha trong mt vng c thit lp ti hai hoc nhiu server tn. Mi server tn c th truy xut c qua mng Internet. Client gi yu cu n server tn, server tn s tr li cho yu cu . Cu tr li i khi cha thng tin cui cng m client cn, i khi li cha ch im n mt server tn khc m client nn gi cu hi n . V th, theo cch nhn thin v ci t, ngi ta c th ngh v DNS c ci t bng cu trc phn cp cc server tn hn l bng cu trc phn cp cc min.

92

Server tn gc

Server tn ca Vit nam

:::

Server tn ca H Vinh

:::
Server tn ca Khoa ET

Hnh 4.13. Cu trc phn cp ca cc server tn rng mi vng c ci t trong hai hoc nhiu server tn vi l do d phng; ngha l nu mt server b cht s cn cc server khc thay th. Mt khc, mt server tn cng c th c dng ci t nhiu hn mt vng. Mi server tn qun l thng tin v mt vng di dng mt tp cc mu tin ti nguyn (resource record). Mi mu tin ti nguyn l mt nh x t tn sang gi tr (name to value binding), c th hn l mt mu tin gm 5 trng: (Tn, Gi tr, Kiu, Lp, TTL) Cc trng Tn v Gi tr l nhng g chng ta mun c, ngoi tra trng Kiu ch ra cch thc m Gi tr c thng dch. Chng hn, trng Kiu = A ch ra rng Gi tr l mt a ch IP. V th cc mu tin kiu A s ci t kiu nh x t tn min sang a ch IP. V d nh mu tin: (ns.vinhuni.edu.vn, 203.162.41.166, A, IN) ch ra rng a ch IP ca host c tn ns.vinhuni.edu.vn l 203.162.41.166. Ngoi ra cn c nhng kiu khc: NS: Trng Gi tr ch ra tn min ca my tnh ang chy dch v tn, v dch v c kh nng thng dch cc tn trong mt min c th. V d mu tin: (vinhuni.edu.vn, ns.vinhuni.edu.vn, NS, IN) ch ra rng server tn ca min vinhuni.edu.vn c tn l ns.vinhuni.edu.vn.

93

CNAME: Trng Gi tr ch ra mt ci tn gi ca mt host no . Kiu ny c dng t thm b danh cho cc host trong min. MX: Trng Gi tr ch ra tn min ca host ang chy chng trnh mail server m server c kh nng tip nhn nhng thng ip thuc mt min c th. V d mu tin: (vinhuni.edu.vn, mail. vinhuni.edu.vn, MX, IN) ch ra rng host c tn mail.vinhuni.edu.vn l mail server ca min vinhuni.edu.vn. Trng Lp c s dng nhm cho php thm vo nhng thc th mng khng do NIC qun l. Ngy nay, lp c s dng rng ri nht l loi c Internet s dng; n c k hiu l IN. Cui cng trng TTL ch ra mu tin ti nguyn ny s hp l trong bao lu. Trng ny c s dng bi nhng server ang tr tm cc mu tin ca server khc; khi trng TTL ht hn, cc mu tin cha trng TTL ht hn s b cc server xa khi cache ca mnh. hiu r hn cch thc cc mu tin ti nguyn c th hin trong cu trc phn cp, hy xem v d c v trong hnh 4.9. n gin ha vn , chng ta b qua trng TTL v cung cp thng tin tng ng cho mt server tn lm nhim v qun l cho mt vng. u tin, server tn gc (root name server) s cha mt mu tin NS cho mi server cp hai. N cng cha mt mu tin A thng dch t mt tn server cp hai sang a ch IP ca n. Khi c ghp vi nhau, hai mu tin ny ci t mt cch hiu qu mt con tr t server gc n mi server cp hai ca n. (edu.vn, dns1.vnnic.net.vn, NS, IN);thng tin v min con edu.vn lu my dns1.vnnic.net.vn (dns1.vnnic.net.vn, 203.162.57.105, A, IN);my dns1.vnnic.net.vn c a ch 203.162.57.105 (cisco.com, ns1.cisco.com, NS, IN) K tip, min edu.vn c mt server tn hin hu ti my dns1.vnnic.net.vn v server ny li cha cc mu tin sau: (vinhuni.edu.vn, ns. vinhuni.edu.vn, NS, IN) (ns. vinhuni.edu.vn, 203.162.41.166, A, IN) Cui cng server ns.vinhuni.edu.vn li cha thng tin v cc my tnh ca Trng i hc Vinh cng nh cc min con ca Trng i hc Vinh Cui cng server ns.vinhuni.edu.vn li cha thng tin v cc my tnh ca trng i Hc Vinh cng nh cc min con ca Trng i Hc Vinh 94

(et. vinhuni.edu.vn, ns.et. vinhuni.edu.vn, NS, IN) (ns.et. vinhuni.edu.vn, 203.162.36.144, A, IN) (vinhuni.edu.vn, mail. vinhuni.edu.vn, MX, IN) (mail. vinhuni.edu.vn, 203.162.139.21, A, IN) (www. vinhuni.edu.vn, mail. vinhuni.edu.vn, CNAME, IN) 4.8.3. Internet Domain Name Ch rng trn l thuyt cc mu tin c th c dng nh ngha bt k kiu i tng no, DNS li thng c s dng nh danh cc host v site. DNS khng c dng nh danh c nhn con ngi hoc cc i tng khc nh tp tin hay th mc, vic nh danh ny c thc hin trong cc h thng phc v tn khc. V d X.500 l h thng nh danh ca ISO c dng nh danh con ngi bng cch cung cp thng tin v tn, chc v, s in thoi, a ch, v . X.500 chng t l qu phc tp nn khng c h tr bi cc search engine ni ting hin nay. Tuy nhin n li l ngun gc pht sinh ra chun LDAP (Lightweight Directory Access Protocol). LDAP vn l thnh phn con ca X.500 c thit k lm phn front-end cho X.500. Ngy nay LDAP ang tr nn ph bin nht l cp cng ty, t chc ln, ng vai tr l h thng hc v qun l thng tin v ngi dng ca n. 4.8.4. Phng php phn tch tn Vi mt h thng phn cp cc server tn trnh by, by gi chng ta i tm hiu cch thc mt khch hng giao tip vi cc server ny phn tch cho c mt tn min thnh a ch. Gi s mt khch hng mun phn tch tn min www.vinhuni.edu.vn, u tin khch hng ny s gi yu cu cha tn ny n server tn gc. Server gc khng th so khp tn theo yu cu vi cc tn m n cha, lin tr li cho khch hng mt mu tin kiu NS cha edu.vn. Server gc cng tr v tt c cc mu tin c lin quan n mu tin NS va ni, trong c mu tin kiu A cha a ch ca dns1.vnnic.vnn.vn. Khch hng cha c thng tin cui cng m n mun, tip tc gi yu cu n server tn ti a ch 203.162.57.105. Server tn th hai ny li khng th so khp tn theo yu cu vi cc tn m n cha, tip tc tr li cho khch hng mt mu tin loi NS cha tn vinhuni.edu.vn cng vi mu tin kiu A tng ng vi tn server l ns.vinhuni.edu.vn. Khch hng li tip tc gi yu cu n server tn

95

ti a ch 203.162.41.166 v ln ny nhn c cu tr li cui cng c kiu A cho tn www.vinhuni.edu.vn. V d trn chc chn s li nhiu cu hi v qu trnh phn gii tn. Cu hi thng c t ra l: Lc khi u, lm sao khch hng c th nh v c server gc? y l bi ton c bn t ra cho mi h thng phc v tn v cu tr li l: h thng phi t thn vn ng c c thng tin v cc server gc! Trong tnh hung ca h thng DNS, nh x t tn sang a ch ca mt hay nhiu server gc c ph bin cho mi ngi, ngha l nh x c loan bo thng qua cc phng tin truyn thng khc nm ngoi h thng tn. Tuy nhin, trong thc t khng phi tt c khch hng u bit v cc server gc. Thay vo , chng trnh khch hng chy trn mi host trong Internet c khi ng vi cc a ch ly t server tn cc b. V d, tt c cc host trong Khoa ET ca Trng i Hc Vinh u bit server tn ni b ang chy trn my ns.et.vinhuni.edu.vn. n lt server tn cc b ny li cha cc mu tin ti nguyn cho mt hoc nhiu server gc ca n, v d: ( . , a.root-servers.net, NS, IN) (a.root-server.net, 198.41.0.4, A, IN) Trong v d trn, server tn cc b c thng tin v mt server tn gc ca n (ch min gc c k hiu bng du chm) l a.root-servers.net, a ch IP tng ng ca server gc ny l 198.41.0.4. T , vic phn gii mt tn min bt u t cu truy vn ca khch hng n server cc b. Nu server cc b khng c sn cu tr li, n s gi cu hi n server t xa dm cho khch hng. 4.9. Tng quan v nh tuyn

4.9.1. Mt s khi nim Routing Protocol Routing protocol: l ngn ng mt router trao i vi router khc chia s thng tin nh tuyn v kh nng n c cng nh trng thi ca mng. c ci t ti cc Router, chng c s dng cho vic xy dng nn bng nh tuyn m bo rng tt c cc Router u c bng Routing table tng thch nhau cng nh ng i n cc mng phi c xc nh trong Routing Table. Routed Protocol

96

N s dng cc bng Routing Table m Routing Protocol xy dng ln m bo vic truyn d liu qua mng mt cch tin cy. V d: IP v IPX. Vng t tr AS (Autonomous System) Mng Internet c chia thnh cc vng nh hn gi l cc vng t tr (Autonomous System AS ). AS bao gm mt tp hp cc mng con c kt ni vi nhau bi Router. Mt h thng AS thng thng thuc quyn s hu ca mt cng ty hay nh cung cp dch v Internet (ISP). V cc h thng AS ny kt ni c vi nhau, nh qun l phi ng k vi c quan qun tr mng trn Internet (Inter NIC) ly c mt s nhn dng AS cho ring mnh. Bn trong mi AS, cc nh qun l c quyn quyt nh loi Router cng nh giao thc nh tuyn cho h thng ca mnh. Bng nh tuyn Mt host hay mt Router phi xem xt bng nh tuyn ca mnh trc khi chuyn gi tin n a ch xa. Bng ny c gn tng ng mi a ch ch vi mt a ch Router cn n chng tip theo.Bng a ch ch trong bng c th bao gm cc a ch mng, mng con, cc h thng c lp. Trong bng nh tuyn c th bao gm mt tuyn mc nh, c biu din bng a ch 0.0.0.0. Bng nh tuyn ca mi giao thc nh tuyn l khc nhau, nhng c th bao gm nhng thng tin sau : a ch ch ca mng, mng con hoc h thng. a ch IP ca Router chng k tip phi n. Giao tip vt l phi s dng i n Router k tip. Mt n mng ca a ch ch. Khong cch n ch (th d : s lng chng n ch). Thi gian (tnh theo giy) t khi Router cp nht ln cui.

Khong cch qun l (Administrative Distance (AD) Administrative Distance c s dng nh gi tin cy ca thng tin

nh tuyn m Router nhn t Router hng xm. AD l mt s nguyn bin i t : 0 n 255; 0 tng ng vi tin cy cao nht v 255 c ngha l khng c lu lng i qua tuyn ny (tc l tuyn ny khng c s dng vn chuyn thng tin ca ngi s dng). Tc l khi mt Router nhn c mt thng tin nh tuyn, thng tin ny c nh gi v mt tuyn hp l c a vo bng nh tuyn ca Router. Thng tin nh tuyn c nh gi da vo AD, gi s Router c ci t nhiu

97

hn mt giao thc nh tuyn th giao thc nh tuyn no c AD nh hn s c Router s dng. Mi giao thc nh tuyn c tng ng mt gi tr AD: Directly 0 Static route 1 RIP 120 OSPF 110 IGRP 100

4.9.2. Nguyn tc nh tuyn Cc giao thc nh tuyn phi t c cc yu cu ng thi sau: Khm ph ng mt topo mng. Xy dng cc ng ngn nht. Kim sot tm tt thng tin v cc mng bn ngoi, c th s dng cc metric khc nhau trong mng cc b. Phn ng nhanh vi s thay i topo mng v cp nht cc cy ng ngn nht. Lm tt c cc iu trn theo nh k thi gian.

4.9.3. Cc thnh phn ca nh tuyn (Components of Routing Data) Routing l qu trnh chuyn tip packet t mt mng ny sang mng khc. Chng chuyn tip packet nh th no? Th nht: bn cn phi bit logical address l g? a ch logic c s dng xc nh host thuc mng no. Th hai: Sau khi nhn packet t mt interface n s quyt nh y packet ra interface tng ng, chuyn tip packet i. a ra quyt nh chnh xc router phi thc hin c cc nhim v sau: Router xc nh xem lu lng m nhn hoc gi chy giao thc lp mng no? IP, IPX hay AppleTalk. Kim tra xem a ch mng ch c trong routing table hay khng: Nu khng tm thy ng n mng ch trong routing table, router s discard packet v gi mt gi ICMP network unreachable v host ngun gi packet. 98

Nu tm thy trong routing table tuyn ng ti mng ch router s forward packet ra interface tng ng. Router s y packet ra buffer ca interface . Kiu encapsulation (ng gi) ca frame lp 2 ca interface : Nu l Ethernet th chy ARP ly a ch lp 2 l MAC Nu l Frame-Relay th chy Inverse ARP hoc static map tm DLCI. Cui cng Outbound interface s a frame xung phng tin truyn dn v forward thng tin n next hop. Packet s tip tc c x l cho n ch cui cng. Routing tables Routing table l mt bng cha cc tuyn ng n cc mng m ngi qun tr cu hnh. Cc bng ny c to ra bng tay theo mun ca ngi qun tr hay bng cch trao i thng tin nh tuyn vi cc router khc. Xy dng bng nh tuyn (Populating the Routing Table) Trc khi tuyn ng c a vo bng nh tuyn, router phi hc v nhng tuyn ng . C hai cch hc tuyn ng: - Statically - Dynamically 4.10. Cc m hnh nh tuyn theo vector khong cch (distance vector routing) Distance vector bao gm nhng loi sau y: - RIP ( Routing Information Protocol ). N c cc c im nh sau: Hop count c s dng tnh metric v xc nh tuyn ng s c la chn. Nu hop count ca mng ln hn 15, RIP khng th xc nh c tuyn ng n mng . Routing updates c broadcast hay multicast sau mi 30s (theo mc nh). - IGRP ( Interior Gateway Routing Protocol ) l 1 giao thc c pht trin ring bi Cisco. N c cc c im sau: Banwidth, delay, load v reliability c s dng tng hp metric. 99

Routing updates c broadcast 90s 1 ln (theo mc nh). IGRP l tin thn ca EIGRP v hin nay hu nh khng c s dng na. - EIGRP l 1 giao thc c pht trin t IGRP. N c cc c im sau: C th s dng unequal-cost load balancing. S dng Diffusing Update Algorithm (DUAL) tnh ton tuyn ng ngn nht. Khng update nh k nh 2 giao thc trn, m n ch update khi c bt k s thay i no trong topo mng. ngha ca distance vector : Nh tn gi ca n, distance vector ngha l cc tuyn ng c qung b nh nhng vector khong cch. Distance c quyt nh bi metric, chng hn nh hop count, v c ch dn 1 cch n gin thng qua next-hop router hay exit interface. Mt router s dng distance vector protocols khng th bit trn vn tuyn ng n ch, thay vo , n ch bit 2 iu sau: n ch cn i qua ng no, hay ni 2 cch n gin l packet cn i qua interface no n ch. Khong cch n ch l bao xa. Nhng thut ton ca giao thc nh tuyn: Chng ta c th hiu 1 cch n gin thut ton y l lut, hay l phng php, qu trnh gii quyt 1 vn . Trong h thng mng, thut ton dng quyt nh tuyn ng i tt nht forward traffic ti ch. Cng c nhng thut ton dng xy dng v duy tr bng dnh tuyn. Li ca 1 giao thc chnh l thut ton. Thut ton dng cho nhng giao thc nh tuyn quyt nh nhng tin trnh sau: Phng php gi v nhn thng tin nh tuyn. Phng php tnh ton ng i tt nht v thm nhng tuyn ng vo bng nh tuyn. Phng php pht hin v phn ng khi c nhng thay i trong topo mng.

100

4.10.1. Nhc li thut ton nh ng Bellman-Ford Thut ton Ford-Bellman tm ng i ngn nht t nh S ti tt c cc nh cn li K hiu D(h)i : ng i ngn nht t node ngun S n node i c ti a h on. dij: trng s trn cnh ni t node i n node j dij = 0 nu i trng j dij = Eij nu i khc j Bc 1: khi ng D(1)N = dSN, N V\{S} Bc 2: cp nht ng i ngn nht D(h+1)N = min {D(h)j + d jN} j V\{S} Bc 3: lp li bc 2 cho n khi khng c ng i mi no ngn hn c tm thy th dng Kt qu D(h)N s l ng i ngn nht t node ngun S n node N V d: Tm ng i ngn nht t node ngun 1 n tt c cc node cn li

4.10.2. nh tuyn tnh v nh tuyn ng nh tuyn (Routing) l 1 qu trnh m Router thc thi v s dng chuyn mt gi tin(Packet) t mt a ch ngun (soucre) n mt a ch ch (destination) trong mng.Trong qu trnh ny Router phi da vo nhng thng tin inh tuyn a ra nhng quyt nh nhm chuyn gi tin n nhng a ch ch nh trc.C hai loi nh tuyn c bn l nh tuyn tnh (Static Route) v nh tuyn ng (Dynamic Route) nh tuyn ng (Dynamic Route) y l mt dng nh tuyn m khi c cu hnh dng ny, Router s s dng nhng giao thc nh tuyn nh RIP(Routing

101

Information Protocol), OSPF(Open Shortest Path Frist), IGRP(Interior Gateway Routing Protocol) thc thi vic nh tuyn mt cch t ng (Automatically) m bn khng phi cu hnh trc tip bng tay. nh tuyn tnh (Static Route) l 1 qu trnh nh tuyn m thc hin phi cu hnh bng tay (manually) tng a ch ch c th cho Router.Mt dng mc nh ca nh tuyn tnh l Default Routes, dng ny c s dng cho cc mng ct (Stub Network) Lnh: ip route Dng cu hnh static route, ta cu hnh bng tay cho bng nh tuyn. Dng mode global configuration C php
ip route <destination-network> <subnet-mask> <address | interface>

Trong : destination-network: l a ch mng cn i ti subnet-mask: subnet mask ca destination-network address: a ch IP ca cng trn router m packet s i ra interface: cng ca router m packet s i ra C php khc:
ip route <destination-network> <subnet-mask> <nexthop-address>

Trong : nexthop-address: l a ch ca interface trn router k tip m packet s gi n. C php ny thng c s dng hn c php trnh by phn trc. u nhc im ca nh tuyn tnh u im ca static route l ngi qun tr c ton quyn iu khin thng tin lu trong routing table v phi lng ph bng thng xy dng nn routing table. Nhc im ca static route l phc tp ca vic cu hnh tng ln khi kch thc ca mng tng ln. Gi s mt mng c N router th ngi qun tr cn phi

102

cu hnh (N-1)*N cu lnh trn tt c cc router. Mt nhc im na ca static route l khng c kh nng thch ng vi nhng mng c cu trc thay i. u nhc im ca nh tuyn ng Dynamic routing l qu trnh m trong giao thc nh tuyn phi tm ra ng tt nht trong mng v duy tr chng. C rt nhiu cch xy dng ln bng nh tuyn mt cch ng. Nhng tt c u thc hin theo quy tc sau: n s khm tt c cc tuyn ng n ch c th v thc hin mt s quy tc nh trc xc nh ra ng tt nht n ch. u im ca dynamic routing l n gin trong vic cu hnh v t ng tm ra nhng tuyn ng thay th nu nh mng thay i. Nhc im ca dynamic routing l yu cu x l ca CPU ca router cao hn l static route. Tiu tn mt phn bng thng trn mng xy dng ln bng nh tuyn. 4.10.3. RIP (Routing Information Protocol) Khi qut. RIP c pht trin trong nhiu nm, bt u t phin bn 1(RIPv1) v hin nay l phin bn 2 (RIPv2). RIPv1 l mt giao thc nh tuyn theo Distance Vector, s dng s hop lm metric xc nh hng v khong cch cho bt k mt lin kt no trong mng. Qung b ton b bng nh tuyn ca n cho cc router lng ging theo nh k l 30 giy. RIPv1 l giao thc nh tuyn theo lp a ch. Khi RIP router nhn thng tin v mt mng no t mt cng, trong thng tin nh tuyn khng c thng tin v subnet mask i km. Do , router s ly subnet mask ca cng p dng cho a ch mng m n nhn c t cng ny. Nu subnet mask ny khng ph hp th n s ly subnet mask mc nh theo lp a ch p dng cho a ch mng m n nhn c. a ch lp A c subnet mask mc nh l : 255.0.0.0. a ch lp B c subnet mask mc nh la : 255.255.0.0. a ch lp C c subnet mask mc nh la : 255.255.255.0.

Khi c mt gi tin chuyn n, nu c nhiu ng dn n mt ch, RIP s chn ng dn c s hop nh nht. Tuy nhin s hop ch l mt metric c dng bi RIP, nn giao thc ny khng phi lc no cng chn chnh xc ng dn n

103

ch. RIP cng khng th nh tuyn cho mt gi vi metric qu 15 hop. RIPv1 yu cu tt c cc thit b trn mng s dng cng subnet mask, v n khng cha thng tin subnet mask trong cc cp nht nh tuyn. iu ny c xem nh Classful Routing. Cc c im chnh ca RIP: L giao thc nh tuyn theo Distance Vector. Thng tin nh tuyn l s lng hop. Nu gi d liu n mng ch c s lng hop ln hn 15 th gi d liu s b hy b. Chu k cp nht mc nh l 30 giy. RIPv1 l giao thc nh tuyn c s dng ph bin v mi router u c h tr giao thc ny. RIPv1 c ph bin v tnh n gin v tnh tng thch ton cu ca n, n c th chia ti ra ti a l 6 ng c metric bng nhau. RIP trnh nh tuyn loop n v hn bng cch gii hn s lng hop ti a cho php t my gi n my nhn. S lng hop cho mi con ng l 15. i vi cc con ng m router nhn c t thng tin cp nht ca router lng ging, router s tng ch s hop ln 1 v router xem bn thn n cng l mt hop trn ng i. Nu sau khi tng ch s hop ln 1 m ch s ny ln hn 15 th router s xem nh mng ch tng ng vi con ng ny khng n. Ngoi ra, RIP cng c nhiu c tnh tng t nh giao thc nh tuyn khc. V d: RIP cng c split horizon v thi gian holddown trnh cp nht thng tin nh tuyn khng chnh xc. * c im Ca RIPv2: RIPv2 cung cp nh tuyn c nh, truyn thng tin c nh v truyn thng tin subnet mask trong cc cp nht nh tuyn. iu ny cng c gi l Classless Routing. Vi cc giao thc nh tuyn Classless, cc mng con khc nhau trong cng mt mng c th c cc subnet mask khc nhau, iu ny c gi l thao tc subnet mask c chiu di thay i VLSM (Variable-Length Subnet Masking). RIPv2 c pht trin t RIPv1 nn vn gi cc c im nh RIPv1: L mt giao thc theo Distance Vector, s dng s lng hop lm thng s nh tuyn. S dng thi gian holddown chng loop vi thi gian mc nh l 180 giy. S dng c ch split horizon chng loop. S hop ti a l 16. 104

Tuy nhin, vi phin bn RIPv2 th RIP tr thnh giao thc nh tuyn khng theo lp a ch. RIPv2 c h tr vic xc minh thng tin nh tuyn. Chng ta c th cu hnh cho RIPv2 gi v nhn thng tin xc minh trn cng giao tip ca router bng m ha MD5 hay khng m ha. RIPv2 gi thng tin nh tuyn theo a ch multicast 224.0.0.9. * So snh RIPv1 v RIPv2 Ging nhau: RIP s dng thut ton nh tuyn theo Distance Vector. Nu c nhiu ng n cng mt ch th RIP s chn ng c s hop t nht. V vy, i khi con ng m RIP chn cha hn l nhanh nht n ch. RIPv1 cho php cc router cp nht bng nh tuyn ca chng theo chu k mc nh l 30 giy. Vic gi thng tin nh tuyn cp nht lin tc nh vy gip cho mng c xy dng nhanh chng. trnh loop v tn, RIP gii hn s hop ti a chuyn gi tin l 16 hop. Nu mt mng ch nhiu hn 16 hop th mng xem nh khng ti c v gi tin n s b hy. iu ny lm gii hn kh nng m rng ca RIP. RIPv1 s dng c ch split horizon chng lp vng. Vi c ch ny, khi gi thng tin nh tuyn ra mt cng, RIPv1 router khng gi ngc tr li cc thng tin nh tuyn m n hc c t chnh cng . RIPv1 cn s dng thi gian holdown. Trong sut khong thi gian holdown, router s khng cp nht tt c cc thng tin c s nh tuyn xu hn v mng . Khc nhau: RIPv1 nh tuyn theo lp a ch. Khng gi thng tin v subnet-mask trong thng tin nh tuyn. Khng h tr VLSM. V vy tt c cc mng trong h thng RIPv1 phi cng subnet mask. Khng c c ch xc minh thng tin nh tuyn. Gi qung b theo a ch 255.255.255.255 Vi C Ch Ca RIP Split Horizon : c ch ny dng chng loop bng cch, gi s router A nhn thng tin nh tuyn t router B v mng X, th sau khi a vo bng routing RIPv2 nh tuyn khng theo lp a ch. C gi thng tin v subnet mask trong thng tin nh tuyn. C h tr VLSM. Nn cc mng trong h thng RIPv2 c th c chiu di subnet mask khc nhau. C c ch xc minh thng tin nh tuyn. Gi qung b theo a ch 224.0.0.9 nn hiu qu hn.

105

table, router A s khng broadcast thng tin nh tuyn ca mng X v li cho router B na. Route Poisoning : gi s mng X kt ni trc tip vi router B v thng tin nh tuyn v mng X c router B gi cho router A. Nu nh mng X b disconect th ngay lp tc router B s gi ngay thng tin nh tuyn cho router A v mng X vi metric l 16. Poison Reverse : c ch ny s gn lin vi c ch Route Poisoning, khi router A nhn c thng tin nh tuyn t router B v mng X vi metric l 16 th router A s gi li thng tin nh tuyn v mng X cho router B vi metric l 16 chc chn rng mng X b disconect. (lu l khi c ch Route Poisoning v Poison Reverse hot ng th c ch Split Horizon s c tm dng, y l trng hp c bit v metric = 16). 4.11. Cc m hnh nh tuyn theo ng ngn nht (shostest path routing) 4.11.1. Nhc li thut ton nh ng Dijkstra Mc ch l tm ng i ngn nht t mt nt cho trc trn th n cc nt cn li trn mng. Gii thut c m t nh sau: Gi: S l nt ngun cho trc N: l tp hp tt c cc nt xc nh c ng i ngn nht t S. Di : l di ng i ngn nht t nt ngun S n nt i. lij : l gi ca cnh ni trc tip nt i vi nt j, s l nu khng c cnh ni trc tip gia i v j. Pj l nt cha ca ca nt j.

Bc 1: Khi to N={S}; Ds = 0;

Vi iS: Di = lsi , P i=S Bc 2: Tm nt gn nht k tip Tm nt i N tho Di = min (Dj) vi j N Thm nt i vo N. 106

Nu N cha tt c cc nt ca th th dng. Ngc li sang Bc 3 Bc 3: Tnh li gi ng i nh nht Vi mi nt j N: Tnh li Dj= min{Dj, Di+ lij} ; Pj=i; Tr li Bc 2 V d: Cho mng c hnh trng nh th hnh v: Tm ng i ngn nht t nt 1 n cc nt cn li. Bi gii: p dng gii thut ta c: S=1 Cc bc thc hin c m t nh sau Ln lp N D2 3 3 3 D3 2 2 D4 5 4 4 4 4 7 5 5 5 5 3 3 3 D5 D6 P2 1 1 1 P3 1 1 P4 1 3 3 3 3 P5 1 1 2 6 6 6 P6 1 3 3 3 3 1 2 1 5 4 4 2 3 2 3 5 1 6 2

Khi to {1} 1 2 3 4 5 {1,3} {1,3,2} {1,3,2,6} {1,3,2,6,4} {1,3,2,6,4,5}

T kt qu trn ta v c cy c ng i ngn nht t nt s 1 n cc nt cn li nh hnh bn. T cy ng i ngn nht ny, ta xc nh c rng: i n cc router router 4, 5, 6 , bc k tip router 1 cn gi gi tin n l router s 3 (next hop). 1 4 2 5 2 2 2 3 1 6

Ch , ng ngn nht ny ch ng theo hng t nt s 1 v cc nt cn li v ch ng cho nt s 1 m thi.

107

Thng thng gii thut Dijkstra c s dng theo m hnh chn ng tp trung. Trong , Trung tm iu khin mng s tm cy ng i ngn nht cho tng router trn mng v t xy dng bng chn ng ti u cho tt c cc router. 4.11.2. OSPF (tp trung vo protocol, bn tin) Tng quan v OSPF OSPF l mt giao thc nh tuyn theo trng thi ng lin kt c trin khai da trn cc chun m. OSPF c m t trong nhiu chun ca IETF (Internet Engineering Task Force). Chun m y c ngha l OSPF hon ton m vi cng cng, khng c tnh c quyn. Nu so snh vi RIPv1 v RIPv2 l mt giao thc ni th IGP tt hn v kh nng m rng ca n. RIP ch gii hn trong 15 hop, hi t chm v i khi cn chn ng c tc chm v khi quyt nh chn ng n khng quan tm n cc yu quan trng khc nh bng thng chng hn. OSPF khc phc c cc nhc im ca RIP v n l mt giao thc nh tuyn mnh, c kh nng mi rng, ph hp vi cc h thng mng hin i. OSPF c th cu hnh n vng s dng cho cc mng nh. So Snh OSPF Vi Giao Thc nh Tuyn Theo Distance Vector Router nh tuyn theo trng thi ng lin kt c mt c s y v cu trc h thng mng. Chng ch thc hin trao i thng tin v trng thi ng lin kt lc khi ng v khi h thng mng c s thay i. Chng khng pht qung b bng nh tuyn theo nh k nh cc router nh tuyn theo distance vector. Do , cc router nh tuyn theo trng thi ng lin kt s dng t bng thng hn cho hot ng duy tr bng nh tuyn. RIP ph hp vi cc mng nh v ng tt nht i vi RIP l ng c s hop t nht. OSPF th ph hp vi mng ln, c kh nng m rng, ng i tt nht ca OSPF c xc nh da trn tc ca ng truyn. RIP cng nh cc giao thc nh tuyn theo distance vector khc u s dng thut ton chn ng n gin. Cn thut ton SPF th phc tp. Do , nu router chy theo giao thc nh tuyn theo distance vector th s t tn b nh v cn nng lc x l thp hn so vi khi chy OSPF. OSPF chn ng da trn chi ph c tnh t tc ca ng truyn. ng truyn c tc cng cao th chi ph OSPF tng ng cng thp. OSPF chn ng tt nht t cy SPF. 108

OSPF bo m khng b nh tuyn lp vng. Cn giao thc nh tuyn theo distance vector vn c th b loop. Nu mt kt ni khng n nh, chp chn, vic pht lin tc cc thng tin v trng thi ca ng kin kt ny s dn n tnh trng cc thng tin qung co khng ng b lm cho kt qu chn ng ca cc router b o ln. OSPF gii quyt c cc vn sau: Tc hi t. H tr VLSM (Variable Length Subnet Mask). Kch c mng. Chn ng. Nhm cc thnh vin.

Trong mt h thng mng ln, RIP phi mt t nht vi pht mi c th hi t c v mi router ch trao i bng nh tuyn vi cc router lng ging kt ni trc tip vi mnh m thi. Cn i vi OSPF sau khi hi t vo lc khi ng, khi c thay i th vic hi t s rt nhanh v ch c thng tin v s thay i c pht ra cho mi router trong vng. OSPF c h tr VLSM nn n c xem l mt giao thc nh tuyn khng theo lp a ch. RIPv1 khng h tr VLSM, nhng RIPv2 th c. i vi RIP, mt mng ch cch xa hn 15 router xem nh khng th n c v RIP c s lng hop gii hn l 15. iu ny lm kch thc mng ca RIP b gii hn trong phm vi nh. OSPF th khng gii hn v kch thc mng, n hon ton c th ph hp vi mng va v ln. Khi nhn c t router lng ging cc bo co v s lng hop n mng ch, RIP s cng thm 1 vo thng s hop ny v da vo s lng hop chn ng n mng ch. ng no c khong cch ngn nht hay ni cch khc l c s lng hop t nht s l ng tt nht i vi RIP. Nhn xt thy thut ton chn ng nh vy l rt n gin v khng i hi nhiu b nh v nng lc x l ca router. RIP khng h quan tm n bng thng ng truyn khi quyt nh chn ng. OSPF th chn ng da vo chi ph c tnh t bng thng ca ng truyn. Mi OSPF u c thng tin y v cu trc ca h thng mng v da vo

109

chn ng i tt nht. Do , thut ton chn ng ny rt phc tp, i hi nhiu b nh v nng lc x l ca router cao hn so vi RIP. RIP s dng cu trc mng dng ngang hng. Thng tin nh tuyn c truyn ln lt cho mi router trong cng mt h thng RIP. Cn OSPF s dng khi nim v phn vng. Mt mng OSPF c th chia cc router thnh nhiu nhm. Bng cch ny, OSPF c th gii hn lu thng trong tng vng. Thay i trong vng ny khng nh hng n hot ng ca cc vng khc. Cu trc phn lp nh vy cho php h thng mng c kh nng m rng mt cch hiu qu. Thut Ton Chn ng Ngn Nht Theo thut ton ny, ng tt nht l ng c chi ph thp nht. Thut ton c s dng l Dijkstra, thut ton ny xem h thng mng l mt tp hp cc nodes c kt ni vi nhau bng kt ni point-to-point. Mi kt ni ny c mt chi ph. Mi nodes c mt tn. Mi nodes c y c s d liu v trng thi ca cc ng lin kt. Do , chng c y thng tin v cu trc vt l ca h thng mng. Tt c cc c s d liu ny iu ging nhau cho mi router trong cng mt vng. Cc Loi Mng OSPF Cc OSPF phi thit lp mi quan h lng ging trao i thng tin nh tuyn. Trong mi mng IP kt ni vo router. N u c gng t nht l tr thnh mt lng ging hoc l mt lng ging thn mt vi mt router khc, router OSPF quyt nh chn router no lm lng ging thn mt l ty thuc vo tng loi mng kt ni vi n. C mt s router c th c gng tr thnh lng ging thn mt vi mi router lng ging khc. C mt s router khc li c th ch c gng tr thnh lng ging thn mt vi mt hoc hai router lng ging thi. Mt khi mi quan h lng ging thn mt c thit lp gia hai lng ging vi nhau th thng tin v trng thi ng lin kt mi c trao i. Giao thc OSPF nhn bit cc loi mng sau: Mng qung b a truy cp, v d mng Ethernet. Mng point-to-point. Mng khng qung b a truy cp (NBMA NonBroadcast MultilAccess), v d Frame Relay. Mng Point-to-Multipoint c th c nh qun tr mng cu hnh cho mt cng ca router.

110

Trong mng a truy cp khng th bit c l c bao nhiu router s c th c kt ni vo mng. Trong mng point-to-point th ch c hai router c kt ni vi nhau. Trong mng qung b a truy cp c rt nhiu router kt ni vo. Nu mi router u thit lp mi quan h thn mt vi mi router khc v thc hin trao i thng tin v trng thi ng lin kt vi mi router lng ging th s qu ti. Nu c 10 router th s cn 45 mi lin h thn mt, nu c n router th s c n*(n-1)/2 mi quan h lng ging cn thit lp. Gii php cho vn qu ti trn l bu ra mt router lm i din (DRDesignated Router). Router ny s thit lp mi quan h thn mt vi mi router khc trong mng qun b. Mi router cn li s ch gi thng tin v trng thi ng lin kt cho DR. Sau DR s gi cc thng tin ny cho mi router khc trong mng bng a ch multicast 224.0.0.5 DR ng vai tr nh mt ngi pht ngn chung. Vic bu DR rt c hiu qu nhng cng c mt nhc im. DR tr thnh mt tm im nhy cm i vi s c. Do , cn c mt router th hai c bu ra lm i din d phng (BDR Backup Designated Router), router ny s m trch vai tr ca DR nu DR b s c. m bo c DR v BDR u nhn c thng tin v trng thi ng lin kt t mi router khc trong cng mt mng, a ch multicast 224.0.0.6 cho cc router i din. Trong mng point-to-point ch c 2 router kt ni vi nhau nn khng cn bu ra DR v DBR. Hai router ny s thit lp mi quan h lng ging thn mt vi nhau. Loi Mng Cc c Tnh Bu DR Broadcast Multi-Access Ethernet,ToKen Ring,FI C NonBroadcast Multi-Access Frame Relay,X25,SMDS C Point-to-Point PPP,HDLC Khng Point-to-Multipoint c cu hnh bi Administrator khng. Giao Thc OSPF Hello Khi router bt u khi ng tin trnh nh tuyn OSPF trn mt cng no th n s gi mt gi hello ra cng v tip tc gi hello theo nh k. Giao thc hello a ra cc nguyn tc qun l vic trao i cc gi OSPF hello. lp 3 ca m hnh OSI, gi hello mang a ch multicast 224.0.5.0 a ch ny ch n tt c cc OSPF router. OSPF router s dng gi hello thit lp mt 111

quan h lng ging thn mt mi v xc nh l router lng ging c cn hot ng hay khng. Mc nh hello c gi i 10 giy mt ln trong mng qung b a truy cp v mng Point-to-Point. Trn cng ni vo mng NBMA, v d nh Frame Relay, chu trnh mc nh ca hello l 30 giy. Trong mng a truy cp, giao thc hello tin hnh bu DR v BDR. Mc d gi hello rt nh nhng n cng bao gm c phn header ca gi OSPF. Cu trc ca phn header trong gi OSPF c th hin nh hnh sau. Nu gi hello th trng Type s c gi tr l mt.

Hnh 4.14. Phn header ca gi OSPF Gi hello mang nhng thng tin thng nht gia mi lng ging vi nhau trc khi c th thit lp mi quan h lng ging thn mt v trao i thng tin v trng thi ng lin kt.

Hnh 4.15. Phn header ca gi OSPF hello. Cc thng tin trong phn Hello Interval, Dead Interval, Router ID phi ng nht th cc router mi c th thit lp mi quan h lng ging thn mt 4.12. UDP (User Datagram Protocol) UDP (User Datagram Protocol) l giao thc theo phng thc khng lin kt c s dng thay th cho TCP trn IP theo yu cu ca tng ng dng. Khc vi TCP, UDP khng c cc chc nng thit lp v kt thc lin kt. Tng t nh IP, n cng khng cung cp c ch bo nhn (acknowledgment), khng sp xp tun t cc gi tin (datagram) n v c th dn n tnh trng mt hoc trng d liu m khng

112

c c ch thng bo li cho ngi gi. Qua ta thy UDP cung cp cc dch v vn chuyn khng tin cy nh trong TCP. Khun dng UDP datagram c m t vi cc vng tham s n gin hn nhiu so vi TCP segment. Bit 0 Source Port 15 16 31

Destination Port Checksum DATA

Message Length

Hnh 4.16. Dng thc ca gi tin UDP Cc trng c ngha nh sau: o Source Port: S hiu cng ngun (ca my gi): mt trng c th la chn c vi s hiu cng. Nu mt s hiu cng khng xc nh th trng ny c gi tr l 0. o o Destination Port S hiu cng trn my nhn. Message Length Chiu di ca d liu trong c phn Header v d liu o Trng Checksum: l 16 bit b cu mt php tng b mt ca trng d liu, c c phn pseudoHeader ging nh ca TCP. Trng checksum ca UDP cng c th la chn c, nhng khng c dng. Khng mt checksum no c dng cho phn d liu v phn checksum ca IP ch dng cho phn Header IP m thi. Nu phn checksum khng c dng th cc bit ca cc trng ny c thit lp l 0. Giao thc UDP c s dng trong mt s tnh hung c bit: Khi truyn mt d liu nh th dng UDP c hiu qu hn so vi vic kt ni v hy kt ni khi s dng TCP. Cc ng dng hi p, mong mun tr li trong mt thi gian ngn sau khi ngi s dng gi i yu cu. Tr li cng l mt c ch bo nhn. Ngi ta s dng giao thc UDP nh trong cc dch v ng dng khng yu cu chnh xc cao nh thng bo gi hay cc dch v gi nhn tin, t gi,

113

Mt s m hnh nn truyn cc thng tin audio, video, c th chp nhn c mt vi gi d liu b hng hay tht lc

Mt vi ng dng c tin cy ring trong khi truyn d liu th nn dng UDP hn l TCP.

4.13. TCP (Transmission Control Protocol) TCP l mt giao thc hng lin kt (Connection Oriented), tc l trc khi truyn d liu, thc th TCP pht v thc th TCP thu thng lng thit lp mt kt ni logic tm thi, tn ti trong qu trnh truyn s liu. TCP nhn thng tin t tng trn, chia d liu thnh nhiu gi theo di quy nh v chuyn giao cc gi tin xung cho cc giao thc tng mng (Tng IP) nh tuyn. B x l TCP xc nhn tng gi, nu khng c xc nhn gi d liu s c truyn li. Thc th TCP bn nhn s khi phc li thng tin ban u da trn th t gi v chuyn d liu ln tng trn. TCP cung cp kh nng truyn d liu mt cch an ton gia cc thnh trong lin mng. Cung cp cc chc nng kim tra tnh chnh xc ca d liu khi n ch v truyn li d liu khi c li xy ra. TCP cung cp cc chc nng chnh sau: - Thit lp, duy tr, gii phng lin kt gia hai thc th TCP. - Phn pht gi tin mt cch tin cy. - To s th t (Sequencing) cc gi d liu. - iu khin li. - Cung cp kh nng a kt ni cho cc qu trnh khc nhau gia thc th ngun v thc th ch thng qua vic s dng s hiu cng. - Truyn d liu theo ch song cng (Full-Duplex). TCP c nhng c im sau: - Hai thc th lin kt vi nhau phi trao i, m phn vi nhau v cc thng tin lin kt. Hi thoi, m phn nhm ngn chn s trn lt v mt d liu khi truyn. - H thng nhn phi gi xc nhn cho h thng pht bit rng n nhn gi d liu. - Cc Datagram IP c th n ch khng ng theo th t , TCP nhn sp xp li. - H thng ch pht li gi tin b li, khng loi b ton b dng d liu. 114

Cu trc gi tin TCP: n v d liu s dng trong giao thc TCP c gi l Segment. Khun dng v ni dung ca gi tin TCP c biu din nh sau: Bit 0 Source Port 15 16 Destination Port 31

Data Offset

Sequence Number Acknowlegment Number Reserved UGR ACK PSH RST SIN FIN Window Checksum Urgent Pointer Options Padding TCP data Hnh 4.17. Cu trc gi tin TCP (TCP Segment)

- Cng ngun (Source Port): 16 bt, s hiu cng ngun. - Cng ch (Destination Port): di 16 bt, cha s hiu cng ch. - Sequence Number: 32 bits, s th t ca gi s liu khi pht. - Acknowlegment Number (32 bits), Bn thu xc nhn thu c d liu ng. - Offset (4 bits): di Header gi tin TCP. - Reserved (6 bits) lu li: Lp y bng 0 dnh cho tng lai. - Control bits: Cc bits iu khin URG : Vng con tr khn c hiu lc. ACK : Vng bo nhn (ACK number) c hiu lc. PSH: Chc nng PUSH. RST: Khi ng li (reset) lin kt. SYN : ng b cc s liu tun t (sequence number). FIN : Khng cn d liu t trm ngun. - Window (16bits): S lng cc Byte d liu trong vng ca s bn pht. - Checksum (16bits): M kim sot li (theo phng php CRC). - Urgent Pointer (16 bits): S th t ca Byte d liu khn, khi URG c thit lp. - Option ( di thay i): Khai bo di ti a ca TCP Data trong mt Segment. - Padding ( di thay i): Phn chn thm vo Header. 115

Vic kt hp a ch IP ca mt my trm v s cng c s dng to thnh mt Socket. Cc my gi v nhn u c Socket ring. S Socket l duy nht trn mng. iu khin lu lng v iu khin tc nghn C ch ca s ng l mt trong cc phng php iu khin thng tin trong mng my tnh. ln ca ca s bng s lng cc gi d liu c gi lin tc m khng cn ch thng bo tr li v kt qu nhn tng gi d liu . ln ca s quyt nh hiu sut trao i d liu trong mng. Nu chn ln ca s cao th c th gi c nhiu d liu trong cng mt n v thi gian. Nu truyn b li, d liu phi gi li ln th hiu qu s dng ng truyn thp. Giao thc TCP cho php thay i ln ca s mt cch ng, ph thuc vo ln b m thu ca thc th TCP nhn. C ch pht li thch nghi: m bo kim tra v khc phc li trong vic trao i d liu qua lin mng, TCP phi c c ch ng h kim tra pht (Time Out) v c ch pht li (Retransmission) mm do, ph thuc vo thi gian tr thc ca mi trng truyn dn c th. Thi gian tr ton phn RTT (Round Trip Time) c xc nh bt u t thi im pht gi d liu cho n khi nhn c xc nhn ca thc th i tc, l yu t quyt nh gi tr ca ng h kim tra pht Tout. Nh vy Tout phi ln hn hoc bng RTT. C ch iu khin tc nghn: Hin tng tc nghn d liu th hin vic gia tng thi gian tr ca d liu khi chuyn qua mng. hn ch kh nng dn n tc nghn d liu trong mng, iu khin lu lng da trn vic thay i ln ca s pht. Thit lp v hu b lin kt: TCP l mt giao thc hng lin kt, tc l cn phi thit lp mt lin kt gia mt cp thc TCP trc khi truyn d liu. Sau khi lin kt c thit lp, nhng gi tr cng (Port) hot ng nh mt nhn dng logic c s dng nhn dng mch o (Virtual Circuit).Trn knh o d liu c truyn song cng (Full Duplex). Lin kt TCP c duy tr trong thi gian truyn d liu. Kt thc truyn, lin kt TCP c gii phng, cc ti nguyn nh b nh, cc bng trng thi.. cng c gii phng. Thit lp lin kt TCP: c thc hin trn c s phng thc bt tay ba bc (Tree -Way Handsake): Bc 1: Nh hnh di yu cu lin kt lun c trm ngun khi to tin trnh bng cch gi mt gi TCP vi c SYN=1 v cha gi tr khi to s tun t ISN ca Client. Gi tr ISN ny l mt s 4 byte khng du v c tng mi khi lin kt

116

c yu cu (gi tr ny quay v 0 khi n ti gi tr 232). Trong thng ip SYN ny cn cha s hiu cng TCP ca phn mm dch v m tin trnh trm mun lin kt. Mi thc th lin kt TCP u c mt gi tr ISN mi, s ny c tng theo thi gian. V mt lin kt TCP c cng s hiu cng v cng a ch IP c dng li nhiu ln, do vic thay i gi tr ISN ngn khng cho cc lin kt dng li cc d liu c (Stale) vn cn c truyn t mt lin kt c v c cng mt a ch lin kt . Bc 2: Khi thc th TCP ca phn mm dch v nhn c thng ip SYN, n gi li gi SYN cng gi tr ISN ca n v t c ACK=1 trong trng hp sn sng nhn lin kt. Thng ip ny cn cha gi tr ISN ca tin trnh trm trong trng hp s tun t nhn bo rng thc th dch v nhn c gi tr ISN ca tin trnh trm. Bc 3: Tin trnh trm tr li li gi SYN ca thc th dch v bng mt thng bo tr li ACK. Bng cch ny, cc thc th TCP trao i mt cch tin cy cc gi tr ISN ca nhau v c th bt u trao i d liu. Khng c thng ip no trong ba bc trn cha bt k d liu g , tt c thng tin trao i u nm trong phn Header ca thng ip TCP.

Hnh 4.18. Qu trnh thit lp v kt thuc lin kt TCP 3 bc

Kt thc lin kt: Khi c nhu cu kt thc lin kt TCP, v d A gi yu cu kt thc lin kt vi FIN=1. V lin kt TCP l song cng (Full-Duplex) nn mc d nhn c yu cu kt thc lin kt ca A, thc th B vn c th tip tc truyn cho n khi B khng cn s liu gi v thng bo cho A bng yu cu kt thc lin kt vi FIN=1. Khi thc th TCP nhn c thng ip FIN v sau khi gi thng ip FIN ca mnh, lin kt TCP thc s kt thc. Nh vy c hai trm phi ng gii phng lin kt

117

TCP bng cch gi c FIN=1 trc khi chm dt lin kt xy ra, vic ny bo m d liu khng b tht lc do n phng t ngt chm dt lin lc. Truyn v nhn d liu Sau khi lin kt c thit lp gia mt cp thc th TCP, cc thc th truyn d liu. Lin kt TCP d liu c th c truyn theo hai hng. Khi nhn mt khi d liu cn chuyn i t ngi s dng, TCP s lu tr ti b m. Nu c PUST c xc lp th ton b d liu trong b m s c gi i di dng TCP Segment. Nu PUST khng c xc lp th d liu trong b m vn ch gi i khi c c hi thch hp. Bn nhn, d liu s c gi vo b m. Nu d liu trong m c nh du bi c PUST th ton b d liu trong b m s c gi ln cho ngi s dng. Ngc li, d liu vn c lu trong b m. Nu d liu khn cn phi chuyn gp th c URGENT c xc lp v nh du d liu bng bit URG bo d liu khn cn c chuyn gp. Mt s a ch cng TCP mc nh S hiu cng 0 5 7 9 11 13 15 17 20 21 4.14. Bi tp M t Reserved Remote job entry Echo Discard Systat Daytime Nestat Quotd (quote odd day) ftp-data ftp (control) S hiu cng 23 25 37 53 102 103 104 111 139 160 - 223 M t Telnet SMTP Time Name Server ISO - TSAP X.400 X.400 Sending Sun RPC Net BIOS Session source Reserved

118