Chirong 4<br />
TANG MANG<br />
<br />
4.1 CAC MO HINH DICH VU CUA TANG MANG<br />
<br />
Nhu da trinh bay trong chuang trudc, ting giao van cung cap djch<br />
vu tmyen thdng gitra hai tiln trinh dang chay tren hai may tinh khac nhau.<br />
De cung cap dugc djch vu nay, ting giao van phai sir dung djch vu cung cap<br />
dudng truyen gitra hai may tinh cua ting mang. Ndi cu thi ban, ting mang<br />
chuyen gdi tin (segment) cua ting giao van tir may tinh nay din may tinh<br />
khac. T?ii may tinh giri, tit ca cac segment cua ting giao van dugc chuyin<br />
xudng tang mang. Nhiem vu ciia ting mang la chuyin nhirng segment nay<br />
den may tinh dich va giri tdi thuc thi nao dd d ting giao van ben tren. Cdng<br />
viec chuyen segment tir ting giao van may tinh nguon din ting giao van<br />
may tinh dich ciia ting mang chinh la ndi dung cua chuang nay. Chiing ta se<br />
thay rang khdng gidng ting giao van, ting mang gom nhieu may tinh va cac<br />
router trung gian. Vi thi, giao thire ting mang la mdt trong nhirng giao thirc<br />
phirc tap nhat.<br />
<br />
216<br />
<br />
E r d system H1<br />
Applcatbn;<br />
Transport i<br />
<br />
Ftouter<br />
<br />
Data link<br />
Physical<br />
Data link<br />
Ptiysical<br />
<br />
1<br />
H'^itvX'rk<br />
<br />
/<br />
<br />
,<br />
<br />
Metv>/ork 1<br />
Data link<br />
Physical I '""'^-^ Data link |<br />
<br />
Physical j<br />
<br />
Hinh 4.1 IVIgt mo hinh mang do-n gian<br />
<br />
Hinh 4.1 minh hoa mot mang don gian vdi hai may tinh (HI va H2)<br />
va mot so router tren dudng tmyln giii-a H1 va H2. Tang mang d may tinh<br />
giri thuc hien budc giri diu tien tren toan bd hanh trinh ciia gdi tin. Vi du<br />
nlu HI giri gdi tin din H2 thi ting mang tren HI se truyen gdi tin nay din<br />
router gin nhit: R2. Tai may tinh nhan (ching ban H2), tang mang se nhan<br />
gdi tin tir router gin nd nhit (trong trudng hgp nay la R2) va chuyen len cho<br />
ting giao van tai H2. Vai trd chinh ciia router la chuyen gdi tin tir mdt dau<br />
vao nao dd (input) tdi mot diu ra nao dd (output). Chu y rang cac tang tren<br />
cua tang mang (giao van, img dung) khdng boat ddng tai cac router trong<br />
Hinh 4.1 bdi vi router khdng cin thilt phai chay cac giao thiie d ting giao<br />
van hay ting img dung (ngoai trir cac muc dich kiem soat).<br />
Vai trd ciia ting mang don gian chl la chuyen gdi tin tir may tinh giri<br />
din may tinh nhan. Vi thi, ting mang cd ba chirc nang quan trong sau day:<br />
217<br />
<br />
Xdc dinh duerng di (Path determination): Ting mang phai xac djnh<br />
cac router trung gian hay tuyIn dudng (path) ma gdi tin dugc truyin tir noi<br />
gii-i den noi nhan. Thuat toan xac djnh tuyIn dudng nhu vay goi la "thuat<br />
toan djnh tuyen" (routing algorithm). Thuat toan djnh tuyIn se quylt djnh<br />
dudng di ciia cac gdi tin tir may tinh nhan din may tinh giri (trong vi du la<br />
may tinh HI va may tinh H2). Trgng tam ciia chuong nay la cac thuat toan<br />
djnh tuyen. Trong phin 4.2, chiing ta se nghien cim ly thuylt ciia thuat toan<br />
djnh tuyen, tap trung vao hai kilu thuat toan: Link state va Distance vector.<br />
Chiing ta se thay do phirc tap ciia thuat toan djnh tuyIn phu thude vao sd<br />
lugng router tren dudng truyin. Dieu nay dan din djnh tuyIn phan cip, mot<br />
chu de dugc trinh bay trong phin 4.3.<br />
Chuyen mach (Switching): Khi gdi tin din diu vao, router phai<br />
quyet djnh giri gdi tin din diu ra thich hgp nao. Vi du, gdi tin tir may HI<br />
den router Rl se phai dugc chuyin din router kl tilp tren dudng tdi H2.<br />
Trong phan 4.6 chiing ta se nghien cim boat ddng cua router va qua trinh<br />
chuyen mdt gdi tin tir dau vao din diu ra trong mot router dien ra nhu thi nao.<br />
Thiet lap ducfttg truyen (Call setup): Trong phin trudc trinh bay vl<br />
TCP, chiing ta thiy rang hai thuc thi truyin thdng phai ed mdt giai doan<br />
"bat tay" trudc khi trao ddi dtr lieu thuc sir. Dilu nay cho phep ben giii va<br />
ben nhan thiet lap cae thdng tin trang thai cin thilt (vi du, sd thir tu khdi<br />
diu, do Idn cira sd). Vdi mdt so kiln true mang khac (vi du ATM) ddi hdi<br />
cac router tren tuyIn dudng tir ngudn din dich phai "bit tay" nhau trudc khi<br />
bat diu truyen dir lieu thuc su. Trong ting mang, qua trinh nay dugc ggi la<br />
thiet lap dudng truyin (call setup). Chiing ta sc thiy ting mang trong kiln<br />
true Internet khdng ddi hdi cdng viec nay.<br />
Tuy nhien, trudc khi di sau vao chi tilt cac khai niem va triln khai<br />
ciia tang mang, chung ta se xem xet tong quat nhimg kilu djch vu khac nhau<br />
ciia tang mang.<br />
<br />
4.1.1 Mo hinh dich vu mang<br />
Khi tang giao van d thilt bj giri chuyin cac gdi tin xudng ting mang,<br />
lieu tang giao van cd thi tin cay ting mang chuyin gdi tin nay din dich<br />
khdng? Lieu khi giri nhilu gdi tin, chiing cd dugc chuyin din tang giao van<br />
ciia thiet bj nhan theo dung thir tu khdng ? Van toe giri cae gdi tin cd dugc<br />
xac djnh trudc khdng? Tang mang cd phan hdi lai cac thdng tin lien quan<br />
den tac nghen khdng? Md hinh djch vu mang se tra Idi nhiing cau hdi nay va<br />
nhieu van de khac.<br />
218<br />
<br />
Chuyin mach gdi (datagram) va chuyen mach ao (virtual circuit)<br />
Cd Ic dilm triru tugng quan trong nhit ma tang mang che dau cac<br />
ling tren la viec cd su dung m.ach ao (Virtual Circuit - VC) hay khdng. Ve<br />
khia canh nao dd mach ao tuang tu mang dien thoai truyen thdng (mac dii<br />
mang dien thoai sir dung mach thuc). Cd ba giai doan trong chuyen mach ao:<br />
Thih lap mach do: trong ca giai doan thilt lap, phia giri thdng bao<br />
dja chi nhan vdi ting mang, yeu ciu ting mang thilt lap VC. Tang mang xac<br />
djnh tuyIn dudng giira ben gui va ben nhan, tire la chudi cac cung dudng<br />
(hay dudng kit noi - link) cung nhu cac thilt bj chuyin mach (switch - mit<br />
trung gian) ma tit ca cac gdi dtr lieu se di qua. Giai doan nay yeu cau viec<br />
cap nhat bang djnh tuyIn va du trir tai nguyen trong moi thilt bj chuyen mach.<br />
Truyen dit lieu: Sau khi thilt lap, dir lieu ed thi dugc chuyen trong VC.<br />
Gidi phong mach do: Giai doan nay bit diu khi phia giri (hoac phia<br />
nhan) bao cho ting mang yeu ciu ddng VC. Ting mang se thdng bao cho<br />
thilt bj diu cuoi ben kia cung nhu cac thilt bj chuyin mach tren VC de cap<br />
nhat lai cac bang djnh tuyIn, giai phdng tai nguyen.<br />
Cd sir khac biet tuy nhd - nhung quan trgng giGa thilt lap VC d tang<br />
mang va thilt lap kit ndi d ting giao van (giai doan bit tay 3 budc ciia<br />
TCP). Thilt lap kit ndi d tang giao van chi lien quan din cac thiet bj dau<br />
cudi d tren hai diu mut. Hai thilt bj ddng y thilt lap kit noi va thoa thuan<br />
cac thdng sd ciia kit ndi (vi du so thir tu khdi tao, do Idn cira so kilm soat<br />
luu lugng). Hai thiet bj diu cuoi nay se nhan bilt dugc ve sir kit noi d ting<br />
giao van, nhung cac thiet bj chuyin mach d giira thi khdng. Trai lai trong<br />
ting mang ciia mang chuyin mach ao, tit ca cac thilt bj chuyen mach gi&a<br />
hai thilt bj dau cudi diu tham. gia vao qua trinh thilt lap mach ao, va do dd<br />
diu nhan bilt dugc tit ca cac VC di qua.<br />
Thdng diep trao doi gitra cac thilt bj diu cudi yeu cau khdi tao hay<br />
kit thuc mach ao hay thdng diep trao ddi gitra cac thilt bj chuyen mach yeu<br />
ciu thilt lap VC (dl cap nhat bang chuyin mach) dugc ggi la thong diep<br />
bao hieu (signaling message). Giao thire dugc su dung dl trao doi nhimg<br />
thdng diep nay la giao thuc bao hieu (signaling protocol). Qua trinh thiet<br />
lap VC dugc minh boa trong Hinh 4.2. ATM, Frame Relay va X.25 la ba<br />
kiln tnic mang sir dung chuyen mach ao.<br />
Trong mang chuyin mach gdi, khi muon giri gdi tin, thiet bj dau<br />
cudi dat vao gdi tin dja chi thilt bj nhan va sau dd chuyin gdi tin<br />
219<br />
<br />
vao mang. Nhu minh boa trong Hinh 4.3, khdng cd giai doan thilt lap VC<br />
nao. Nhung thiet bi trung chuyin trong mang chuyin mach gdi (dugc goi la<br />
bd djnh tuyen - router tren Intemet) khdng duy tri bit ky trang thai nao vl<br />
VC vi khdng cd VC. Thilt bj trung chuyin se djnh tuyIn gdi tin din dich<br />
bang each xac djnh dja chi dich, tim kilm tren bang djnh tuyIn va chuyin<br />
tiep gdi tin theo hudng den dich (giong viec chuyin thu binh thudng trong<br />
he thdng buu dien). Vi bang djnh tuyln cd thi dugc cap nhat lien tuc, nen<br />
cac gdi tin dugc giri tir thilt bj diu cuoi nay din thilt bj diu cudi khac cd thi<br />
di theo nhieu tuyen dudng khac nhau va din dich khdng theo thir tu. Mang<br />
Intemet cdng cdng ngay nay sir dung djch vu chuyin mach gdi.<br />
<br />
i. hitiate caB<br />
<br />
2. Incoming call<br />
Hinh 4.2 Mo hinh djch vy c h u y i n mgch ao<br />
<br />
Application<br />
Transport<br />
Network<br />
Data fink 1. Send data<br />
Physical<br />
<br />
-^^^•*v J<br />
<br />
Af^lication<br />
Trai sport<br />
Network<br />
2. Receive data ^<br />
Data link<br />
<br />
Hinh 4.3 Mo hinh chuyin m^ch goi<br />
<br />
220<br />
<br />