You are on page 1of 61

Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Ni dung kha lun

Ngy nay, mng khng dy trong i sng con ngi ang ngy cng ng v tr
quan trng. Trong s cc mng khng dy, mng adhoc c quan tm mt cch c
bit. Khng ging nh mng c dy truyn thng hay mng khng dy c s s h
tng, vi tnh linh ng cao, d dng thit lp nn mng adhoc ang c ng dng
trong nhiu lnh vc ca x hi. Trong , vn nh tuyn trong mng adhoc l mt
trong nhng vn quan trng, ang c nghin cu rt nhiu v n nh hng rt
ln n hiu sut ca mng. y l nhng ni dung chnh trong kha lun ny.
Kha lun gm 4 chng. Chng u l khi qut chung v mng khng dy
WLAN v mng adhoc. Chng 2 i su vo trnh by cu trc vt l ca mng khng
dy theo chun 802.11. Chng ba ni v tm quan trng ca giao thc nh tuyn
trong mng adhoc v trnh by c th mt s giao thc nh tuyn ph bin ca mng
adhoc. Chng cui cng, da vo mt s thc nghim thng qua b m phng ca
nhng ngi nghin cu trc, ti rt ra mt s nh gi v so snh gia cc giao thc
nh tuyn.
Do thi gian c hn, lun vn ca em c th cn mt s thiu st, rt mong
nhn c s ch bo, gp v thng cm ca cc thy c. Em hi vng sau ny c th
tip tc nghin cu su hn v vn ny.

1
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Li cm n
Li u tin, em xin gi li cm n su sc n PGS. TS. Nguyn nh Vit.
Thy tn tnh ch bo em trong sut qu trnh lm kha lun ny. Em cng xin chn
thnh cc thy c trong trng dy d em trong sut nhng nm hc tp ti trng.
Cui cng, em cng xin gi li cm n n gia nh v bn b, nhng ngi
ng vin em rt nhiu trong thi gian lm kha lun.

H Ni, ngy 1 thng 6 nm 2008


Ng Hi Sn

2
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Mc Lc
Ni dung kha lun .......................................................................................................................1

Danh sch cc t vit tt ................................................................................................................5

Chng 1: Gii thiu chung...........................................................................................................7

1.1. t vn ......................................................................................................................7

1.1.1. Khi nim v WLAN[1],[3],[6] .....................................................................................7

1.1.2. Lch s ra i mng WLAN.....................................................................................8

1.1.3. Mt s u v nhc im ca WLAN ......................................................................8

1.2. Mng adhoc......................................................................................................................10

1.2.1. Khi nim v mt s c im chung ca mng adhoc ..................................................10

1.2.2. V d v mng adhoc ..................................................................................................11

1.2.3. Cc ng dng ca mng adhoc ....................................................................................12

1.2.4. Mt s vn cn quan tm trong mng adhoc .............................................................13

1.3. Mc tiu ca lun vn .......................................................................................................14

Chng 2: Mng LAN khng dy...........................................................................................15

2.1. Mng WLAN theo chun 802.11[1], [2],[6] ..............................................................................15

2.1.1. Mng WLAN c c s h tng ...............................................................................15

2.1.2. Mng adhoc ..........................................................................................................16

2.2. Kin trc giao thc mng WLAN theo chun 802.11 ......................................................17

2.2.1. Lp Vt L ................................................................................................................18

2.2.2. Lp iu khin truy cp mi trng truyn MAC..........................................................22

2.2.3. Lp qun l tng MAC..........................................................................................28

Chng 3: nh tuyn trong mng adhoc ................................................................................31

3.1. Gii thiu v thut ton nh tuyn.....................................................................................31

3.2. Yu cu ca thut ton nh tuyn cho mng khng dy adhoc ........................................31

3.3. Phn loi cc thut ton nh tuyn cho mng adhoc .......................................................35

3.3.1. DSDV (Destination Sequence Distance Vector) ......................................................35

3
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

3.3.2. AODV (Adhoc On-Demand Distance Vector Routing) ............................................37

3.3.3. DSR (Dynamic Source Routing) ............................................................................38

3.3.4. TORA (Temporally Ordered Routing Algorithm)....................................................40

Chng 4: nh gi hiu sut cc giao thc nh tuyn bng b m phng mng NS2 ....................42

4.1. Gii thiu b m phng NS2[4],[5] .......................................................................................42

4.2. Kh nng m phng cc mng ca NS2 ..............................................................................43

4.3. M phng mng adhoc v cc giao thc nh tuyn trong mng adhoc .................................43

4.3.1. M phng mng adhoc................................................................................................43

4.3.2. M phng cc giao thc nh tuyn trong mng adhoc [1, T.Vit], [4], [5] .....................................45

4.4. Phn tch v so snh hiu sut ca cc giao thc nh tuyn trong mng adhoc ................48

4.4.1. Cc tham s ca mi trng: .......................................................................................48

4.4.2. Cc thng s nh gi hiu sut: ..................................................................................49

4.4.3. Cc th nghim m phng [1, T.Vit] .................................................................................49

4.4.4. Nhn xt v hiu sut ca cc giao thc nh tuyn .................................................52

Kt lun......................................................................................................................................54

Ph Lc......................................................................................................................................55

Ti liu tham kho... 61

4
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Danh sch cc t vit tt

2G second-generation technology
3G third-generation technology
ACK Acknowledgement
AODV Adhoc On demand Distance Vector
ATIM Adhoc Traffic Indication Map
BS Base Station
CBR Cluster Based Routing
CFP Content Free Period
CSMA/CA Carrier Sense Multiple Access/ Collision Avoidance
CSMA/CD Carrier Sense Multiple Access/ Collision Detection
CTS Clear to send
DSDV Destination Sequence Distance Vector
DIFS Distributed InterFrame Space
DSR Dynamic Source Routing
DSSS Direct Sequence Spread Spectrum
DCF Distributed Coordination Function
FCC Federal Communication Commission
FDMA Frequency-Division Multiple Access
FHSS Frequency Hopping Spread Spectrum
GHz Gigahertz
IEEE Institute of Electrical and Electronics Engineers
ISM Industrial, Scientific and Medical
IMEP Internet MANET Encapsulation Protocol

Kbps Kilobits per second


LAN Local Area Network

5
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

MAC Medium Access Control


MANET Mobile Adhoc Networks
Mbps Megabits per second
MHz Megahertz
NS-2 Network Simulation 2
NAV Network Allocation Vector
OFDM Orthogonal Frequency-Division Multiplexing
Otcl Object Tool Command Language
PDA Personal Digital Assistant
PLCP Layer Convergence Protocol
PMD Physical Medium Dependent
RREQ Route Request
RREP Route Reply
RTS Request To Send
SIFS Short InterFrame Space

TDMA Time Division Multiple Access


TCP Transmission Control Protocol
TORA Temporally Ordered Routing Algorithm
UDP User Datagram Protocol
Wi-Fi Wireless Fidelity
WLAN Wireless Local Area Network

6
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Chng 1: Gii thiu chung


1.1. t vn
Ngy nay, cng vi s pht trin vt bc ca khoa hc cng ngh ni chung,
ngnh cng ngh thng tin ang ngy cng c u t v pht trin mnh m. Khi m
ngy cng nhiu cc lnh vc trong i sng x hi nh y t, gio dc, xy dng, kinh
t, ... ng dng tin hc vo trong cng vic th Internet ngy cng khng nh v tr
quan trng ca mnh trong i sng x hi. Khi m cuc sng con ngi ngy cng
pht trin th nhu cu trao i thng tin v gii tr ca con ngi ngy cng cao. Con
ngi mun mnh c th kt ni vi th gii bt c lc no, bt c ni u. l l do
m mng khng dy ra i. Ngy nay, chng ta c th thy c s hin din ca
mng khng dy nhiu ni nh trong cc ta nh, ni cng s, bnh vin hay cc
qun c ph. Cng vi s pht trin ca mng c dy truyn thng, mng khng dy
cng ang c nhng bc pht trin nhanh chng nhm p ng nh cu truyn thng
v gii tr ca con ngi mt cch tt nht.
Khi m mng khng dy ngy cng c quan tm, u t v pht trin th ngy
cng nhiu m hnh, kin trc mng c xut. Cc m hnh, kin trc mng ny
c ra nhm lm cho mng khng dy dn thot khi hon ton s ph thuc vo
c s h tng. Mt trong nhng m hnh mng c xut chnh l mng Adhoc
(Mobile Adhoc Network) thng c vit tt l MANET. Vic cc mng khng dy
t ph thuc vo c s h tng l mt iu rt thun li nhng li c nhng vn
khc t ra nh tc mng khng n nh nh mng c dy truyn thng, cc nt
mng hay di chuyn, ... Do , cng vi vn bo mt ca mng khng dy th vn
nh tuyn trong mng l v cng quan trng. N quyt nh rt ln n hiu sut
ca ton mng. Mng cc b khng dy (WLAN)

1.1.1. Khi nim v WLAN[1],[3],[6]


WLAN l mt mng cc b kt ni hai hay nhiu my tnh vi nhau m khng s
dng dy cp mng nh cc mng c dy truyn thng. WLAN hin nay c ng
dng rng ri trong cc ta nh, trng hc, bnh vin, mt s ni cng cng nh
qun cafe, ... Hai cng ngh chnh c s dng truyn thng trong WLAN l
truyn thng bng tia hng ngoi ( bc sng 900 nm, 1nm = 10-9m) hoc truyn
thng bng sng v tuyn. WLAN cng c hai dng kin trc l WLAN c c s h
tng (s dng cc Access Point kt ni phn mng khng dy vi phn mng c
dy truyn thng) v mng khng c c s h tng (mng adhoc).

7
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

1.1.2. Lch s ra i mng WLAN


Cng ngh WLAN ln u tin c xut hin vo cui nhng nm 90 ca th k
trc, khi m cc nh sn xut gii thiu nhng sn phm hot ng trong bng tn
900 MHz. Nhng gii php (cha c s thng nht gia cc nh sn xut) ny cung
cp tc truyn d liu 1Mbps, thp hn nhiu so vi cng ngh s dng cp khi
(tc truyn d liu l 10Mbps).
Nm 1992, cc nh sn xut bt u bn nhng sn phm WLAN u tin s
dng bng tn 2.4 GHz. Cc sn phm ny c tc truyn d liu cao hn. Tuy
nhin n vn l nhng gii php ring bit ca tng nh sn xut v khng c cng
b rng ri.
Nm 1997, chun IEEE 802.11ra i, hot ng bng tn 2.4 GHz vi tc
truyn d liu l 2 Mbps (c th nng ln 10 Mbps).
n cui nm 1999 v u nm 2000, hai chun mi ln lt c IEEE cng
b l chun 802.11b (hot ng di tn 2.4 GHz) v 802.11a (hot ng di tn 5-
6GHz). Nm 1999 cng nh du mt bc pht trin quan trng trn th trng mng
khng dy khi hng my tnh Apple thng bo, chun Wi-Fi s xut hin trn dng
my iBook mi ca h.
Nm 2003, IEEE cng b thm mt s ci tin mi l chun 802.11g c th hot
ng trn c hai bng tn l 2.4GHz v 5GHz, tc truyn d liu c th ln n
54Mbps.

1.1.3. Mt s u v nhc im ca WLAN


1.1.3.1. u im ca WLAN
- S tin li: Do khng cn phi c dy cp m ch cn mt im truy cp
(Access Point) nn vic to ra mt mng khng dy l nhanh chng v d dng i vi
ngi s dng. N cho php ngi dng c th d dng truy xut ti nguyn bt c
ni u c trin khai mng (ta nh hay cc vn phng). Vi vic cc thit b di ng
nh v d dng di chuyn nh PDA, laptop c h tr Wi-Fi ngy cng c s dng
nhiu nh hin nay th y l mt iu v cng thun li.
- linh ng: Tnh linh ng ca mng khng dy c th hin r nht vic
ngi dng khng cn b rng buc bi dy cp. Cng vi s pht trin ca mng
khng dy cng cng nh hin nay th ngi dng c th d dng truy cp mng bt

8
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

k u. V d in hnh c th ni ti l cc qun cafe wifi, ni ngi s dng c th


truy cp mng mt cch min ph.
- V hiu qu ca cng vic: Ngi dng c th d dng duy tr kt ni mng khi
di chuyn t ni ny n ni khc. i vi vic kinh doanh, iu ny v cng c li.
Vic duy tr truyn thng trong khi di chuyn c th lm tng thm hiu qu cng vic
ca h.
- Thit k v trin khai mng l rt d dng. Khng ging nh mng c dy truyn
thng, thit lp mng chng ta cn c nhng tnh ton thit k hp l, tin hnh nhiu
thao tc th vi mng khng dy, ch cn cc thit b tun theo mt chun nht nh v
mt im truy cp, h thng mng c th hot ng bnh thng. iu ny cng rt c
ngha vi nhng ta nh cao tng hay nhng cng trnh c, khi m vic trin khai mng
c dy c th nh hng khng tt n kin trc hay kt cu ca chng.
- Mt iu thun li na ca mng khng dy m chng ta khng th khng ni
ti. chnh l tnh bn vng vi s c nh ha hon hay thin tai ... Nu c thin tai,
hay mt s c no , vic mt mng c dy b ph hy, khng th hot ng l iu
hon ton bnh thng, gn nh khng th trnh c. Trong nhng iu kin nh
vy, mng khng dy vn c th hot ng bnh thng hoc c thit lp li mt
cch nhanh chng.
1.1.3.2. Nhc im ca WLAN
- Nhc im u tin chng ta c th ni ti chnh l vn an ton v bo
mt d liu trong mng khng dy. Do truyn thng trong mng khng dy l truyn
thng trong mt mi trng mang tnh m nn vic truy cp ti nguyn mng tri php
l iu kh trnh khi. So vi mng c dy th tnh bo mt ca mng khng dy l
khng cao bng. Do , vn bo mt cho mng khng dy l vn v cng quan
trng v c quan tm c bit. Mt im na l vic cc thit b mng pht sng
radio ra khng gian xung quanh c th nh hng n hot ng ca mt s thit b
in t khc nh cc thit b trong bnh vin hay cc phng nghin cu.
- Th hai l cht lng dch v ca mng khng dy. So vi mng c dy th
mng khng dy c tc chm hn (ch t t 1- 10Mbit/s), tr cao hn, t l li
cng nhiu hn (t l li l 10-4 so vi 10-10 ca mng s dng cp quang). Tuy vy,
theo mt s chun mi, mt s mi trng truyn c bit, vic truyn thng trong
mng khng dy cng c th t c tc cao hn ng k, v d nh trong chun
802.11n vic truyn thng c th t tc t 100-200Mbit/s.

9
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

- Th ba l vn chi ph cho cc thit b ca mng WLAN. So vi gi thnh


ca cc thit b mng c dy, thit b dnh cho mng khng dy l cao hn kh nhiu.
y cng l mt tr ngi cho s pht trin ca mng khng dy.
- Tip l vn c quyn trong cc sn phm. Nhiu thit b v sn phm ch
c th hot ng c nu s dng phn cng hoc phn mm ca cng ty sn xut
no , v phi hot ng theo quy nh ca quc gia m n ang c s dng. Cc
tn s pht cng c cc quc gia quy nh nhm trnh vic xung t sng radio ca
cc mng khc nhau. Do , vic sn xut cc sn phm cho mng WLAN cn phi
ch n quy nh ca tng quc gia.
- Cui cng l phm vi ph sng ca mng khng dy. Cc mng khng dy ch
hot ng trong phm vi nht nh. Nu ra khi phm vi pht sng ca mng th chng
ta khng th kt ni mng.

1.2. Mng adhoc


1.2.1. Khi nim v mt s c im chung ca mng adhoc
Ngy nay, vi s pht trin nhanh chng ca cng ngh, i sng con ngi
ngy cng c nng cao. Vic s hu mt thit b di ng nh my tnh xch tay,
PDA hay cc smart phone khng cn l qu kh khn vi nhiu ngi. iu ny
to iu kin v cng thc y mng khng dy pht trin. Vic kt ni mng theo m
hnh khng dy truyn thng (c s dng Access point) khng cn l xa l vi
chng ta na. Nhng khng phi lc no mng khng dy truyn thng cng c th
pht huy c hiu qu. V d nh trong vng mi xy ra thin tai hay trong lp hc,
ngi ta cn thit lp mt mng tm thi, trong mt khong thi gian ngn c th
trao i thng tin vi nhau. Lc ny nu thit lp mt mng khng dy c c s h
tng l mt iu tn km v khng hp l. Do , chng ta cn thit lp mt mng
khng dy khng cn c c s h tng nhng vn m bo cho cc thit b c th trao
i thng tin c vi nhau. y chnh l m hnh ca mng adhoc.
Chng ta c th hiu mng adhoc l mng khng cn c c s h tng, ngha l
khng cn mt s qun tr trung tm no. N l tp hp ca hai hay nhiu thit b c
h tr truyn thng v kt ni mng khng dy. Cc nt mng trong mng c th trc
tip nhn v x l cc gi tin trc tip t nt mng khc trong mng ngha l ng
vai tr nh cc host, ng thi, chng cng c th lm nhim v ca mt router l nh
tuyn v gi chuyn tip cc gi tin n cc nt mng khc trong mng.

10
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Mng adhoc l mt mng c tnh t thit lp v thch nghi. iu c ngha l


cc nt mng c th di ng lm cho topo mng thay i (topo ng). Nhng cc nt
mng c th t pht hin ra s c mt ca cc nt mng khc v thc hin kt ni cho
php truyn thng tin m khng cn bt k mt s qun tr trung tm no hay mt thit
b iu khin no c. Mt im cn lu y l cc nt mng khng nhng c th
pht hin kh nng kt ni ca cc thit b m n cn c th pht hin ra loi thit b
v cc c tnh tng ng ca cc loi thit b . Cc nt mng c th l cc thit b
khc nhau, v d nh my tnh xch tay, PDA, hay smart phone, ... nn kh nng tnh
ton, lu tr hay truyn d liu ca cc nt mng cng l khc nhau. Mt iu cng d
dng nhn thy l vn s dng v duy tr nng lng cho cc nt mng ca mng
adhoc l vn ng quan tm v cc nt mng thng dng pin duy tr s hot
ng ca mnh. Ngoi ra, cng ging nh mng khng dy c c s h tng, tnh bo
mt trong truyn thng ca mng adhoc l khng cao. Truyn thng trong khng gian
l kh kim sot v d b tn cng hn so vi mng c dy rt nhiu.

1.2.2. V d v mng adhoc

Hnh 1: V d c bn v mng adhoc


Hnh trn m t mt mng adhoc n gin gm c 5 nt mng c k hiu t
N1 n N5. Nhn vo hnh v chng ta c th d dng thy c: thi im t1, lin
kt t N1 n N2, N1 n N4, N2 n N3, N2 n N5, N3 n N5, N4 n N2, N4 n
N5 l nhng good link ngha l nhng lin kt mnh, t N4 n N1, N5 n N4, N5
n N3 l nhng weak link tc nhng lin kt yu. Nh vy y mt c im ca
mng adhoc c th hin r. l lin kt gia 2 nt mng ca mng c th
khng ging nhau d c chung im u v im cui. Hin tng ny c gi l
hin tng lin kt hai chiu khng i xng. Lin kt t N4 n N5 l lin kt mnh
nhng lin kt t N5 n N4 li l lin kt yu. iu ny l do v tr an-ten ca 2 nt
mng khc nhau, hoc do nng lng pht ca cc nt mng trong mng l khc

11
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

nhau... Tng t chng ta cng c th thy N3 c th nhn tn hiu t N2 l mt lin


kt mnh nhng m N2 li khng thu c tn hiu t N3.
Sang n thi im t2, lc ny topo mng thay i, lin kt gia cc nt mng
cng thay i theo. Lc ny, N1 ch c lin kt mnh vi N2, lin kt vi N4 li l lin
kt yu v N1 khng cn thu c tn hiu t N4. Lin kt t N2 n N3 v N5 li l
lin kt mnh. Lc ny, N2 cng c th thu c tn hiu t N3 mc d l lin kt
yu. iu ny thi im t1 l khng c.
Mt khc chng ta cng c th thy hai nt mng nm trong vng ph sng ca
nhau c th truyn thng trc tip cho nhau. V d nh trong thi im t1, vic truyn
thng gia hai nt mng N1 v N4 l trc tip vi nhau. Tuy nhin ngay c khi khng
nm trong vng ph sng ca nhau th gia cc nt mng vn hon ton c th thc
hin vic truyn thng vi nhau thng qua cc nt mng trung gian. V d N1 c th
thc hin truyn d liu cho N3 thng qua nt mng N2, cn N3 c th truyn d liu
cho N1 thng qua nt mng N5 v N4.

1.2.3. Cc ng dng ca mng adhoc


- p ng nhu cu truyn thng mang tnh cht tm thi: Ti mt a im trong
mt thi gian nht nh, ging nh trong mt lp hc hay mt cuc hp, ... vic thit
lp mt mng mang tnh cht tm thi truyn thng vi nhau ch din ra trong mt
khong thi gian ngn. Nu chng ta thit lp mt mng c c s h tng, d l mng
khng dy vn rt tn km tin bc cng nh nhn lc, vt lc, thi gian. Do , mng
adhoc c coi l gii php tt nht cho nhng tnh hung nh th ny.
- H tr khi xy ra cc thin tai, ha hon v ch ha: Khi xy ra cc thin tai,
ha hon mt ni no , c s h tng nh ng dy, cc my trm, my
ch, ... c th b ph hy dn n h thng mng b t lit l hon ton kh trnh khi.
V th , vic thit lp nhanh chng mt mng c tnh tin cy m khng cn c s h
tng p ng truyn thng, nhm gip khc phc, gim tn tht sau thin tai, ha
hon l cn thit. Mng adhoc li l mt la chn cho nhng tnh hung nh vy.
- p ng truyn thng ti nhng ni xa trung tm, cc vng su, vng xa: Ti
nhng ni xa trung tm, dn c tha tht hay vng su, vng xa, vic thit lp cc h
thng mng c c s h tng l rt kh khn v tn km. Vy nn, nhng ni ny,
gii php c a ra l s dng cc mng v tinh hoc mng adhoc.
- Tnh hiu qu: Trong mt s ng dng no , nu s dng dch v mng c c
s h tng c th khng c hiu qu cao bng vic dng mng adhoc. V d nh vi

12
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

mt mng c c s h tng, do c iu khin bi mt base station nn cc nt mng


mun truyn thng vi nhau u phi thng qua n. Ngay c khi hai nt mng gn
nhau, chng cng khng th trc tip truyn thng vi nhau m phi chuyn tip qua
mt base station xa. iu gy ra mt s lng ph thi gian v bng thng mng.
Trong khi , nu s dng mng adhoc vic truyn thng gia hai nt mng li tr
ln v cng d dng v nhanh chng. Hai nt mng gn nhau c th truyn thng trc
tip vi nhau m khng cn phi thng qua thit b trung gian no khc.

1.2.4. Mt s vn cn quan tm trong mng adhoc


- Chi ph cho vic s dng ph tn s: Vic s dng ph tn s chu s gim st
ca mt c quan nh nc chuyn ph trch v truyn thng (v d nh Vit Nam l
B truyn thng v thng tin). ngn nga nhiu sng, c quan ny phi a ra quy
nh v di ph c th cho tng mng hot ng, trong c c mng adhoc. Cc di
ph ny c cp pht v qun l mt cch cht ch, ng thi cng phi tr ph tn.
- Gii php truy nhp: Khng ging nh mng khng dy c c s h tng c
iu khin bi mt base station, mng adhoc thiu s iu khin tp trung v ng b
ton cc. iu ny mt mt to cho ngi dng kh nng di ng v kt ni khng
gii hn nhng mt khc li lm cho cu trc ca cc nt mng tr nn phc tp hn.
Vic cc nt mng di ng lin tc cng c th lm cho ng truyn pht sinh li, kt
ni gia cc nt mng c th b t t ngt. Do , cc phng php iu khin truy
cp mi trng truyn thng dng nh TDMA v FDMA u khng th thch hp.
Ngoi ra nhiu giao thc iu khin truy cp mi trng truyn (MAC protocol)
khng gii quyt c s di ng ca my ch. Mt khc, do mi trng truyn c
chia s bi nhiu nt mng di ng ty bin nn vic truy nhp n knh truyn chung
phi c thc hin theo kiu phn tn thng qua giao thc MAC. Giao thc MAC
phi cha ng c ch iu khin vic truy nhp knh truyn, ng thi phi trnh
c s xung t vi cc nt mng ln cn. S c mt ca tnh di ng, hin tng cc
trm cui n, trm cui l... phi c tnh n khi thit k giao thc MAC cho
mng adhoc.
- Vn nh tuyn trong mng adhoc: Do c im chnh ca mng adhoc l
topo ng, cc nt mng c th di chuyn lin tc nn kh nng t gy lin kt xy ra
l ln. Khi , cc thut ton nh tuyn ca mng c dy nh trng thi lin kt (link
state) hay Vector khong cch (distance vector) u khng ph hp vi mng adhoc.
V th vn nh tuyn ca mng adhoc tr ln c bit quan trng v n lin quan
n kh nng hot ng v hiu sut ca ton mng.

13
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

- y, chng ta cng c th ni thm v giao thc TCP (Transmission Coltrol


Protocol). Ta bit rng, TCP l giao thc c thit k thc hin vic truyn tin cy
kiu u cui - u cui (end-to-end), c thc hin cc c ch iu khin tc nghn
v iu khin lu lng trong mng. TCP l giao thc hng kt ni, c ngha l kt
ni c duy tr trong khi truyn d liu v n s b loi b khi vic truyn d liu
hon thnh. y l iu hon ton cn thit bi v giao thc IP l phi kt ni, rt cn
mt giao thc truyn dn hng kt ni ng tin cy qua mt giao thc mng. Nhng
TCP li gi thit cc nt mng l tnh v ch iu khin tc nghn cc nt mng u
v nt mng cui.
- Vn v duy tr nng lng cho cc nt mng: Hu ht cc giao thc mng
hin nay u khng quan tm n vic tiu tn nng lng do cc my ch v b nh
tuyn u c gi nh l tnh v c cung cp nng lng t ngun in li.
Trong khi vi mng adhoc th khc. Cc nt mng ch yu l nhng thit b di
ng, nng lng c cung cp t pin. V th, thi gian hot ng ca cc thit b ch
vo khong t 2 n 3h ty theo loi pin. S gii hn v thi gian nh th i hi phi
s dng tit kim v bo tr tt ngun in. Mt khc, vi mng adhoc, cc nt mng
khng nhng va ng vai tr ca h thng u cui (tng tc ngi dng khi thc
hin ng dng ngi dng) m n cn ng vai tr ca mt h thng trung gian nh
tuyn cho cc gi tin. iu ny cng tiu tn ng k nng lng, nn vn tit kim
nng lng khi thit k cc giao thc mng cng cn phi c quan tm c bit.
- Bo mt trong mng adhoc: Cng nh i vi mng khng dy ni chung, bo
mt trong mng adhoc l khng cao. Do , cc k thut bo mt cn c trin khai
trn nhiu tng giao thc nhm gim nguy c b tn cng t bn ngoi.

1.3. Mc tiu ca lun vn


Cng vi s pht trin ca cuc sng con ngi v khoa hc k thut, cng ngh
mng cng ang ngy cng pht trin. Vic nghin cu, pht trin v s dng mng
khng dy ang ngy cng c quan tm c bit c th gip cho vic truyn
thng v gii tr ca con ngi c p ng tt nht. Do , mc tiu u tin ca
kha lun l:
- Nghin cu cc c im chnh ca mng LAN khng dy (WLAN).
- Nghin cu nhng c im chnh ca mng adhoc, ng thi nghin cu cc
giao thc nh tuyn trong mng adhoc, so snh nh gi hiu sut ca cc giao thc
nh tuyn thng qua b m phng NS2.

14
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Chng 2: Mng LAN khng dy


2.1. Mng WLAN theo chun 802.11[1], [2],[6]
chng u tin, chng ta c nhng khi nim tng quan nht v mng
khng dy. Trong chng ny, ti xin trnh by c th kin trc k thut ca mng
WLAN theo chun 802.11. WLAN c hai dng c bn l WLAN c c s h tng
(infrastructured-based) v WLAN khng c c s h tng (mng adhoc). Mng khng
dy c tnh linh hot cao do hai dng ny lun c s dng kt hp vi nhau. Ngha
l cc my tnh c th trao i d liu qua mt Base Station hoc cng c th truyn
thng trc tip vi nhau.

Hnh 2: Hai m hnh ca mng WLAN

2.1.1. Mng WLAN c c s h tng


Mng WLAN c c s h tng, cc nt mng truyn thng c vi nhau u
phi thng qua im truy cp chung AP (Access Point), n cn c mt tn gi khc
na l trm c s - BS (Base Station). Cc base station khng ch cung cp kh nng
kt ni mng m n cn c chc nng chuyn tip, iu khin cc truy cp ng
truyn. Ngoi ra, cc base station cn thng c kt ni vi cc mng c dy nn n
ng vai tr nh l cu ni cc mng khng dy v c dy vi nhau to thnh mt
mng din rng. Tc truyn d liu ca mng khng ch ph thuc vo c im

15
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

ca cc nt mng m cn ph thuc vo bn knh ph sng ca cc AP. Cc nt mng


cng gn AP th tc truyn d liu cng cao. Do , vic la chn tc truyn v
phm vi hot ng cn phi cn nhc, khi nh hng trc tip ti s b tr ca cc AP.
Khi nim Indoor v Outdoor: Indoor l khi nim dng v tuyn trong phm vi
khng gian nh, nh trong mt ta nh. Outdoor l khi nim dng v tuyn trong
phm vi khng gian ln hn, vi WLAN th bn knh n cc thit b m n qun l c
th t 5 20 km.

Hnh 3: c trng ca mt s chun khng dy


Nhn vo hnh v, ta c th thy cc chun 2G, 3G c phm vi hot ng rng, v
tc truyn d liu ca n l rt thp (tc ca mng 2G l 56Kbps, 3G l
384Kbps). Cc chun 802.x c phm vi hot ng nh hn, tc truyn d liu ca
cc chun ny cng cao hn.

2.1.2. Mng adhoc


Cc thit b di ng (my tnh c h tr card mng khng dy) tp trung li trong
mt khng gian nh hnh thnh nn kt ni ngang cp (peer-to-peer) gia chng.
Cc thit b ny c th trao i thng tin trc tip vi nhau, khng cn phi qun tr

16
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

mng. V vic thit lp cc mng adhoc ny c th thc hin nhanh v d dng nn


chng thng c thit lp m khng cn mt cng c hay k nng c bit no v
vy n rt thch hp s dng trong cc hi ngh thng mi hoc trong cc nhm
lm vic tm thi. Tuy nhin chng c th c nhng nhc im v vng ph sng b
gii hn, mi ngi s dng u phi nm trong vng c th nghe c ln nhau.

Hnh 4:M hnh mng khng dy adhoc

2.2.Kin trc giao thc mng WLAN theo chun 802.11


802.11 l mt trong nhng chun thuc h 802.x l h chun cho cc mng
LAN. IEEE802.11 c nhiu chun nhng ph bin nht hin nay l ba chun 802.11
a/b/g:
- Chun 802.11b: Hot ng di tn 2.4 GHz, tc truyn d liu l 11Mbps,
l di tn dnh cho cng nghip, khoa hc v y t - ISM (Industrial, Scientific v
Medical). M, thit b hot ng di tn ny khng cn phi ng k v c m
bo bi t chc WECA (Wireless Ethernet Compatibility Alliance).
- Chun 802.11a: Hot ng di tn 5-6 GHz, tc truyn d liu ln n
54Mbps, chun ny ang c mt s hng u t nghin cu thc hin, nhm hy
vng thay th cho chun 802.11b. Chun ny c c im l tc truyn d liu
nhanh hn, nhng c im yu l vng ph sng hp do chun ny s dng di tn
5GHz (di tn cng cao th vng truyn tn hiu cng nh).
- Chun 802.11g: L phin bn nng cp ca 802.11b, c thng qua bi t
chc IEEE. N cng hot ng di tn 2.4GHz nhng tc truyn c th ln ti

17
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

54Mbps. Nhng sn phm p dng chun ny u c th tng thch c vi sn


phm p dng chun 802.11b. Tuy nhin im hn ch ca n l ch truyn thng
c gia nhng i tng nm trong khong cch ngn vi nhau.
V kin trc, chun 802.11 c chia lm 2 lp l lp vt l v lp iu khin
truy cp mi trng truyn MAC. Trong , tng MAC c nhim v l thc hin c
ch iu khin truy nhp mi trng truyn, phn mnh d liu ca ng dng ngi
dng v m ha. Tng vt l c chia lm hai tng con (sublayer) vi hai chc nng
khc nhau. u tin l tng giao thc hi t vt l (Physical Layer Convergence
Protocol - PLCP) c nhim v cm nhn sng mang v cung cp im truy cp dch v
vt l chung. Th hai l tng ph thuc mi trng truyn (Physical Medium
Dependent - PMD) c nhim v qun l vic iu ch (mudulation) tn hiu.

Hnh 5: M hnh phn lp ca mng WLAN theo chun 802.11


By gi chng ta s tm hiu c th tng tng:

2.2.1. Lp Vt L
Chun IEEE h tr 3 phin bn khc nhau ca tng vt l: hai loi s dng
cng ngh sng radio (di tn 2.4GHz) v loi cn li s dng cng ngh hng ngoi.
C ba loi u c chc nng l nh gi knh truyn ri - CCA (Clear Channel
Assessment) v im truy cp dch v vt l. Chc nng CCA xc nh cho tng trn
bit mi trng truyn c ri hay khng. iu ny rt cn thit cho vic iu khin
truy nhp mi trng truyn. Chc nng im truy cp dch v vt l cung cp thng
tin v tc truyn, c lp vi cng ngh truyn thng.
Khi m ti nguyn tn s sng v tuyn ngy cng tr ln cn kit th ngi ta
phi s dng k thut tri ph nhm nng cao hiu nng s dng tn s. Chng ta c
th so snh vi cng ngh truyn thng bng hp, cng ngh truyn thng ra i trc
cng ngh tri ph. Vi truyn thng bng hp, mng ch s dng ph tn s mt
mc hon thnh cng vic. c im ng ch truyn thng bng hp l cng

18
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

sut nh (peak power) cao. V di tn s c s dng truyn d liu cng nh th


cng sut nh li cng ln. iu l m bo cho vic tip nhn tn hiu trong
bng hp khng b li. Mt c im na ca truyn thng bng hp l tn hiu truyn
rt d b tc nghn hay nhiu. y chnh l im bt li ca truyn thng bng hp.
Trong khi , cng ngh tri ph cho php chng ta truyn cng mt lng thng tin
nh bng hp nhng tri ph chng trn mt vng tn s ln hn nhiu. Ngoi ra,
chng ta c th gim c nhiu v tc nghn trong qu trnh truyn d liu. Do bng
tn ca tri ph l tng i rng nn cng sut nh ca n rt thp. Nh vy, c
trng ca k thut tri ph l bng thng rng v cng sut thp. Cng chnh nh hai
c im ny m bn nhn khng mong mun s xem chng nh nhng tn hiu nhiu
(tn hiu nhiu cng c c im bng thng rng v cng sut thp), do c th
trnh c s t m khng cn thit, lm tng thm tnh bo mt khi truyn d liu.
C hai k thut tri ph thng dng nht hin nay l k thut tri ph nhy tn
(FHSS - Frequency Hopping Spread Spectrum) v k thut tri ph dy trc tip
(DSSS -Direct Sequence Spread Spectrum )
2.2.1.1. K thut tri ph nhy tn (FHSS)
K thut tri ph nhy tn l cng ngh cho php nhiu mng khng dy c th
ng thi hot ng trong cng mt vng ph sng bng cch phn chia cho cc mng
s dng nhng dy di tn khc nhau. Trong h thng ny, sng mang s thay i tn
s ty thuc vo mt bng gm nhiu tn s m sng mang c th nhy trong mt
khong thi gian xc nh. Bng ny c gi l chui gi ngu nhin
(Pseudorandom), bn gi s dng chui ny tm tn s truyn cho n. Khong thi
gian m sng mang tn ti mt tn s no c gi l dwell time (tnh bng mili
giy), khong thi gian m sng mang nhy t tn s ny sang tn s khc c gi l
hop time (tnh bng micro giy). Sau khi danh sch tn s c nhy ht, pha gi s
lp li chui Pseudorandom t u. Tt nhin, vic s dng tri ph nhy tn khng
trnh khi vic nhiu, mt mt trong khi truyn. Tuy nhin, do tri ph trn nhiu bng
tn nn nu tn hiu b nhiu trn mt bng tn no vn c th c truyn li tn
s khc. Chun 802.11 xc nh tc truyn d liu ca FHSS l 1-2 Mbps.
trnh hin tng xung t trong mi trng dng chung, h thng nhy tn
s dng mt khi nim gi l knh (channel). Channel thc cht l mt dng nhy
(hop pattern) xc nh c quy nh bi mt t chc c thm quyn ( M l FCC -
Federal Communication Commission) hoc do ng b ha h thng gia cc mng
to ra.

19
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

2.2.1.2. K thut tri ph dy trc tip (DSSS)


DSSS l k thut tri ph c s dng rng ri nht trong cc cc k thut tri
ph v n d ci t v c tc cao. H thng truyn v h thng nhn ca DSSS u
s dng mt tp hp cc tn s c rng l 22 MHz. Cc knh rng ny cho php h
thng DSSS c tc truyn d liu nhanh hn h thng FHSS nhiu.
V nguyn tc hot ng, DSSS kt hp tn hiu d liu ti trm truyn vi mt
chui bit d liu tc cao, gi l chip sequence, mi chip tng ng vi 1 bit trong
dy . Mi chip sequence bao gm ti thiu l 11 chip, tng bit ca dy bit s liu
cn truyn c kt hp vi mt chip sequence, to thnh mt m c gi l m
Baker. K thut DSSS lm gim kh nng b nhiu ca tn hiu.
Tin trnh DSSS bt u vi mt sng mang c iu ch vi mt chui m.
S lng chip trong mt chip sequence s xc nh tri rng ph ca h thng v
tc ca dy bit c bit ny (tnh bng chip trn giy) s xc nh tc truyn d
liu. IEEE 802.11 xc nh tc truyn d liu ca DSSS cng l 1-2 Mbps.
Ging nh FHSS, h thng DSSS cng s dng khi nim knh. Nhng nu
nh FHSS s dng chui nhy xc nh knh th khi nim knh trong DSSS li
c quy c sn. Mi knh trong DSSS l mt di tn s lin tc rng 22 MHz, c
tn s sng mang cch nhau MHz (ging FHSS). V d: Knh 1 hot ng trong di
tn t 2.401GHz n 2.423GHz. Nh vy, cc tn s c s dng truyn d liu
trong knh 1 l 2.412 GHz +/- 11 MHz, 2.412GHz +/- 10 MHz, ..., 2.412 GHz +/-1
MHz.

Hnh 6: Cc knh v di tn s hot ng

20
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Cc knh nm gn nhau trong DSSS s c tn s trng nhau mt lng ng k.


Do , vic s dng DSSS vi cc knh trng lp trong cng mt v tr vt l s gy
nn nhiu h thng, bng thng ca mng s b gim ng k. Do tn s trung tm ca
sng mang c quy nh cch nhau 5 MHz, rng di tn li l 22 MHz, nn trn
cng mt khu vc vt l, cc knh c b tr phi c s knh cch nhau 5 knh,
khong cch tn s trung tm ca 2 knh gn nhau nht ti mt a im l 25 MHz.
V d: knh 1 v knh 6, knh 2 v knh 7, ... c th c b tr cng nhau. V th, ti
a trn cng mt khu vc theo l thuyt cng ch c ti a 3 knh l knh 1, knh 6 v
knh 11 c th c b tr cng nhau. Trong thc t, vn c th xy ra trng mt phn
nh gia cc knh. iu ny cn ph thuc vo thit b s dng v khong cch gia
cc h thng.

Hnh 7: Cc knh khng xung t nhau khi cng mt khu vc

V kh nng chng nhiu khi truyn d liu th so vi FHSS, h thng DSSS


chng nhiu km hn do rng di tn nh hn (22 MHz so vi 79 MHz) v d liu
ca DSSS c truyn ng thi trn ton b bng tn thay v truyn trn mt bng
tn trong mt thi im ca FHSS.
2.2.1.3. K thut s dng hng ngoi
Trong k thut s dng hng ngoi, bc sng ca nh sng nm khong t
850-900 nm. N c th hot ng trong mi trng c nh sng khuch tn, v bn
knh c th thc hin truyn thng gia cc thit b l 10m. Trong iu kin c nh
sng mnh nh nh sng mt tri hay l nhng ni pht nhit mnh, k thut ny
khng th s dng c.

21
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

2.2.2. Lp iu khin truy cp mi trng truyn MAC


2.2.2.1. Giao thc CSMA/CA
Nh chng ta bit, CSMA/CD (Carrier Sense Multiple Access/Collision
Detect) l c ch truy nhp ng truyn trong mng LAN c dy v hot ng rt
hiu. Trong mng c dy, mt my tnh mun truyn mt gi tin, n s lng nghe xem
ng truyn c bn khng. Nu ng truyn bn, n s tip tc lng nghe cho n
khi ng truyn ri th truyn gi tin i vi mt xc sut nht nh. ng thi, trong
lc truyn, n vn tip tc lng nghe m bo khng c xung t xy ra vi gi tin
ang truyn. Nu xung t c pht hin trong qu trnh truyn, my s tm dng
truyn trong mt khong thi gian no , trc khi tip tc truyn gi tin b xung t.
Nh vy theo c ch ny, my tnh c th pht hin ra xung t trong khi truyn d
liu. Nhng vi mng khng dy, do c im l truyn sng trong khng kh, nn
iu ny l khng th thc hin c. Do , mng khng dy phi s dng giao thc
CSMA/CA (Carier Sense Multiple Access/ Collision Avoidance), mt giao thc c
nhiu c im tng t nh giao thc ca mng LAN c dy.
trnh xung t, giao thc CSMA/CA c nhng quy tc nghim ngt hn so
vi CSMA/CD. Khi mt nt mng trong mng mun truyn mt gi tin, n phi lng
nghe xem trong mng c nt mng no ang thc hin truyn tin hay khng (cm nhn
sng mang). Nu mi trng mng ang b chim, nt mng s tnh ton mt khong
tr ngu nhin lp li vic nghe ng truyn. Ngay sau khong thi gian tr ,
nt mng li lng nghe xem mi trng mng c ri hay khng. Chnh nh khong
thi gian tr m nhiu nt mng trong mng s khng c gng truyn tin vo cng
mt thi im. y chnh l cch mng khng dy trnh xung t.
im khc bit ln nht gia hai giao thc ny l CSMA/CA trnh xung t
(cn CSMA/CD pht hin xung t) v s dng gi tin ACK xc nhn vic gi gi
tin thnh cng hay cng. Nu bn gi nhn c gi tin ACK sau khi truyn mt gi
tin th c ngha gi tin n bn nhn thnh cng, ngc li, nu khng nhn c
gi tin ACK, bn gi s coi nh l c tc nghn v s truyn li gi tin.
By gi, chng ta s tm hiu cc thnh phn chnh ca giao thc CSMA/CA:

Cm nhn sng mang (carrier sense):


Cc nt mng trong mng khng dy mun truyn mt gi tin phi kim tra xem
ng truyn c bn hay khng. Nu bn phi tr hon vic truyn li cho n khi ng
truyn ri. Cc nt mng xc nh trng thi ca ng truyn da trn hai c ch:

22
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

9 Kim tra lp vt l xem c sng mang hay khng


9 S dng chc nng carrier sense o l Network Allocation Vector (NAV)
Mt nt mng c th kim tra ng truyn c ri hay khng nh vic kim tra
lp vt l. Tuy nhin, trong nhiu trng hp, ng truyn c th c t trc
thng qua NAV. NAV thc ra mt ng h m gi c cp nht bi cc frame d
liu c gi i trong ng truyn.
V d, trong mt h thng mng WLAN c c s h tng gm 3 nt mng l N1,
N2 v N3. Gi s N1 ang truyn mt frame n N2. Do ng truyn khng dy l
ng truyn chia s da trn qung b nn N3 cng c th nhn c frame. Nhng
trong cc frame ca chun 802.11 c cha mt trng l trng thi gian (Duration
Field). Gi tr ca trng ny l ln cho frame c th truyn c n ch v
gi tin ACK c th v c ni gi. Khi nhn c frame ny, N3 s cp nht gi tr
NAV ca mnh vi gi tr ca trng thi gian trong frame, v s khng thc hin
truyn ngay cho n khi gi tr ca duration trong frame l bng 0. Mt im cn lu
y l cc nt mng ch cp nht NAV ca mnh khi m trng thi gian ca
frame ln hn gi tr NAV m nt mng ang lu gi. V d nu N3 c NAV = 10mili
giy th N3 s ch cp nht NAV nu duration ca frame ln hn 10. Ngc li, n vn
gi nguyn gi tr ca NAV.

Chc nng cng phn tn (DCF-Distributed Coordination Function)


IEEE xc nh c ch truy nhp cho mng 802.11 l DCF hoc PCF. C ch
PCF da trn phng php truy nhp CSMA/CA. Trong c ch hot ng ca DCF,
mt nt mng mun truyn frame phi i mt khong thi gian xc nh sau khi
ng truyn ri. Khong thi gian ny c gi l DIFS (DCF Interframe Space).
Khi m DIFS tri qua, ng truyn c th sn sng cho cc nt mng truy nhp
vo. Trong v d trn, gi s N2 v N3 mun truyn frame sau khi N1 truyn xong.
M N2 v N3 li c cng gi tr NAV, c hai cng thy ng truyn ri. Lc ny kh
nng xy ra xung t l rt ln. V gii quyt vn ny, DCF s dng thut ton
Random Back-Off timer.

23
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Hnh 8: Chc nng cng phn tn DCF


Thut ton Random Back-Off s chn ngu nhin mt gi tr t 0 n gi tr ca
vng ca s tranh chp (CW-Contention Window) vng mu hng trong hnh v.
Gi tr ca CW c th khc nhau, ty theo mc nh ca nh sn xut v n c lu
tr trong NIC (Network Interface Card) ca nt mng. Gi tr Random Back-off thc
cht l khong thi gian m my trm phi ch thm sau khi ng truyn ri v DIFS
tri qua. Gi tr ca khong thi gian s gim i 1 nu sau mi khong thi gian
DIFS, ng truyn vn ri. n khi gi tr ca n gim xung cn 0, nt mng bt
u truyn frame. Tuy nhin, nu c mt nt mng khc truy cp ng truyn trc
khi gi tr Random Back-Off ca nt mng ny gim n 0 th nt mng vn lu gi tr
li (dng ng h) s dng cho ln sau.
Nt mng nhn sau khi nhn c frame thnh cng s gi tr li mt frame
bin nhn cho trm truyn. Mun lm c iu , trm nhn cn phi chim c
ng truyn. trnh kh nng frame ACK b tr hon do phi ginh ng truyn,
frame ACK c php b qua qu trnh Random Back-Off v ch phi i mt khong
thi gian ngn c gi l Short Interframe Space (SIFS) c th truyn. Gi tr ca
SIFS nh hn DIFS m bo nt mng nhn c nhiu c hi chim c ng
truyn gi bin nhn trc cc nt mng khc.

Vn Hidden Terminal v vic s dng cc gi tin RTS/CTS:


Trong c ch CSMA/CA, chng ta cn quan tm n vn l hin tng cui
n (hidden terminal) v trm cui l (exposed terminal).

24
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

9 Hin tng u cui n:

Hnh 9: Hin tng u cui n


Hin tng ny c th c m t nh sau: nt mng B nm trong vng ph
sng ca hai nt mng A v C. Hai nt mng A v nt mng C li khng nm trong
vng ph sng ca nhau. Nt mng A ang truyn mt gi d liu cho B. C cm nhn
knh truyn v do C nm ngoi vng ph sng ca A nn C khng cm nhn c
sng mang ca A. Do , C cng truyn d liu cho B, dn n ti B xy ra xung t.
9 Hin tng trm cui l:

Hnh 10: Hin tng trm cui l


M t hin tng: Nt mng B ang truyn d liu cho nt mng A. Cng lc ,
nt mng C cng mun truyn d liu cho nt mng D nhng nt mng C cm nhn
sng mang thy ng truyn ang bn nn khng truyn na, trong khi n hon ton
c th truyn cho nt mng D.
9 Chc nng cng tc phn tn s dng gi tin iu khin RTS/CTS:
Gi tin RTS cha a ch nt mng nhn v khong thi gian cn thit cho qu
trnh truyn d liu (bao gm thi gian truyn ton b d liu v thi gian gi tin bin
nhn ca nt mng nhn gi li). Khi nhn c gi tin RTS, nt mng nhn s gi tr
li gi tin CTS sau khong thi gian SIFS. Khi nt mng gi nhn c gi CTS, n
bt u truyn d liu cho nt mng nhn sau khong thi gian ch SIFS v ch nt
mng nhn gi tr v gi ACK xc nhn gi thnh cng. Sau khi nhn gi ACK,
nt mng s gii phng NAV bt u mt chu k mi. S dng cc gi tin
RTS/CTS, vn hidden terminal v exposed terminal c th c khc phc.
Vi hin tng u cui n, khi A truyn qung b gi tin RTS cho B, do C
nm ngoi vng ph sng ca A nn khng cm nhn c sng mang, cho rng

25
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

ng truyn ri. Khi nhn c gi tin RTS t A, B s gi phn hi li gi CTS. Lc


ny, C do nm trong vng ph sng ca B nn c th cm nhn c ng truyn
bn, do s khng truyn d liu na.

Hnh 11:C ch RTS/CTS gii quyt vn trm cui n.


Vi hin tng tm cui l, khi B truyn gi tin RTS cho A, C cm nhn c
ng truyn ang bn nn hon li khng truyn d liu cho D. Nhng sau khi A
phn hi li gi tin CTS cho B, do C nm ngoi vng ph sng ca A nn C s khng
nhn c qung b gi tin CTS ca A pht i. V th, C c th ngh rng A ngoi
vng ph sng v c th truyn d liu cho D mt cch bnh thng.

Hnh 12:C ch RTS/CTS gii quyt vn trm cui l.

Chc nng iu khin tp trung (Point Coordination Function - PCF)


PCF l mt c ch truy cp ty chn (ngoi DCF) ca chun 802.11. N cung
cp kh nng phn pht cc frame n v i t AP m khng cn phi cnh tranh ginh
ng truyn (Contention Free).C ch hot ng ca PCF cn phi c mt im truy
cp (Access Point) nn khng c p dng c cho mng adhoc.

26
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Hnh 13: PCF s dng vic hi vng


Trong PCF, thi gian c chia thnh cc khong c gi l cc superframe,
c bt u vi cc frame dn ng (beacon frame). Mi superframe c chia
thnh hai phn l khong khng tranh chp (Contention-free period) v khong tranh
chp (Contention Period). y, AP ng vai tr ca mt b iu phi trung tm
(Point Coordinator), quyt nh trm no phi ch khong thi gian PIFS truy cp
mi trng truyn. PIFS l khong thi gian c s dng trong cc dch v gii hn
thi gian, c gi tr ln hn SIFS nhng nh hn DIFS. iu ny cho php cc trm
PCF c th truy nhp ng truyn trc cc trm DCF nhng vn m bo cho cc
frame iu khin nh ACK frame c c hi ginh ly ng truyn.
Nhn trn hnh v, thi im t0, khong khng tranh chp c bt u. Tuy
nhin, do ng truyn mng ang bn, AP khng truy cp mi trng truyn. n
thi im t1, khi ng truyn mng ri, AP phi ch mt mt khong thi gian PIFS
na mi bt u truy cp vo mi trng truyn. Lc ny, c hai kh nng xy ra: nu
trm nhn c d liu D t AP gi xung v mun truyn d liu, n s gi li cho
AP d liu cn gi U. Ngc li, nu trm nhn khng mun gi d liu, sau khong
thi gian SIFS, AP s khng nhn c d liu no t trm . Trong hnh, c 4 trm
khng dy. Ban u, AP cho php trm 1 truyn d liu bng cch gi cho trm 1 gi
d liu D1, sau khong thi gian SIFS, AP nhn c gi U1 t trm 1 do trm 1 cng
mun truyn d liu. Sau khi nhn c d liu t trm 1, ch thm khong thi gian
SIFS na, AP ch nh trm 2 truyn d liu. Trm 2 cng mun truyn d liu nn
truyn tr li cho AP gi U2. Sau AP li ch nh cho trm 3 truyn d liu. Nhng

27
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

trm 3 khng mun truyn d liu nn AP khng nhn c d liu t trm 3.Sau
khong thi gian PIFS, AP li cho php trm 4 truyn d liu. Trm 4 cng mun gi
d liu nn gi li cho AP gi U4. Khi m khong thi gian khng tranh chp sp ht,
AP s dng tn hiu Cfend (Contention Free end). Ta c th thy, ti mi thi im ch
c mt trm c truy cp mi trng truyn, n c th gi hoc khng gi d liu.
Cc trm c khong thi gian truy cp mi trng truyn ring, khng trng nhau v
do AP ch nh. Do , trong khong thi gian khng tranh chp, khng c xung t
xy ra.

2.2.3. Lp qun l tng MAC


Lp qun l tng MAC ng vai tr trung tm trong cc trm IEEE 802.11. N
cung cp mt vi chc nng nh ng b ha (Synchronization), Qun l nng lng
(Power Management) v Qun l chuyn vng (Roaming).
2.2.3.1. ng b ha (Synchronization)
ng b ha c vai tr quan trng trong cc chc nng ca tng lin kt d liu
nh chc nng qun l nng lng, chc nng cng tc trong k thut PCF v chc
nng ng b nhy tn trong cc h thng tng vt l s dng k thut FHSS.
Vic ng b thi gian gia cc trm trong mt BS c thc hin bng vic gi
mt gi tin beacon cha nhn thi gian v thng tin qun l khc. Nhn thi gian trong
gi tin Beacon gip cc trm iu chnh li ng h ca mnh. Theo thi gian, ng h
ni b ny c th thay i, do c sau mt khong thi gian nht nh, cc trm li
phi iu chnh li ng h ca mnh. Khong thi gian gi l beacon interval.
i vi mng c c s h tng, trm truy cp c s m nhn vic ng b ha
bng cch pht gi tin beacon theo nh k mi trm trong mt BS iu chnh li
ng h ni b ca mnh.

i vi mng adhoc, iu ny c phn phc tp hn do mng khng c trm truy


cp c s thc hin vic ng b. Mi nt mng trong mng s pht i gi tin
beacon sau mi khong beacon. V trnh xung t, cc thut ton back off chun
c p dng lm gim kh nng ng , m bo mt nt mng c th gi c
gi tin beacon v cc nt mng khc ng b thi gian theo gi .

28
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

2.2.3.2. Qun l nng lng (Power Management)

Cc thit b khng dy s dng pin l ngun cung cp nng lng. Do , vic


qun l nng lng nhm tit kim, trnh lng ph ng vai tr quan trng trong vic
ko di thi gian lm vic ca thit b, tin li cho ngi dng. tit kim nng
lng, IEEE 802.11 a ra tng thit lp hai trng thi cho mt trm: trng thi
ngh v trng thi lm vic.

Qu trnh qun l nng lng ca mng khng dy c c s h tng n gin hn


mng adhoc nhiu. Trm truy cp c s c nhim v lu li mi frame cho cc trm s
dng c ch tit kim nng lng trong mng n qun l. Khi , trm truy cp c s
s gi mt gi tin beacon trong c cha nh x nh danh truyn thng (Traffic map
Indication Map TIM) gm danh sch cc trm c d liu cn gi n. Chc nng
ng b thi gian m bo cc trm u phi thc nhn gi tin ny. ng thi
i chiu xem mnh c tn trong nh x nh danh truyn thng khng. Nu c tn ti,
n s gi nguyn trng thi thc v thc hin qu trnh nhn d liu. Ngc li, trm
s tr li trng thi ngh v ch gi beacon k tip.

i vi mng adhoc, do khng c trm truy cp c s nn cc nt mng phi t


lu li d liu mnh mun gi v gi nh danh ca trm cn gi d liu n cc trm
xung quanh trong giai on n thc nh s dng nh x nh danh truyn thng adhoc
(Adhoc Traffic Indication Map ATIM).

2.2.3.3. Qun l chuyn vng (hand-off)

Trong mt khu vc ln, mng khng dy cn lp nhiu trm truy cp c s c


th m rng vng ph sng, gip ngi s dng c th truy cp ti bt k im no
trong khu vc . Khi mt thit b khng dy di chuyn gia cc im trong khu vc,
cn c mt c ch qun l vic chuyn vng m bo tnh truyn thng ca thit b
khng b gin on. Vic chuyn vng ny c thc hin theo cc bc:

- Mt trm nhn thy tn hiu lin kt gia mnh vi trm truy cp c s l qu


yu (tn hiu qu yu), n s tm kim mt trm c s khc cung cp dch v vi mt
lin kt tt hn.

29
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

- Trong qu trnh qut tn hiu mng c chia lm hai dng l qut ch ng v


qut b ng. Qut ch ng l my trm trc tip pht i mt gi tin tn hiu n mi
knh truyn v ch i phn hi t cc knh truyn . Qut th ng l my trm
nghe mi trng truyn tm ra mt BS mi.

- Sau khi nhn c tn hiu phn hi, trm cn chuyn vng s chn my trm
c s cung cp dch v lin kt tt nht n n v gi mt yu cu cung cp dch v.

- Trm truy cp c s s tr li yu cu ca my trm chuyn vng. Nu chp


nhn th my trm chuyn vng s gia nhp mt BS mi. Ngc li, n s phi qut li
tm mt my trm c s mi chp nhn cho n tham gia vo BS mi.

30
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Chng 3: nh tuyn trong mng adhoc


3.1. Gii thiu v thut ton nh tuyn
Trong mt h thng mng, mt trong nhng yu t nh hng ln nht n hiu
sut ca mng l thi gian truyn cc gi tin t im u n im cui sao cho
nhanh v chnh xc nht. t c iu th tng mng c nhim v l tm ng
i, xc nh cc router trung gian chuyn gi tin t im u n im cui. Cc
thut ton gip xc nh ng i nh vy gi l thut ton nh tuyn. Nh vy chc
nng ca thut ton nh tuyn chnh l xc nh ng i tt nht cho gi tin t bn
gi n bn nhn.
i vi mng khng dy c c s h tng, vic truyn thng gia cc nt mng
trong mng ph thuc rt nhiu vo base station. Cc nt mng mun lin lc vi nhau
u phi nm trong vng ph sng ca base station (nu mt nt mng m nm ngoi
vng ph sng ca base station th n khng th no lin lc c vi cc nt mng
khc). Nhng vi mng adhoc th li khc. Cc nt mng d nm ngoi vng ph sng
ca nhau vn c th lin lc c vi nhau thng qua cc nt mng trung gian. Do ,
vic tm ra cc nt mng trung gian truyn gi tin gia nt mng u v nt mng
cui l rt quan trng.
Ngoi ra, mt s c im khc bit ca mng adhoc so vi cc mng khc nh
cc nt mng c th di ng, dn n topo mng thay i theo; bng thng ca mng
cng thay i lin tc, tc truyn tn hiu ca mng ph thuc nhiu vo tnh cht
vt l ca cc nt mng v giao din mng, ... Chnh nhng c im ny lm cho vic
thit k cc giao thc nh tuyn cho mng adhoc l mt bi ton kh.

3.2.Yu cu ca thut ton nh tuyn cho mng khng dy adhoc


Nh trnh by trn, do cc c im khc bit ca mng adhoc, chng ta
khng th p dng cc thut ton nh tuyn truyn thng nh Trng thi lin kt
(Link State) hay Vector khong cch (Distance Vector) cho mng adhoc c. C hai
thut ton ny u yu cu cc router qung b thng tin nh tuyn theo kiu nh k.
Nhng hot ng ny hn ch kh nng thch ng ca giao thc vi cc thay i ca
topo mng. Nu khong thi gian nh k kh ngn, giao thc s hot ng khng hiu
qu bi n phi lm vic nhiu hn so vi s thay i ca topo mng v gy lng ph
bng thng v nng lng ca cc nt mng mt cch khng cn thit. Cn nu thi
gian nh k qu di, giao thc s khng phn ng kp vi s thay i ca topo mng.

31
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Vi thut ton Link State, cc router s gi thng tin qung b nh k v cc


hng xm v gi ca ng i ti cc hng xm n tt c cc router trong mng. T
, cc router s bit c ton b topo ca mng tnh ton ng i ti ch ngn
nht c th.
Cn vi thut ton Distance Vector, mi router li gi nh k cc thng tin
khong cch t n n cc router khc. Bng vic tnh ton, so snh khong cch t
mi hng xm n mt ch no , cc router s quyt nh tuyn ng i ngn nht
n nt mng ch.
Nh vy, nu s dng cc thut ton thng thng vi mng adhoc c th dn
n mt lot cc vn sau:
- c im u tin ca cc thut ton nh tuyn thng thng khng ph
hp vi mng adhoc. l vic cc router lin tc gi qung b nh k n cc nt
mng trong mng. Vic gi qung b nh tuyn nh k gy ra hai vn sau:
o Th nht, n s gy lng ph bng thng cho cc nt mng trong mng
adhoc. C nhng khi khng c s thay i no trong mng nhng cc router tip tc
gi cc cp nht thng tin nh tuyn theo nh k lm cc nt mng phi tnh ton li
cc tuyn ng. Nu trong vng ph sng ca mt nt mng c qu nhiu nt mng
khc th nt mng ny phi nhn rt nhiu thng tin cp nht nh tuyn. iu ny gy
lng ph bng thng mt cch khng cn thit.
o Th hai, vic gi cc cp nht nh tuyn theo nh k cng gy lng ph
nng lng khng cn thit cho cc nt mng trong mng. Chng ta bit nng
lng ca cc nt mng trong mng adhoc ch yu l pin. Vic s dng nng lng
mt cch tit kim v hp l l rt cn thit. Nu cc nt mng phi gi qung b nh
tuyn theo nh k s tn rt nhiu nng lng, bi nng lng gi mt gi tin
khng phi l nh. Bn cnh , vic nhn mt gi tin tn t nng lng nhng vic
phi cp nht, tnh ton cc tuyn ng li cn tr vic tit kim nng lng ca cc
nt mng.
- cc mng thng thng, lin kt gia hai nt mng trong mng hoc gia nt
mng vi base station l cc lin kt i xng. Trong khi , lin kt gia hai nt
mng ca mng adhoc c th l lin kt khng i xng, ngha l vic truyn thng
gia hai nt mng khng th thc hin tt trn c hai hng. L do l v kh nng
truyn tn hiu ca cc nt mng l khc nhau: nt mng no c nng lng truyn tn
hiu mnh th nt mng c lin kt tt vi cc nt mng nhn tn hiu ca n,

32
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

ngc li, nt mng c nng lng truyn tn hiu yu th kh nng khng lin kt
c vi cc nt mng nhn tn hiu l kh trnh khi, nu c lin kt c th
cng ch l nhng lin kt yu, khng n nh. Do , giao thc nh tuyn thng
thng khng th hot ng trong mi trng mng nh vy.
- Mt c im na ca mng adhoc lm chng ta khng th p dng c cc
thut ton nh tuyn thng thng cho n. l trong mng adhoc tn ti nhiu lin
kt d tha. Vi mng c dy truyn thng, ngi ta thng ch dng rt t cc router
ni hai mng vi nhau. V th cc tuyn ng d tha trong mng c dy l khng
nhiu v cc thut ton nh tuyn thng thng vn tnh n c nhng lin kt .
Nhng vi mng adhoc li khc. Mi nt mng li ng vai tr nh mt router, mng
adhoc c bao nhiu nt mng th c by nhiu router. iu ny lm cho vic truyn d
liu t nt mng ngun n nt mng ch c th phi i qua nhiu hn mt nt mng
trung gian, v tuyn ng m d liu di chuyn cng khng phi l duy nht. Bn
cnh tuyn ng tt nht vn c th tn ti nhiu tuyn ng khc c th hot ng
bnh thng. Vi mng c qu nhiu tuyn ng d tha nh vy, cc thut ton
nh tuyn nu tnh c n chng s lm cho vic cp nht v tnh ton tuyn ng
tr ln nhiu hn. iu l khng cn thit.
- Mt vn cui cng quan trng hn c, l cc thut ton khng c
thit k dnh cho mng c topo ng nh ca mng adhoc. Vi mng c dy truyn
thng, lin kt gia cc router gn nh l khng i, gi (cht lng) ca mt lin kt
c th thay i do tc nghn ch v tr ca cc router l c nh trong cu trc mng.
Nhng trong mng adhoc, iu li khng h c.
Vi nhng vn nu ra trn, chng ta c th rt ra c mt s yu cu vi
cc thut ton nh tuyn cho mng adhoc:
- Thut ton phi c thit k sao cho ph hp vi tnh ng ca topo mng v
cc lin kt bt i xng.
- Hot ng phn tn: cch tip cn tp trung cho mng adhoc s tht bi do s
tn rt nhiu thi gian tp hp cc thng tin trng thi hin ti ca mng tnh
ton ri li pht tn li n cho cc nt mng. Trong thi gian , cu hnh mng c th
thay i rt nhiu.
- Tnh ton n vn nng lng v bng thng ca mng: Do cc nt mng c
ngun nng lng hn ch nn cn phi tnh ton n vn tit kim nng lng.
Giao thc nh tuyn c th cung cp yu cu bo tn nng lng cc nt mng khi

33
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

c th. Bng thng ca mng cng cn c tnh n trnh gy lng ph bng thng
khng cn thit.
- Khng xy ra hin tng lp nh tuyn: Hin tng ny xy ra khi mt
phn nh cc gi tin di chuyn vng vng quanh mng trong mt khong thi gian no
. Gii php a ra c th l s dng b m chng trong mi gi tin. Mi khi gi tin
di chuyn n mt nt mng mi, b m chng s tng ln mt, v n mt gi tr
no th gi tin s b loi b.
- Thit lp nhng cm mng nh: Nu giao thc nh tuyn c th xc nh c
cc nt mng gn nhau v thit lp chng thnh mt cm mng nh th s rt thun
tin trong nh tuyn. Nu cc nt mng n di chuyn nhanh hn th cc cm mng
li n nh hn. Do , nh tuyn trong cc cm mng s n gin hn rt nhiu.

Hnh 14: V d v cc cm mng nh trong mng adhoc

- Bo mt: Giao thc nh tuyn ca mng adhoc c th b tn cng d dng


mt s dng nh a ra cc cp nht nh tuyn khng chnh xc hoc ngn cn vic
chuyn tip gi tin, gin tip gy ra vic t chi dch v dn n gi tin khng bao gi
n c ch. Chng cng c th thay i thng tin nh tuyn trong mng, cho d
cc thng tin l khng nguy him nhng cng gy tn bng thng v nng lng,
vn l nhng ti nguyn qu him trong mng adhoc. Do vy cn c nhng phng
php bo mt thch hp ngn chn vic sa i hot ng ca giao thc.

34
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

3.3. Phn loi cc thut ton nh tuyn cho mng adhoc


C rt nhiu giao thc nh tuyn trong mng khng dy adhoc. Vi mi cch
tip cn khc nhau th li c mt cch phn loi khc nhau. Song nhn chung c th
phn thnh hai loi chnh l nh tuyn iu khin bng bng ghi (Table-Driven
Routing Protocols) v nh tuyn theo yu cu khi pht t ngun (Source Initiated
On-demand Routing).
- nh tuyn iu khin theo bng ghi: phng php ny c gng duy tr thng tin
nh tuyn cp nht lin tc t mi nt mng n mi nt mng khc trong mng. Cc giao
thc loi ny yu cu mi nt mng lun duy tr mt hoc nhiu bng ghi lu tr thng
tin nh tuyn, v chng p ng nhng thay i trong topo mng bng cch pht qung b
rng ri cc thng tin cp nht tuyn qua mng duy tr tm kim sot mng mt cch lin
tc, duy tr mt ci nhn nht qun v mng. Cc vng no khc nhau v s bng ghi lin
quan n nh tuyn cn thit v cc phng thc thay i cu trc mng s c pht
qung b cho tt c mi nt mng u c th bit c
- nh tuyn theo yu cu khi pht t ngun: Phng php ny ch to ra cc
tuyn khi nt mng ngun cn n. Khi mt nt mng yu cu mt tuyn n ch, n
phi khi u mt qu trnh khm ph tuyn. Qu trnh ny ch hon tt khi tm ra
mt tuyn sn sng hoc tt c cc tuyn kh thi u c kim tra. Khi m mt tuyn
c khm ph v thit lp, n c duy tr bi mt s dng th tc cho n khi
tuyn khng th truy nhp c t nt mng ngun hoc l khng cn cn thit n
n na.
Sau y, ti xin trnh by mt s giao thc nh tuyn ph bin trong mng
adhoc:

3.3.1. DSDV (Destination Sequence Distance Vector)


DSDV l giao thc nh tuyn theo bng, da trn vector khong cch theo
chng. K thut ny vn gi c nhng nt c in ca thut ton Bellman-Ford
nhng c ci tin loi b kh nng sinh ra vng lp trong cc bng nh tuyn
ph hp vi mng adhoc.
Trong thut ton ny, mi nt mng s duy tr mt bng nh tuyn cha cc nt
mng ch c th n trong mng v s chng ti mi ch trong mng. duy tr tnh
nht qun trong mng, DSDV yu cu cc nt mng pht qung b nh k cc cp
nht nh tuyn ti cc nt mng hng xm v pht ngay cc cp nht khi c nhng
thay i quan trng xy ra trong mng. Ngoi trnh vic cc thng tin nh tuyn

35
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

c pht qung b qu nhiu khi topo mng c nhng thay i nhanh, DSDV s
dng mt c ch hm cc cp nht tc thi khi c cc thay i qu nhanh xy ra trong
mng. Vi c ch ny, DSDV s dng hai loi thng ip cp nht: cp nht y
cha tt c thng tin nh tuyn hin c v cp nht thng tin b sung mang nhng
thng tin v nhng thay i t ln cp nht y gn nht. lm c iu ny,
DSDV s dng hai bng ghi khc nhau, mt chuyn tip cc gi tin, mt pht
cc gi tin cp nht b sung. Thc t, nu nhng thay i trong mng khng xy ra
mt cch thng xuyn th nhng thng ip cp nht y s t c s dng. Thay
vo l nhng gi tin cp nht b sung. Do , cc nt mng di ng cng phi s
dng mt bng ghi nh nhng thng tin ca cc gi cp nht b sung ny.
Ngoi ra trnh lp tuyn, DSDV cn s dng s th t gn vi mi ng. S
th t ny xc nh mi ca tuyn ng, cho php cc nt mng di ng c th
phn bit c cc tuyn ng mi v cc tuyn ng c. S th t ca tuyn
ng c tng ln 1 mi khi c mt tuyn ng mi c pht qung b. ng
c s th t cao hn c xem l tt hn. Nu hai ng c cng s th t, ng no
c s chng t hn s c s dng. Khi c mt lin kt hng (nt mng khng nhn
c cc qung b nh k), trong ln qung b sau, nt mng pht hin ra lin kt
hng s pht qung b ng ti ch c s chng l v cng v tng th t ng.

Next Install Stable


Destination Metric Seq.No
Hop Time Data

A A 0 A-864 001000 Ptr_A

B B 1 B-470 001200 Ptr_B

C B 3 C-920 001500 Ptr_C

D B 4 D-502 001200 Ptr_D

Hnh 15: V d v bng nh tuyn khi dng thut ton DSDV


Trn y l hnh v miu t mt bng nh tuyn trong DSDV. Trong , next
hop l chng tip theo, metric l s cc chng ti ch, Seq.no l s thc t ca
qung co cui cng ti nt mng v install time l thi gian ng c ci t ln
u tin. Ngoi ra, bng cn cha cc trng nt mng ch (Destination) v thi gian
tn ti ca cc ng (Stable Data).

36
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

3.3.2. AODV (Adhoc On-Demand Distance Vector Routing)


AODVl giao thc nh tuyn da trn giao thc DSDV c trnh by trn.
N cng c pht trin bi C. Perkins v S. Das ti trung tm nghin cu Nokia
thuc trng i hc California v i hc Cincinnati. Ging nh DSDV, AODV cng
loi b c vn lp nh tuyn ca cc giao thc Distance Vector khc bng vic
dng s th t gn vi mi ng. Tuy nhin, nu nh DSDV lun duy tr mt danh
sch cc tuyn ng hon chnh, AODV ch to ra cc tuyn ng khi c yu
cu. iu ny gip n ti thiu ha c vic pht qung b trong mng. Mi nt
mng trong mng s duy tr mt bng ghi nh tuyn cha thng tin v ng i (nh
a ch ch, s th t ch, s chng, chng tip theo, thi gian tn ti ca ng, cc
nt mng hng xm, thng tin ghi nhn cc yu cu c x l) m nt mng giao
tip. Vi nhng nt mng khng nm trn ng i n ch th khng cn phi duy
tr thng tin nh tuyn hoc tham gia vo vic trao i cc bng nh tuyn. pht
hin v duy tr lin kt, AODV s dng cc thng ip khc nhau l Route REQuest
(RREQ) v HELLO.
Khi nt mng ngun mun gi mt gi tin n nt mng ch m tuyn ng
cha c xc lp, n s gi thng ip yu cu tuyn ng RREQ n tt c cc nt
mng hng xm. Qu trnh ny ch dng li khi gi RREQ ti c ch hoc mt nt
mng c ng i ti ch. Ti cc nt mng i qua, RREQ cng lu nh danh cc
nt mng to ng quay tr v ngun tm thi. ng thi, cc nt mng cng lu
nh danh ca cc RREQ nhn loi b cc RREQ c gi li.

Hnh 16: Qu trnh truyn ca RREQ


Khi RREQ ti c ch hoc nt mng c ng ti c ch, gi tin tr li
Route REPly (RREP) c khi to v c chuyn v nt mng ngun theo tuyn

37
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

ng tm thi m gi RREQ thit lp. Trong qu trnh , RREP thit lp ng


hng n ch ti cc nt mng chuyn tip. Khi RREP n c nt mng ngun
cng l lc tuyn ng t ngun ti ch c thit lp. Nu nt mng ngun khng
nhn c gi tin RREP, nt mng s gi li thng ip RREQ hoc gi thit khng
c ng ti ch. Mt khc, do RREP c chuyn tip dc theo cc tuyn ng
c RREQ thit lp nn AODV ch c th h tr tm ng i qua cc lin kt i
xng.

Hnh 17: ng i ca gi tin RREP tr v ngun


cm nhn v duy tr cc lin kt, AODV s dng thng ip HELLO pht
qung b nh tuyn n cc hng xm. Thng ip ny cho bit s tn ti ca nt
mng v lin kt ti nt mng vn hot ng. Khi thng ip HELLO khng n
c nt mng hng xm no , iu chng t lin kt b hng. Nt mng gi
HELOO s nh du lin kt n hng xm l hng v gi thng ip Route
ERRor (RERR) bo li ti tt c cc nt mng lin quan. Vic pht hin li ny l do
lp vt l v lp lin kt thc hin.

3.3.3. DSR (Dynamic Source Routing)


DSR l thut ton nh tuyn ph bin trong mng adhoc hin nay. So vi cc
thut ton nh tuyn khc, n c nhng im vt tri hn nh: khng pht qung b
nh tuyn nh k, h tr tm ng i qua c cc lin kt khng i xng v ph hp
vi tnh ng ca topo mng. DSR chia c ch nh tuyn thnh hai phn l c ch tm
kim ng i (Route Discovery) v c ch duy tr tuyn ng (Route Maintenance).
DSR s dng k thut nh tuyn ngun (source route). Theo , khi mun gi
mt gi tin, mt tuyn ngun s c hnh thnh v lu tiu ca gi tin. Tuyn

38
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

ngun ny cha mt danh sch c th t v y v cc nt mng cn i qua ti


ch. Do , cc nt mng trung gian ch cn duy tr lin kt vi cc nt mng hng
xm chuyn tip cc gi tin. Nt mng ngun th cn bit ton b th t tuyn
ng n ch.
Mi nt mng u duy tr mt b nh gi l route cache lu cc tuyn ng
khi u t nt mng ny m n tm c. Khi c yu cu v tm ng i, nt mng
s kim tra trong route cache c tuyn ng m n mong mun hay khng. Nu c,
tuyn ng ny s c s dng truyn gi tin. Ngc li, c ch tm kim ng
i s c khi ng bng vic pht qung b i mt gi tin yu cu ng (Route
Request). Khi mt nt mng nhn c gi tin yu cu, n s kim tra trong route
cache ca mnh c a ch nt mng ch hay khng. Nu khng c, n li chuyn gi
tin sang nt mng hng xm ca mnh, ng thi, b sung a ch ca n vo th t
chng c lu trong gi tin yu cu. Gi tin yu cu c truyn trong mng cho ti
khi ti c nt mng ch hoc nt mng c cha ng i n nt mng ch. Khi
ng c tm thy, gi tin tr li (route reply) cha ton b tuyn ng s c
gi tr li nt mng ngun. Lc ny cng cn phi c mt c ch loi b gi tin
Route Request trnh cho n truyn v hn trong mng. Do , DSR thm vo tiu
ca gi mt trng time-to-live. Mi khi qua mt nt mng, trng time-to-live s
c tng ln mt, khi time-to-live vt qu mt gi tr no , n s b loi b. Ngoi
ra gim thi gian tm kim ng, cc nt mng thng xuyn b sung nhng
tuyn ng mi m n hc c trong qu trnh cc nt mng khc chn ng.
Trong qu trnh s dng route cache ghi d liu, cc nt mng vn c th theo
di s thay i ca cc lin kt thng qua c ch duy tr tuyn ng. C ch duy tr
tuyn ng thc hin bin nhn theo chng hoc bin nhn u cui, km theo l
c ch thng bo li khi c lin kt b t gy. Khi gi tin Route Error c gi v nt
mng ngun, n s xo b lin kt b hng ra khi route cache v tt c cc ng c
cha chng ny c ct ti im c lin kt hng. Ngoi ra, cc nt mng trung gian
chuyn tip gi tin route error c th cp nht route cache theo cch tng t.

39
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Hnh 18: Qu trnh tm kim ng ca DSR

Hnh 19: Gi tr li tuyn ng v cho nt ngun

3.3.4. TORA (Temporally Ordered Routing Algorithm)


TORA l giao thc nh tuyn phn b khng lp vng v thch nghi cao da
theo phng thc o ngc cc lin kt. TORA c xut cho mi trng ni
mng c tnh linh ng cao. Giao thc c thit k pht hin ng theo yu cu,
cung cp nhiu ng, thit lp ng nhanh v ti thiu ha chi ph truyn thng
bng cch cc b ha phn ng ca gii thut i vi cc thay i cu hnh khi c th.
Giao thc ch phn ng khi tt c ng ti ch b mt. Giao thc thc hin ba chc
nng c bn: to tuyn, duy tr tuyn v xa tuyn. Ging nh cc giao thc o ngc
lin kt khc, vic to ng v c bn l thc hin gn cc hng cho cc lin kt
trong mt mng hoc phn mng v hng hnh thnh nn th c hng khng c
vng lp (Directed Acyclic Graph - DAG) c gc t ti ch.
TORA gn cho mi nt mng trong mng mt cao tng ng. Cc thng ip
trong mng c truyn t cc nt mng c cao ln hn n cc nt mng c

40
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

cao thp hn. pht hin tuyn ng, TORA s dng hai gi tin truy vn
(QUERY) v cp nht (UPDATE). Khi mt nt mng cn ng i n ch, n s
pht qung b gi tin truy vn QUERY. Gi tin s c truyn qua mng cho n khi
gp nt mng ch hoc gp nt mng c ng i n nt mng ch. Khi nt mng
no nhn c gi tin truy vn QUERY, n s gi phn hi tr li gi tin cp nht
(UPDATE) c cha trng s ca nt mng . Cc nt mng nhn c gi tin cp
nht ny s phi thit lp li trng s ca n ln hn trng s ca nt mng hng xm
gi gi tin cp nht cho n.
C ch duy tr tuyn ng thc ra chnh l phn ng ca TORA vi cc thay
i cu hnh trong mng. Khi mt nt mng no pht hin ra ng i ti ch
khng cn hp l, n s iu chnh cao ca mnh l ln nht so vi nt mng hng
xm, ng thi pht i mt gi tin UPDATE. Cc tuyn ng c o ngc
phn nh nhng thay i thch nghi vi mc tham chiu mi. Vic ny c hiu qu
ging nh s o hng ca mt hay nhiu tuyn ng khi mt nt mng khng c
tuyn ng xung cc nt mng di. Khi m c nt mng no khng cn tuyn
ng i n nt mng ch, n s b nh du l v hng v b xa ra khi ng i.
Vic xa cc tuyn khng cn hiu lc ca TORA bao gm vic pht qung b i
thng ip CLEAR ti ton mng.

41
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Chng 4: nh gi hiu sut cc giao thc nh tuyn bng b m


phng mng NS2

4.1. Gii thiu b m phng NS2[4],[5]


NS2 l b m phng mng vn hnh theo s kin ri rc (Discrete Event-Drivent
Simulator), c pht trin nh mt phn ca d n VINT (Virtual Internet Testbeb).
N c xy dng da trn hai ngn ng l C++ v OTcl. Phn nhn ca n t thay
i c vit bng ngn ng C++, bao gm cc module thc hin m phng v cc
chc nng c bn nht ca mng. Phn v c vit bng ngn ng Otcl, l mt dng
ngn ng kch bn, thc hin vic nh cu hnh v iu khin m phng.

Hnh 20: Tin trnh hot ng ca mt trnh m phng


Hnh trn cho ta thy, NS2 l b thng dch ngn ng kch bn hng i tng
Otcl bao gm b lp lch s kin, cc thnh phn mng v cc module thit t mng.
ci t v chy chng trnh, ngi ta phi vit mt chng trnh m phng bng
ngn ng kch bn Otcl. Chng trnh ny s khi to b lp lch, thit lp cu hnh
mng vi cc i tng mng v cc hm thit t mng. Trong qu trnh chy chng
trnh, chng ta c th quan st trc quan cc s kin qua cng c NAM. Khi kt thc
qu trnh chy, kt qu m phng s c ghi li trong cc file vt (trace file). Chng
ta c th nh gi, phn tch mng thng qua cc file ny.
Ngy nay, NS2 c th coi l mt cng c quan trng nghin cu, thit k v
m phng mng. Vi nhng mng quy m ln, vic thit k, nh gi hiu sut mng
trc khi trin khai l v cng quan trng v n gip hn ch xy ra cc s c nh c
nghn mng hay hiu sut mng khng c nh mong mun. V l mt phn mm
m ngun m nn n c th ci c trn c Windows 32 bit hay Linux. Cng ng s

42
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

dng NS2 cng rt ln: trn mt nghn trng i hc, vin nghin cu, ... vi hn
mi nghn ngi s dng trn ton th gii.

4.2. Kh nng m phng cc mng ca NS2


NS2 c th h tr nhng ngi nghin cu mng nhng im sau:
- Kh nng tru tng ha: gip nghin cu cc giao thc mng nhiu mc
khc nhau, t hnh vi n l ca mt giao thc n kt hp ca nhiu lung d liu v
tng tc ca nhiu giao thc. iu ny gip ngi nghin cu c th d dng so snh
v phn tch cc kt qu chi tit vi tru tng.
- Kh nng tng tc vi mng thc: Cho php chng trnh m phng ang
chy tng tc vi cc nt mng ang hot ng.
- Kh nng to ng cnh: Ngi nghin cu c th to cc mu lu lng, cc
hin trng mng phc tp v cc s kin ng nh li lin kt mt cch d dng. iu
ny gip cho vic nghin cu, kim chng cc giao thc mng trong cc m hnh
mng khc nhau c ng n hn.
- Kh nng trc quan ha: Thng qua cng c NAM, ngi nghin cu c th
nhn trc quan cc hot ng ca mng, t d dng hiu c cc hnh vi phc tp
ca m phng mng.
- Kh nng m rng c: NS2 cho php m rng cc chc nng mi mt cch
d dng; v d thm nt mng, thay i cc giao thc truyn d liu, ... V th c th
thc hin nghin cu cc giao thc mi.

4.3. M phng mng adhoc v cc giao thc nh tuyn trong mng


adhoc
4.3.1. M phng mng adhoc
Cc mng adhoc c m t da trn hai m hnh l m hnh di chuyn th hin
s chuyn ng ca cc nt trong mng v m hnh truyn thng th hin khun dng
truyn thng gia cc nt trong mng.
4.3.1.1. Cc m hnh di chuyn
C ba m hnh tiu biu m phng mng adhoc trong NS2 l: Random
Waypoint, Random Walk, v Random Direction.

43
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

- M hnh Random Waypoint:


Theo m hnh ny, c hai khi nim l thi gian tm dng (khong thi gian m
mt nt khng thay i v tr ca mnh) v tc di chuyn ca nt t v tr ny sang
v tr khc. Bn tham s c s dng xy dng m hnh ny l: Speedmin(tc
nh nht), Speedmax(tc ln nht), Pmin(thi gian tm dng nh nht), Pmax(thi gian
tm dng ln nht).
Ban u nt mt v tr bt k trong khu vc m phng v thi gian tm dng
ca n l P1 (P1 c chn theo phn b ng u trong [Pmin, Pmax]). Sau khi ht
khong thi gian P1, nt s di chuyn n v tr mi trong khu vc m phng vi tc
c chn trong [Speedmin, Speedmax]. Sau qu trnh li tip tc c lp li. M
hnh ny rt linh ng, n m t theo cch ngi ta di chuyn trong cc hi ngh. y
l m hnh ph bin nht trong cc nghin cu v mng adhoc.
- M hnh Random Walk :
M hnh m phng chuyn ng ngu nhin ca cc thc th trong t nhin. Nt
mng di chuyn t v tr hin ti n v tr khc bng vic chn ngu nhin mt hng
[0o,180o], vi tc [Speedmin, Speedmax] trong khong thi gian l travel_time
(khong thi gian di chuyn). Khng c khi nim khong thi gian tm dng trong
m hnh ny.
Trong m hnh ny, tham s thay i hng ca nt di ng quyt nh n
phc tp ca mng. Tham s ny cng ln th mng cng phc tp.
- M hnh Random Direction:
Nt mng s chn mt hng ngu nhin, di chuyn vi tc c phn b
ng u trong khong [Speedmin,Speedmax]. Khi n bin ca khu vc m phng, nt
mng s dng li trong mt khong thi gian [Pmin, Pmax] trc khi chn mt
hng khc v tip tc qu trnh. M hnh ny c xy dng khc phc s trung
bnh cc hng xm cao v t thay i trong m hnh Random Waypoint vi s tp
trung ca cc nt ti trung tm khu vc m phng. S chng trung bnh ca cc gi tin
d liu s dng m hnh Random Direction s nhiu hn s chng trung bnh ca cc
m hnh mng khc.
4.3.1.2. M hnh mng truyn thng
Cc m hnh truyn thng c m t trong NS2 gm hai loi l: b to truyn
thng (traffic generator) v cc ng dng m phng (simulated application). Cc b

44
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

to truyn thng s dng giao thc UDP truyn cc gi tin v cc ng dng m


phng s dng giao thc TCP. B to truyn thng c nhim v l gi cc gi tin c
kch thc khng i vi tc c nh. B to truyn thng c bn loi l: ly tha,
pareto, CBR v theo file vt. Cc ng dng m phng c hai loi l Telnet v FTP.

4.3.2. M phng cc giao thc nh tuyn trong mng adhoc [1, T.Vit], [4], [5]
Bn giao thc nh tuyn c NS2 h tr sn trong mng adhoc l : DSDV,
AODV, DSR v TORA. Do thi gian c hn nn ti xin phn tch v so snh cc giao
thc nh tuyn ca mng adhoc thng qua cc kt qu m phng sn c ca mt s
ngi nghin cu i trc. Sau y l cc tham s hot ng ca bn giao thc trn v
mt s lu khi ci t cc giao thc trong m phng theo ti liu ca NS2 v cc file
ci t cc giao thc:
4.3.2.1. Giao thc DSDV
Cc tham s hot ng ca DSDV trong m phng l:

Tham s Gi tr

Qung cp nht ng nh k 15s

S cp nht nh k b mt trc khi lin kt c xem 3


l b hng

Thi gian cp nht tc thi u tin c gi li trong 6s


hiu ng hm

Thi gian kt hp cc qung co ng 1s

S lng cc gi tin ln nht trong b m mi nt 5

Bng 1: Cc tham s hot ng ca DSDV trong m phng

Trong giao thc DSDV, thng ip c trao i gia cc nt hng xm. Cc


cp nht c th l nh k hoc tc thi. Cp nht tc thi ch xy ra khi bng nh
tuyn ca mt nt b thay di bi thng tin nh tuyn ca mt trong cc nt hng
xm. Cc gi tin cha c ng n ch s c lu li trong b m khi truy vn v
ng c gi. Khi nhn c tr li ng t nt ch, cc gi tin s c chuyn
i. Kch thc ca b m lu cc gi tin ang ch thng tin v ng c quy
nh sn. Nu qu kh nng ny, gi tin s b loi b.

45
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Tt c cc gi tin c ch l nt di ng c b phn tch a ch a n b


phn tch cng. B phn tch cng s dng mt trong 255 cng chuyn gi tin n
ch tng ng. ch mc nh trong b phn tch a ch l thnh phn nh tuyn.
Khi ch ca gi tin khng c tm thy bi b phn tch a ch, gi tin s c
chuyn cho ch mc nh. Thnh phn nh tuyn gn chng tip theo ca gi tin v
gi n xung lp lin kt.
4.3.2.2. Giao thc AODV
Cc tham s hot ng ca giao thc AODV

Tham s Gi tr
Thi gian ng c xem l hp l 300s
Thi gian tn ti ca RREP c gi bi ch 600s

S RREQ c pht li 3
Thi gian trc khi mt RREQ c pht li 6s

Thi gian broadcastID ca mt gi tin RREQ c gi 3s


Thi gian ng i ngc li cho RREP c gi 3s

Thi gian trc khi lin kt b hng c xa khi bng 3s


nh tuyn

Pht hin lin kt hng bng lp MAC c

Bng 2: Cc tham s hot ng ca AODV trong m phng


Trong c t ca giao thc AODV, cc nt mng pht hin cc nt hng xm
thng qua vic gi thng ip HELLO theo nh k. Khi m phng AODV bng NS2,
vic pht hin lin kt hng c thay th bng thng bo t tng MAC. iu ny
gip loi b c tng ph ca vic gi nh k cc thng ip HELLO.

46
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

4.3.2.3. Giao thc DSR


Cc tham s c t DSR trong m phng:

Tham s Gi tr

Thi gian gia cc ROUTE REQUEST c pht li 500ms

Kch thc tiu gi tin mang a ch ng vi n 4n + 4byte


chng

Thi gian ht hn tm kim ng trong cc hng 30ms


xm

Thi gian gi cc gi tin ch ng 30s

Tc cao nht vic gi cc gi tin REPLY cho mt 1/s


ng

Bng 3: Cc tham s hot ng ca DSR trong m phng


Tt c cc gi tin c nhn bi nt mng u c chuyn n thnh phn nh
tuyn theo mc nh. Ti y c ba trng hp xy ra:
- Thnh phn nh tuyn DSR nhn gi tin cho chnh n bng vic chuyn
gi tin ti b phn tch cng..
- Chuyn tip gi tin theo thng tin v ng trong gi tin
- Gi cc yu cu v ng v tr li ng.
Mc d DSR h tr ng i n hng, nhng do IEEE802.11 yu cu trao i
RTS/CTS/DATA/ACK i vi cc gi tin unicast nn DSR trong NS2 ch pht hin
cc ng i hai chiu.

47
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

4.3.2.4. Giao thc TORA


Cc tham s hot ng ca TORA theo m phng:

Tham s Gi tr

Qung thi gian pht cc BEACON 1s

Thi gian lin kt c xem l b hng khi khng c 3s


cc thng tin BEACON hoc HELLO c trao i

Thi gian pht li object block khi khng nhn c 500ms


bin nhn

Thi gian object block khng c pht li v lin 1500ms


kt ti ch c xem l b hng

Bng 4: cc tham s hot ng ca TORA trong m phng


Trong m phng, TORA c t trn giao thc IMEP (Internet MANET
Encapsulation Protocol). Giao thc ny c cc c im chnh sau:
- Pht tin cy v ng th t cc gi tin nh tuyn ca TORA ti cc hng xm
v thng bo cho giao thc v lin kt tn ti vi cc hng xm.
- Trc khi tin hnh pht, IMEP kt hp cc gi tin nh tuyn ca TORA vi
IMEP thnh mt gi tin gi l object block.
- cm nhn trng tha lin kt v duy tr danh sch hng xm, IMEP gi gi
tin beacon. Cc nt nhn c gi tin beacon s tr li bng gi tin HELLO.

4.4. Phn tch v so snh hiu sut ca cc giao thc nh tuyn


trong mng adhoc
4.4.1. Cc tham s ca mi trng:
Do c th ca mng adhoc l topo mng ng, bng thng hn ch, kh nng
lin kt gia cc nt mng c th thay i, nn vic phn tch hiu sut ca cc giao
thc trong mng adhoc phi xt n cc tham s sau:
- ln ca mng: c th hin bng s cc nt mng.

48
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

- Kt ni mng: c th hin thng qua s lng trung bnh cc hng xm ca


mt nt.
- Tc bin thin ca mng: l thay i cu hnh vt l ca mng theo thi gian.
- Kh nng lin kt: bng thng ca lin kt khng dy tnh bng bps.
- Dng truyn thng: c th l ng dng, khng ng dng hoc bng pht. y
chnh l mc ti trong mng.
- Dng di chuyn: chnh l hnh thi ca mng c th hin tng ng theo
khng gian v thi gian.

4.4.2. Cc thng s nh gi hiu sut:


i vi h thng ni chung, hiu sut l o cng vic m h thng thc hin
c bao gm tnh sn sng, thng lng, v thi gian p ng. V th, y ngi ta
s dng cc thng s sau nh gi hiu sut ca cc giao thc nh tuyn trong
mng m phng:
- Phn trm gi tin c gi thnh cng: L t l gia s lng cc gi tin n
c ch vi s lng cc gi tin c to ra bi nt pht.
- Tr u cui trung bnh ca cc gi d liu: L tng tr c tnh t khi nt
ngun pht gi tin n khi nt ch nhn c gi tin. N bao gm cc tr c th
nh tr do qu trnh pht hin ng, xp hng ti cc hng i, tr do pht li ti tng
MAC v tr thi gian truyn.
Hai o ny nh gi kt qu hot ng ca giao thc nh tuyn. N c
ngha i vi hot ng ca giao thc lp trn nh giao thc giao vn v giao thc
ng dng.
Ngoi ra, i vi mng adhoc, vic hn ch ti nguyn mng i hi cc giao
thc phi s dng hiu qu cc ti nguyn ny. Vi giao thc nh tuyn, chnh l
chi ph thc hin cc yu cu nh tuyn. Do , ngi ta xt thm mt thng s
na th hin vic s dng cc ti nguyn mng. l ti nh tuyn chun ha: l t
l gia s cc gi tin nh tuyn trn s gi tin d liu c gi i. Nu gi tin nh
tuyn i qua nhiu chng th mi chng c tnh nh l mt truyn thng.

4.4.3. Cc th nghim m phng [1, T.Vit]


4.4.3.1. Mc ch ca cc th nghim:
nh gi kh nng ca cc giao thc nh tuyn trc s thay i ca topo mng.

49
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

4.4.3.2. Phng php thc hin:


p dng cc dng di chuyn khc nhau vi cc mc ti khc nhau. Cc mng
adhoc c m phng da trn cc m hnh di chuyn v m hnh truyn thng. Cc
m hnh di chuyn c s dng l ba m hnh Random Waypoint, Random Walk v
Random Direction. Vi mi m hnh, cc tham s ca mng c thay i cc
trng thi ca mng nh kt ni mng, thi gian v tc chuyn ng ca cc nt
mng thay i theo. Cc mc ti mng ca tng mng cng l khc nhau. vic
nh gi c chnh xc, cc iu kin ti v mi trng p dng vi cc giao thc
phi ging nhau. M hnh truyn thng c s dng y l m hnh CBR.
4.4.3.3. nh gi cc th nghim vi tng m hnh mng
- M hnh Random Waypoint
Xt v phn trm gi tin gi thnh cng: Khi s ngun pht nh cc giao thc
hot ng kh tt, ngoi tr giao thc TORA. Kt qu khng tt ca giao thc TORA
l do s tc nghn trong c ch lm vic ca giao thc. iu ny th hin rt r
tr trong vic gi cc gi v ti nh tuyn cao ca TORA. Cc giao thc AODV, DSR
th hin lm vic tt hn so vi DSDV. Khi s ngun pht c tng ln, kh nng gi
cc gi tin ca cc giao thc c s phn bit kh r rt. AODV c hiu sut cao hn
so vi DSDV. V hiu sut ca giao thc DSR gim xung r rt. iu ny chng t
trong mi trng ti tng, c ch lm vic ca DSR cha t c phn ng tt. Hot
ng yu km ca giao thc TORA cng khng nh hn na s khng hiu qu
ca giao thc ny khi mt ng trong mi trng ti tng v cu hnh c nhiu thay
i. Nh vy, khi m s ngun pht v s di chuyn tng ln th phn trm gi thnh
cng cc gi tin ca cc giao thc nh tuyn u gim.
Xt tr trung bnh trong vic gi cc gi tin: Ta thy rng, tr trung bnh
ca cc giao thc DSDV v AODV l tng ng nhau. tr trung bnh ca hai
giao thc ny l kh thp. Ngay c khi ngun pht c tng ln v mc di chuyn
khc nhau, tr trung bnh ca hai giao thc cng ch tng ln mt cch khng ng
k. Vi giao thc DSR, tr u cui trung bnh ca giao thc ny th hin s nhy
cm r rt vi s di chuyn ca cc nt mng v tng ngun pht. tr u cui ca
DSR tng khi m thi gian tm dng gim v s ngun pht tng ln. tr u cui
trung bnh ca giao thc TORA rt cao v tng mnh khi s di chuyn ca cc nt
mng gia tng. l do xy ra tc nghn trong hot ng mng ca TORA.

50
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Mt yu t quan trng na trong vic nh gi hiu sut ca cc giao thc l vic


s dng hiu qu cc ti nguyn mng thng qua ti nh tuyn. Trong trng hp ti
thp v mc di chuyn khng cao, ti nh tuyn ca cc giao thc AODV v DSR
thp hn so vi DSDV. l do cc giao thc ny khng thc hin nh tuyn theo
yu cu nn s gi tin nh tuyn thay i khng ng k. Tuy nhin, khi m cc nt
mng di chuyn nhanh v s ngun pht tng ln, ti nh tuyn ca hai giao thc nh
tuyn ny li tng ln nhanh chng. l do s bng pht ca cc gi tin pht hin
ng, tr li ng v thng bo li. Ti nh tuyn cao c th gy ra hn ch v
bng thng ca ton mng v dn n tc nghn. iu ny c th nhn thy r nht
giao thc nh tuyn TORA. C th kt lun rng, hiu sut ca giao thc TORA l rt
thp trong m phng.
- M hnh Random Walk
Trong m hnh ny, vi cu hnh mng thay i mc trung bnh, iu d nhn
thy nht l giao thc TORA hot ng hiu qu hn so vi m hnh Random
Waypoint. Tuy nhin, trong trng hp ngun pht tng, t l phn trm gi thnh
cng cc gi tin ca TORA li thp hn nhiu so vi cc giao thc khc. Trong c hai
trng hp t v nhiu ngun pht, phn trm gi thnh cng ca giao thc DSDV vn
thp hn so vi hai giao thc AODV v DSR. Ngoi ra, hiu sut ca cc giao thc
ny l kh n nh k c khi ngun pht c tng ln.
Tr u cui trung bnh ca cc giao thc AODV v DSR vn tt hn so vi
DSDV. So vi m hnh trn, kt qu ny khng c g khc bit. Khi m ngun, pht
tng ln, giao thc AODV c phn hi tt nht so vi cc giao thc cn li. Trong khi
, c ch ca TORA gy tc nghn lm tr trung bnh u cui tng cao.
So vi m hnh Random Waypoint, DSDV vn c mc ti nh tuyn thp v
kh n nh, DSR c mc ti nh tuyn thp. AODV c mc ti n nh trong c hai
trng hp s lng ngun pht l nhiu hay t. Ring vi TORA, vic xy ra tc
nghn khi s lng ngun pht tng c thy r qua vic ti nh tuyn rt cao.
- M hnh Random Direction
So vi m hnh Random Walk, kt qu gi cc gi tin thnh cng trong m hnh
c gi tr thp hn. Bn cnh giao thc TORA b nh hng bi vic tng s lng
ngun pht, giao thc DSR cng b tc ng mnh khi s lng ngun pht tng v
cu hnh mng thay i nhanh. DSDV vn cho kt qu thp hn so vi cc giao thc

51
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

khc. V kt qu tt nht thuc v giao thc AODV khi m phn trm gi thnh cng
ca cc gi tin l n nh ngay c khi tng s lng ngun pht.
tr u cui trung bnh trong vic gi cc gi tin ca giao thc DSR khi s
lng ngun pht tng trong m hnh ny cao hn rt nhiu so vi m hnh Random
Walk. R rng, vi m hnh di chuyn phi tp trung, di ng i ca cc gi tin
di hn, c ch DSR th hin s kh khn. Giao thc AODV v DSDV vn cho cc
kt qu rt tt. TORA th hin s thay i mnh khi m s lng ngun pht tng,
tr cng tng ln.
Ngoi vic TORA c ti nh tuyn cao do xy ra tc nghn, AODV c mc ti
nh tuyn cao hn hai giao thc cn li do cu hnh mng phi tp trung v ti mng
cao. Nh c c ch lu tr nhiu ng i v cc phng php hc hi ng mt
cch linh ng, DSR c mc ti nh tuyn thp hn AODV. DSDV c mc ti
nh tuyn thp nht trong m hnh ny.

4.4.4. Nhn xt v hiu sut ca cc giao thc nh tuyn


Tng hp cc th nghim trn, c th rt ra cc nhn xt sau:
DSDV l giao thc da trn vector khong cch. Giao thc hot ng tt trong
trng hp cu hnh mng c tc thay i chm, v gim khi m cu hnh mng thay
i tng ln. Khi mng c nhiu thay i, DSDV hi t chm. Khi m s lng ngun
pht gi tin thp, tr trung bnh cui ca DSDV l thp v n nh. Nhng khi s lng
ngun pht tng ln, tr pht gi tin ca DSDV cao hn so vi AODV v DSR. Ngoi
ra, ti nh tuyn ca DSDV l kh n nh so vi s thay i ca mng.
AODV l s kt hp ca c ch nh tuyn theo vector khong cch ca DSDV
vi c ch nh tuyn theo yu cu ca DSR. Kh nng gi thnh cng cc gi tin ca
AODV l rt ln, lun cao hn so vi giao thc DSDV. So vi DSR, trong trng hp
mc di chuyn ca cc nt mng thp, phn trm gi cc gi tin l tng ng,
nhng khi mc di chuyn ca nt mng tng ln, AODV c phn trm gi cc gi
tin cao hn so vi DSR. tr trung bnh ca cc gi tin trong AODV l tng ng
vi DSDV. Trong trng hp cc nt mng di chuyn nhanh trong mng, ti nh
tuyn ca AODV cao hn so vi DSR.
DSR l giao thc da trn nh tuyn ngun. Mc tiu trong thit k ca DSR l
loi b cc chi ph cho cp nht nh k ng v pht hin hng xm. Tuy nhin, theo
kt qu m phng, DSR ch thc hin tt vi mc di chuyn v ti trung bnh. Khi
mc di chuyn v ti tng, hiu sut ca DSR s gim r rt. l do DSR p dng c

52
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

ch tr li tt c cc yu cu ng. C ch ny gip DSR thu thp c nhiu ng


i v phn pht cc gi tin tt hn. Tuy nhin, khi m mc di chuyn trong mng tng,
kh nng cc ng i trong cache b ht hn tng ln do DSR cha c c t ht hn
ng i trong cache. Kh nng hc v nghe trm ng ca DSR cng gip pht
tn cc tuyn ng ht hn trong cache. C ch gi route error ca DSR cng rt hn
ch. N ch truyn vi cc nt nm trn ng i qua ca d liu.
TORA l giao thc da trn thut ton o ngc lin kt (link reserval). Trong
m phng, vic cm nhn lin lt ca TORA c thc hin bi giao thc IMEP. Khi
s lng ngun pht nh, TORA cho cc kt qu kh tt. Tuy nhin, khi s lng
ngun pht tng ln, m hnh mng bin i mt cch nhanh chng, hiu sut hot
ng ca TORA l rt thp. Mng khng th thao tc c vi cc truyn thng c
to ra bi giao thc nh tuyn, phn ln cc gi tin d liu b loi b.

53
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Kt lun
1. Kt qu thu c
- Hiu thm v mng WLAN v cu trc ca mng theo m hnh 802.11
- Trang b thm kin thc v mng adhoc v mt s giao thc nh tuyn
trong mng adhoc
- nh gi tng quan v hiu sut ca cc giao thc nh tuyn trong
mng adhoc thng qua b m phng NS2
2. nh hng pht trin ca lun vn
Vi s pht trin nhanh chng ca mng adhoc trong i sng, nhu cu nng
cao hiu sut ca mng cn c quan tm nhiu hn. Cc giao thc mng cn phi
c nghin cu v pht trin nng cao hiu sut s dng mng trong tng lai.
Vic tm ra giao thc nh tuyn mi cho mng adhoc cng l hng pht trin trong
ti ny.

54
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Ph Lc
Biu kt qu so snh cc giao thc nh tuyn trong mng adhoc thng
qua b m phng mng NS2
1. M hnh Random Waypoint

So snh kt qu phn pht gi tin d liu khi c 10 v 20 ngun pht ca cc giao thc
nh tuyn trong m hnh Random Waypoint

55
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

So snh thi gian tr u cui ca cc giao thc nh tuyn trong hai trng hp c 10
ngun pht v 20 ngun pht trong m hnh Random Waypoint

56
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

So snh ti nh tuyn chun ha trong trng hp c 10 ngun pht v 20 ngun pht

Bng ti nh tuyn ca giao thc TORA

2. M hnh Random Walk

57
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Bng so snh kt qu phn pht gi tin d liu trong m hnh Random Walk

Bng so snh tr u cui trung bnh ca cc giao thc nh tuyn trong m hnh Random
Walk

58
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Bng so snh ti nh tuyn chun ha trong m hnh Random Walk

3. M hnh Random Direction

So snh kt qu phn pht gi tin d liu trong m hnh Random


Direction

59
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

So snh thi gian tr u cui trung bnh trong m hnh Random


Direction

So snh ti nh tuyn chun ha trong m hnh Random Direction

(Ngun: Lun vn cao hc 2005-Nguyn Th Minh


Nguyt)

60
Mng Adhoc, Kha lun tt nghip C nhn CNTT, Ng Hi Sn, 2008

Ti liu tham kho


Ting Vit:
1. Lun vn Cao Hc(2005) - Nguyn Th Minh Nguyt
Ting Anh:
1. Andrew S. Tanenbaum (2003), Computer Networks, Prentice Hall, New
Jersey, Fourth Edition.
2. ANSI/IEEE Std 802.11, 1999 Edition
3. http://en.wikipedia.org
4. http://www.isi.edu/nsnam/vint
5. http://www.isi.edu/nsnam/
6. Jochen H. Schiller (2000), Mobile Communications, Addition-Wesley,
London.

61