BTL Mang May Tinh [www.itepress.com]

  • View
    746

  • Download
    1

Embed Size (px)

DESCRIPTION

TRNG I HC BCH KHOA H NI VIN IN T - VIN THNGBI TP LN: MNG MY TNH s 11Ging vin hng dn: Trn Quang Vinh Sinh vin thc hin: Nguyn c Dng Nguyn Vn Kim Trn Danh Nam V Vn Tip Nguyn Trng Ton Lp: in T 1 k53 H Ni 04/2012 - 20080497 - 20081462 - 20081837 - 20082677 - 20082707Ngun: http://itepress.com/forum/ns-f53.html => Download source code m phng ns2,hng dn hc ns2A. L thuyt1. Giao thc Internet (Internet Protocol) Network

Transcript

TRNG I HC BCH KHOA H NI VIN IN T - VIN THNG

BI TP LN: MNG MY TNH s 11Ging vin hng dn: Trn Quang Vinh Sinh vin thc hin: Nguyn c Dng Nguyn Vn Kim Trn Danh Nam V Vn Tip Nguyn Trng Ton Lp: in T 1 k53 H Ni 04/2012 - 20080497 - 20081462 - 20081837 - 20082677 - 20082707

Ngun: http://itepress.com/forum/ns-f53.html => Download source code m phng ns2,hng dn hc ns2

A. L thuyt1. Giao thc Internet (Internet Protocol) Network Layer in the Internet1.1. Khi nim Giao thc internet (IP) l giao thc mng dng truyn d liu qua cc mng kt hp. Giao thc IP c thit k p ng cc nhu cu sau: Thit lp h thng mng c th kt ni c cc loi my tnh, cc thit b nh tuyn c ch to t cc nh sn xut khc nhau. p ng c s pht trin nhanh chng ca cc loi mng khc nhau ng thi tha k c cng ngh mng c. H tr dch v truyn d liu c kt ni v khng kt ni v khng kt ni cho cc tng trn. Giao thc IP cung cp phng thc truyn cc Datagram trn mt kt ni mng kt hp bt k.Cng ging nh mt khung d liu trong mng vt l. Mi Datagram c truyn c lp vi nhau do vy th t cc Datagram nhn c c th khc th t cc Datagram lc pht i.Giao thc IP khng chu trch nhim v vic cc Datagram s c truyn n ch an ton hay khng.Giao thc IP ch c trch nhim truyn cc Datagram cng nhanh cng tt, cc Datagram c th b mt trong qu trnh truyn do cc nguyn nhn sau y: Xut hin bit li trong qu trnh truyn. S qu ti ca cc b m Cha tm c ng truyn no ti ch. Tt c cc bin php nhm m bo cc Datagram c truyn n ch mt cch an ton ,y v khi phc cc d liu mt do TCP m nhim. 1.2. ngha ca giao thc IP Giao thc IP l giao thc c c ch truyn d liu khng kt ni ,c tin cy thp. Giao thc IP c 3 ngha quan trng: Giao thc IP nh ngha n v c s d liu truyn i trn mng Internet thng qua mt kt ni TCP/IP. Ni cch khc l n xc nh nh dng chnh xc ca tt c d liu khi truyn qua mng Internet. Phn mm IP thc hin chc nng nh tuyn cho php chn ng gi d liu i. Ngun: http://itepress.com/forum/ns-f53.html => Download source code m phng ns2,hng dn hc ns2

Cng vi chnh xc, c t chnh xc ca nh dng d liu v vic nh tuyn.Giao thc IP bao gm mt tp hp cc quy tc th hin c ch truyn d liu khng kt ni v c tin cy thp. Cc quy tc ny c trng cho cch m my tnh v b nh tuyn x l cc gi d liu lm th no v khi no th cc thng ip li pht sinh v di nhng iu kin no th cc gi d liu c hy b. 1.3. Khun dng d liu ca giao thc IP ( IP Datagram) Bn tin lp giao vn c di 64Kbytes c chuyn xung lp mng.Giao thc IP ct bn tin ny thnh cc gi nh gi i (IP Datagram) . Khi n ni nhn chng c tp hp li bi lp giao vn to li bn tin ban u. Mt IP Datagram gm c phn mo u (Header) v phn d liu (Data).Phn Header c mt phn c nh 20bytes v mt phn ty c rng thay i nh minh ha hnh v sau.

IP Header

Unit of Data

Datagram 1.4. Cc dch v ca lp IP (IP services). 1.4.1. Dch v mng DNS Khi nim: DNS l t vit tt trong ting Anh ca Domain Name System, l H thng phn gii tn c pht minh vo nm 1984 cho Internet, ch mt h thng cho php thit lp tng ng gia a ch IP v tn min. Chc nng ca DNS. Mi Website c mt tn (l tn min hay ng dn URL:Universal Resource Locator) v mt a ch IP. a ch IP gm 4 nhm s cch nhau bng du chm. Khi m mt trnh duyt Web v nhp tn website, trnh duyt s n thng website m khng cn phi thng qua vic nhp a ch IP ca trang web. Qu trnh "dch" tn min thnh a ch IP cho trnh duyt hiu v truy cp c vo website l cng vic ca mt DNS server. Cc DNS tr gip qua li vi nhau dch a ch "IP" thnh "tn" v ngc li. Ngi s dng ch cn nh "tn", khng cn phi nh a ch IP (a ch IP l nhng con s rt kh nh ) Nguyn tc lm vic ca DNS. Ngun: http://itepress.com/forum/ns-f53.html => Download source code m phng ns2,hng dn hc ns2

Mi nh cung cp dch v vn hnh v duy tr DNS server ring ca mnh, gm cc my bn trong phn ring ca mi nh cung cp dch v trong Internet. Tc l, nu mt trnh duyt tm kim a ch ca mt website th DNS server phn gii tn website ny phi l DNS server ca chnh t chc qun l website ch khng phi l ca mt t chc (nh cung cp dch v) no khc. INTERNIC (Internet Network Information Center) chu trch nhim theo di cc tn min v cc DNS server tng ng. INTERNIC l mt t chc c thnh lp bi NFS (National Science Foundation), AT&T v Network Solution, chu trch nhim ng k cc tn min ca Internet. INTERNIC ch c nhim v qun l tt c cc DNS server trn Internet ch khng c nhim v phn gii tn cho tng a ch. DNS c kh nng tra vn cc DNS server khc c c mt ci tn c phn gii. DNS server ca mi tn min thng c hai vic khc bit. Th nht, chu trch nhim phn gii tn t cc my bn trong min v cc a ch Internet, c bn trong ln bn ngoi min n qun l. Th hai, chng tr li cc DNS server bn ngoi ang c gng phn gii nhng ci tn bn trong min n qun l. - DNS server c kh nng ghi nh li nhng tn va phn gii. dng cho nhng yu cu phn gii ln sau. S lng nhng tn phn gii c lu li ty thuc vo quy m ca tng DNS. Cch s dng DNS Do cc DNS c tc bin dch khc nhau, c th nhanh hoc c th chm, do ngi s dng c th chn DNS server s dng cho ring mnh. C cc cch chn la cho ngi s dng. S dng DNS mc nh ca nh cung cp dch v (internet), trng hp ny ngi s dng khng cn in a ch DNS vo network connections trong my ca mnh. S dng DNS server khc (min ph hoc tr ph) th phi in a ch DNS server vo network connections. a ch DNS server cng l 4 nhm s cch nhau bi cc du chm. Cu trc ca gi tin DNS: Gi tin DNS gm cc trng sau: ID: L mt trng 16 bits, cha m nhn dng, n c to ra bi mt chng trnh thay cho truy vn. Gi tin hi p s da vo m nhn dng ny hi p li. Chnh v vy m truy vn v hi p c th ph hp vi nhau. QR: L mt trng 1 bit. Bt ny s c thit lp l 0 nu l gi tin truy vn, c thit lp l mt nu l gi tin hi p. Opcode: L mt trng 4 bits, c thit lp l 0 cho c hiu truy vn, c thit lp l 1 cho truy vn ngc, v c thit lp l 2 cho tnh trng truy vn. Ngun: http://itepress.com/forum/ns-f53.html => Download source code m phng ns2,hng dn hc ns2

AA: L trng 1 bit, nu gi tin hi p c thit lp l 1, sau n s i n mt server c thm quyn gii quyt truy vn. TC: L trng 1 bit, trng ny s cho bit l gi tin c b ct khc ra do kch thc gi tin vt qu bng thng cho php hay khng. RD: L trng 1 bit, trng ny s cho bit l truy vn mun server tip tc truy vn mt cch qui. RA: Trng 1 bit ny s cho bit truy vn qui c c thc thi trn server khng . Z: L trng 1 bit. y l mt trng d tr, v c thit lp l 0. Rcode: L trng 4 bits, gi tin hi p s c th nhn cc gi tr sau : 0: Cho bit l khng c li trong qu trnh truy vn. 1: Cho bit nh dng gi tin b li, server khng hiu c truy vn. 2: Server b trc trc, khng thc hin hi p c. 3: Tn b li. Ch c server c thm quyn mi c th thit lp gi tr ny. 4: Khng thi hnh. Server khng th thc hin chc nng ny . 5: Server t chi thc thi truy vn. QDcount: S ln truy vn ca gi tin trong mt vn . ANcount: S lng ti nguyn tham gia trong phn tr li. NScount: Ch ra s lng ti nguyn c ghi li trong cc phn c thm quyn ca gi tin. ARcount: Ch ra s lng ti nguyn ghi li trong phn thm vo ca gi tin.

1.4.2. Giao thc cu hnh Host ng DHCP ( Dynamic Host Configuration Protocol). Khi nim: DHCP l vit tt ca Dynamic Host Configuration Protocol, l giao thc Cu hnh Host ng c thit k lm gim thi gian chnh cu hnh cho mng TCP/IP bng cch t ng gn cc a ch IP cho khch hng khi h vo mng. Dich v DHCP l mt thun li rt ln i vi ngi iu hnh mng. N lm yn tm v cc vn c hu pht sinh khi phi khai bo cu hnh th cng. Ni mt cch tng quan hn DHCP l dich v mang n cho chng ta nhiu li im trong cng tc qun tr v duy tr mt mng TCP/IP nh: Tp chung qun tr thng tin v cu hnh IP. + Cu hnh ng cc my. + Cu hnh IP cho cc my mt cch lin mch Ngun: http://itepress.com/forum/ns-f53.html => Download source code m phng ns2,hng dn hc ns2

+ S linh hot + Kh nng m rng + Gim bt c cc hin tng xung t v IP, hay cc li v IP, lun m bo cho cc my client c cu hnh ng. + n gin ha trong cng tc qun tr. Phng thc hot ng ca DHCP. Dch v DHCP hot ng theo m hnh Client / Server. Theo qu trnh tng tc gia DHCP client v server s din ra theo cc bc sau. B1: Khi my Client khi ng, my s gi broadcast gi tin DHCP DISCOVER, yu cu mt Server phc v mnh. Gi tin ny cng cha a ch MAC ca client. Nu client khng lin lc c vi DHCP Server th sau 4 ln truy vn khng thnh cng n s t ng pht sinh ra 1 a ch IP ring cho chnh mnh nm trong dy 169.254.0.0 n 169.254.255.255 dng lin lc tm thi. V client vn duy tr vic pht tn hiu Broad cast sau mi 5 pht xin cp IP t DHCP Server. B2: Cc my Server trn mng khi nhn c yu cu . Nu cn kh nng cung cp a ch IP, u gi li cho my Client mt gi tin DHCP OFFER, ngh cho thu mt a ch IP trong mt khong thi gian nht nh, km theo l mt Subnet Mask v a ch ca Server. Server s khng cp pht ia ch IP va ngh cho client thu trng sut thi gian thng thuyt. B3:My Client s la chn mt trong nhng li n ngh ( DHCPOFFER) v gi broadcast li gi tin DHCPREQUEST v chp nhn li ngh . iu ny cho php cc li ngh khng c chp nhn s c cc Server rt li v dng cp pht cho cc Client khc. B4: My Server c Client chp nhn s gi ngc li mt gi tin DHCP ACK nh mt li xc nhn, cho bit a ch IP , Subnet Mask v thi hn cho s dng s chnh thc c p dng. Ngoi ra server cn gi km nhng thng tin b xung nh a ch Gateway mc nh, a ch DNS Server...

2. Tm hiu v Ipv42.1. Khi nim Ipv4( Internet Protocol Version 4) l phin bn th 4 trong qu trnh pht trin ca cc giao thc internet (IP).y l phin bn u tin ca IP c s dng rng ri. IPv4 Ngun: http://itepress.com/forum/ns-f53.html => Download source code m phng ns2,hng dn hc ns2

cng vi IPv6 l nng ct ca giao tip internet. Hin ti Ipv4 vn l giao thc c trin khai rng ri nht trong b giao thc ca lp Internet. Giao thc ny c cng b bi IETF trong phin bn RFC 791 (thng 9 nm 1981), thay th cho phin bn RFC 760 (cng b vo thng ging nm 1980). Giao thc ny cng c chun ha bi b quc phng M trong phin bn MIL-STD-1777. IPv4 l giao thc hng d liu, c s dng cho h thng chuyn mch gi (tng t nh chun mng Ethernet). y l giao thc truyn d liu hot ng da trn nguyn tc tt nht c th, trong , n khng quan tm n th t truyn gi tin cng nh khng m bo gi tin s n ch hay vic gy ra tnh trng lp gi tin ch n. Vic x l vn ny dnh cho lp trn ca chng giao thc TCP/IP. Tuy nhin, IPv4 c c ch m bo tnh ton vn d liu thng qua s dng nhng gi kim tra (checksum). 2.2. Cu trc a ch ca IPv4 2.2.1. Thnh phn v khun dng ca a ch Ipv4 Ipv4 s dng 32 bits nh a ch mng chia thnh 4 octet ( Mi octet c 8bit tng ng vi 1 Byte). Cch m u t tri qua phi t bit 1 n bit 32.Cc Octet cc