IP Sub-Networking Mini-Howto

Robert Hart, hartr@interweft.com.au v1.0, 31 Martioy 1997

To keimeno ayto perigrafei to giati kai pws na ypodiktywsete ena diktyo IP - klashs A , B kai C wste na leitoyrgei swsta gia diafora diasyndedemena diktya.

1 Pneymatikh Idiokthsia

To keimeno ayto dianeimetai katw apo toys oroys ths GNU Public License (GPL).

To keimeno ayto yposthrizetai amesa apo toys IT sumboyloys ths InterWeft (Melbournh, Aystralia).

H teleytaia ekdosh aytou toy keimenoy einai dia8esimh apo to InterWeft WWW site sto InterWeft IT Consultants <http://www.interweft.com.au/> kai apo to The Linux Documentation Project <http://

sunsite.unc.edu/LDP>.

2 Eisagwgh

Me toys dia8esimoys ari8mous diktuwn IP na ginontai suntoma eidos ypo ejafanish, h apotelesmatikh xrhsh aytou toy oloena kai spanioteroy poroy,einai shmantikh.

Ayto to keimeno perigrafei pws na spasete ena aplo ari8mo diktuoy IP etsi wste na mporei na xrhsimopoih8ei se diafora diaforetika diktya.

To keimeno ayto epikentrwnetai se diktya IP klashs C - alla oi arxes efarmozontai epishs kai se diktya A kai B klasewn.

2.1 Alles phges plhroforias

Yparxei ena plh8os allwn phgwn plhroforias poy einai sxetikes me leptomereis plhrofories ka8ws kai me plhrofories ypoba8roy sxetika me diey8unseis IP. Aytes poy proteinontai apo ton syggrafea einai:

   • The Linux Network Administrators Guide <http://sunsite.unc.edu/LDP/LDP/nag/nag.html>.

• The Linux System Administration Guide <http://linuxwww.db.erau.edu/SAG/>.

• TCP/IP Network Administration toy Craig Hunt, ekdoseis O’Reilly and Associates <http://www.ora.

     com/catalog/tcp/noframes.html>.

3 H anatomia twn ari8mwn IP

Prin proxwrhsoyme sthn apolaysh ths ypodiktuwshs (sub-networking) , xreiazetai na 8esoyme ta basika sxetika me tis diey8unseis IP.

3.1 Oi diey8unseis IP anhkoyn se interface - OXI se host!

Prwta ap’ola, as jeka8arisoyme merikes basikes aities parejhghshs - oi ari8moi IP den anati8entai se host. Oi ari8moi IP anati8entai se interface diktuwn poy exoyn oi host.

Eeee - Ti einai ayto?

Enw polloi (an oxi oi perissoteroi) ypologistes se ena diktyo IP 8a katexoyn ena mono interface diktuoy (kai exoyn ena mono ari8mo IP sa synepeia), aytos den einai o monos tropos poy ginontai ta pragmata. Oi ypologistes ka8ws kai alles syskeyes mporoun na exoyn diafora (an oxi polla) interface diktuoy -kai ka8e interface na exei ton diko toy ari8mo IP.

Etsi mia syskeyh me 6 diaforetika interface (opws enas dromologhths - router) 8a exei 6 ari8mous IP- enan gia ka8e interface gia ka8e diktyo sto opoio einai syndedemenos. H aitia gi’ ayto einai profanhs otan koitajoyme ena diktyo IP!

Parol’ ayta, oi perissoteroi anaferontai se host diey8unseis otan anaferontai se ari8mous IP. Apla na 8ymaste, ayto einai mia eykolia gia ton ari8mo IP toy sygkekrimenoy interface se ayton ton host. Polles (an oxi oi pleiochfia) twn syskeywn sto Internet exoyn monadiko interface kai epomenws monadiko ari8mo IP.

3.2 Oi ari8moi IP san "Tetrades me teleies"

Sthn sygkekrimenh (IPv4) ylopoihsh twn ari8mwn IP, aytoi apotelountai apo 4 byte (1 byte=8 bit) - dinontas ena sunolo 32 bit dia8esimhs plhroforias. Ayto katalhgei se ari8mous poy einai mallon megaloi (akoma kai otan einai grammenoi se dekadikh morfh). Etsi gia anagnwsimothta (ka8ws kai gia logoys organwshs) oi ari8moi IP einai synh8ws grammenoi se morfh ’tetradas me teleies’ (’dotted quad’). O IP ari8mos

             192.168.1.24

einai ena paradeigma aytou- 4 (dekadikoi) ari8moi diaxwrizomenoi apo (.) teleies.

Ka8ws ka8e enas apo toys 4 ari8mous einai h dekadikh anaparastash enos byte twn 8 bit, ka8e enas apo toys 4 ari8mous mporei na einai apo 0 ews 255 (dhladh 256 monadikes times - 8ymh8eite, to 0 einai kai ayto mia timh).

Epipleon, meros toy ari8mou IP enos host prosdiorizei to diktyo sto opoio o host edreuei, ta ypoloipa ’bit’ toy ari8mou IP prosdiorizoyn to idio to host (oyps... -to interface toy diktuoy). Akribws to posa bit xrhsimopoiountai gia to ID toy diktuoy kai posa einai dia8esima gia na prosdiorizoyn host (interface) se ayto to diktyo orizetai apo thn ’klash’ (’class’) toy diktuoy.

3.3 Klaseis twn Diktuwn IP

Yparxoyn treis klaseis ari8mwn IP

• Oi ari8moi diktuwn IP klashs A xrhsimopoioun ta 8 aristerotera bit (ta aristerotera sthn tetrada) gia na prosdiorizoyn to diktyo, afhnontas 24 bit (ta ypoleipomena tria apo thn tetrada) gia na prosdiorizoyn host interface se ayto to diktyo. Oi diey8unseis klashs A panta exoyn sto aristerotero bit apo to aristerotero byte ena mhdeniko - ayth einai mia dekadikh timh apo 0 ews 127 gia thn prwth tetrada. Etsi yparxoyn to megisto 128 ari8moi 1hs tajhs diktuoy dia8esimoi, me ka8enan na periexei panw apo 33,554,430 dynata interface.

Omws, ta diktya 0.0.0.0 (gnwsto san proka8orismenh diadromh default route) kai 127.0.0.0 (to diktyo anadrashs - loop back network) exoyn eidikh shmasia kai den einai dia8esima gia thn diey8ynsiodothsh diktuwn. Etsi yparxoyn mono 126 dia8esimoi ari8moi diktuwn klashs A.

• Oi ari8moi diktuwn IP klashs B xrhsimopoioun ta aristerotera 16 bit (tis duo aristeroteres tetrades) gia na prosdiorizoyn to diktyo, afhnontas 16 bit (tis duo teleytaies tetrades) gia na prosdiorizoyn host interface. Oi diey8unseis klashs B panta exoyn ta aristerotera 2 bit toy aristeroteroy byte 1 0. Ayto afhnei 14 bit ypoloipo gia ton ka8orismo ths dieu8ynshs toy diktuoy dinontas 32767 dia8esima diktya klashs B. Gi’ayto ta diktya 2hs tajhs exoyn ari8mous apo 128 ews 191 gia to prwto meros ths tetradas, me ka8e diktyo na periexei mexri 32,766 pi8ana interface.

• Oi ari8moi diktuwn IP klashs C xrhsimopoioun ta 24 aristerotera bit (ta aristerotera tria bytes) gia na prosdiorizoyn to diktyo, afhnontas 8 bit (to dejiotero byte) gia na prosdiorizoyn host interface. Oi diey8unseis klashs C panta jekinane me ta aristerotera 3 bit ry8mismena se 1 1 0 h se ena euros apo 192 ews 255 gia to aristerotero melos ths tetradas. Yparxoyn epomenws 4,194,303 dia8esimoi ari8moi diktuwn IP klashs C, opoy to ka8ena periexei 254 interface. (Ta diktya klashs C poy exoyn to prwto byte megalutero apo 223 einai desmeymena kai mh dia8esimo gia xrhsh).

Anakefalaiwsh:

        Tajh diktuoy    Xrhsimo euros timwn toy 1oy byte (dekadiko)
                A (1h)  1 ews 126
                B (2h)  128 ews 191
                C (3h)  192 ews 254

Yparxoyn epishs eidikes diey8unseis poy einai desmeymenes gia ’mh syndedemena’ diktya - ayta einai diktya poy xrhsimopoioun IP alla den einai syndedemena sto Internet, oi diey8unseis aytes einai:

• Ena diktyo klashs A 10.0.0.0

• 16 diktya klashs B 172.16.0.0 - 172.31.0.0

• 256 diktya klashs C 192.168.0.0 - 192.168.255.0

8a parathrhsete oti to keimeno ayto xrhsimopoiei aytes tis allhloyxies diey8unsewn gia na apofeyx8ei to mperdema me ’pragmatika’ diktya kai host.

3.4 Oi ari8moi diktuwn, diey8unseis interface, diey8unseis anakoinwshs (broadcast addresses)

Oi ari8moi IP mporei na exoyn treis pi8anes shmasies:

• H dieu8ynsh enos diktuoy IP (mia omada apo syskeyes IP poy exoyn koinh prosbash se ena meso metadoshs - opws an p.x. briskontai oles sto idio tmhma enos diktuoy Ethernet). Enas ari8mos diktuoy panta 8a exei ta interface (host) bit toy xwroy ths dieu8ynshs 0 (ektos kai an to diktyo exei ypodiktya - opws 8a doume);

• h dieu8ynsh koinhs ekpomphs/anakoinwshs (broadcast) enos diktuoy IP (h dieu8ynsh poy xrhsimopoieitai gia na ’milame’, taytoxrona, se oles tis syskeyes se ena diktyo IP). Oi diey8unseis anakoinwshs gia ena diktyo panta exoyn ta interface (host) bit toy xwroy dieu8ynshs 1 (ektos kai an to diktyo exei ypodiktyo - pali, opws 8a doume).

• h dieu8ynsh enos interface (opws mia karta Ethernet h ena PPP interface se ena host, dromologhth, diakomisth ektypwsewn klp.). Aytes oi diey8unseis mporei na exoyn opoiadhpote timh sta host bit ektos ola mhdenika h ola 1 - giati me ta host bit ola mhdenika, h dieu8ynsh einai mia dieu8ynsh diktuoy kai me ta host bit ola 1 h dieu8ynsh einai h dieu8ynsh ekpomphs/anakoinwshs.

Gia anakefalaiwsh kai gia na jeka8arisoyme ta pragmata

     Gia ena diktyo klashs A ...
     (ena byte toy xwroy dieu8ynshs toy diktuoy akoloy8oumeno apo tria
     byte toy xwroy dieu8ynshs toy host)
             10.0.0.0 einai enas ari8mos, diktuoy klashs A giati ola ta host
                     bit toy xwroy dieu8ynshs, einai 0
             10.0.1.0 einai h dieu8ynsh enos host se ayto to diktyo
             10.255.255.255.255 einai h dieu8ynsh anakoinwshs/ekpomphs (broadcast) aytou toy diktuoy
                     giati ola ta host bit toy xwroy dieu8ynshs einai 1
     Gia ena diktyo klashs B ...
     (duo byte toy xwroy dieu8ynshs diktuoy akoloy8oumena apo duo byte toy
     xwroy dieu8ynshs toy host)
             172.17.0.0 einai enas ari8mos diktuoy klashs B
             172.17.0.1 einai h dieu8ynsh enos host se ayto to diktyo
             172.17.255.255 einai h dieu8ynsh anakoinwshs/ekpomphs aytou toy diktuoy
     Gia ena diktyo klashs C...
     (tria byte toy xwroy dieu8ynshs diktuoy akoloy8oumena apo ena byte toy
     xwroy dieu8ynshs toy host)
             192.168.3.0 einai enas ari8mos diktuoy klashs C
             192.168.3.42 einai h dieu8ynsh enos host se ayto to diktyo
             192.168.3.255 einai h dieu8ynsh ekpomphs/anakoinwshs aytou toy diktuoy

sxedon oloi oi ari8moi diktuoy IP poy paramenoyn dia8esimoi gia desmeysh pros to paron einai diey8unseis klashs C.

3.5 H maska diktuoy (network mask)

H maska diktuoy legetai swstotera maska ypodiktuoy (subnetwork mask). Omws, genika anaferomaste se ayth ws h maska diktuoy.

H maska diktuoy kai oi epiptwseis ths sth metafrash twn diey8unsewn IP, topika, se ena kommati diktuoy IP, poy kyriws mas afora edw, ka8ws ayto ka8orizei poia (an yparxei kapoia) ypo-diktuwsh lambanei xwra.

H klassikh maska (ypo-) diktuoy einai ola ta bit toy diktuoy mias dieu8ynshs ’1’ kai ola ta host bit ’0’. Ayto shmainei oti oi klassikes maskes diktuoy gia tis treis klaseis diktuwn einai:

• Maska klashs diktuoy A: 255.0.0.0

• Maska klashs diktuoy B: 255.255.0.0

• Maska klashs diktuoy C: 255.255.255.0

Yparxoyn duo shmantika pragmata poy prepei na 8ymatai kaneis gia thn maska diktuoy:

• H maska diktuoy ephreazei mono thn topikh metafrash topikwn ari8mwn IP (opoy topiko shmainei, se ayto to sygkekrimeno kommati toy diktuoy);

• H maska diktuoy den einai ari8mos IP - xrhsimopoieite gia na tropopoiei ton tropo topikhs metafrashs twn ari8mwn IP.

4 Ti einai ta ypodiktya;

Ena ypodiktyo einai enas tropos na paroyme mia dieu8ynsh diktuoy IP kai topika na th spasoyme etsi wste ayth h aplh dieu8ynsh IP diktuoy na mporei sthn pragmatikothta na xrhsimopoih8ei se diafora diasyndedemena topika diktya. 8ymh8eite, enas aplos ari8mos IP mporei na xrhsimopoih8ei mono se ena aplo diktyo.

To shmantiko edw einai to topika: oson afora ton kosmo ejw apo tis mhxanes kai ta fysika diktya poy kaluptontai apo to ypo-diktywmeno diktyo IP, tipota den exei allajei - paramenei akoma ena aplo diktyo IP. Ayto einai shmantiko - h ypo-diktuwsh einai mia topikh ru8mish kai einai aorath ston ypoloipo kosmo.

5 Giati ypodiktyo;

Oi aities pisw apo thn ypo-diktuwsh xronologountai pisw stis prwtes prodiagrafes toy IP - opoy mono ligosta site etrexan se ari8mous diktuoy klashs A, ta opoia epitrepoyn ekatommuria syndedemenoys host.

Prokaleitai profanws megalo kykloforiako kai diaxeiristiko problhma, an oloi oi IP computer se ena megalo site prepei na einai syndedemenoi sto idio diktyo: prospa8wntas na elegjoyme ena tetoio terastio kthnos 8a htan efialths kai to diktyo (sxedon sigoyra) 8a swriastei katw apo to fortio ths idias toy ths kinhshs (koresmos diktuoy).

Kai etsi mpainoyme sthn ypo-diktuwsh: h dieu8ynsh toy diktuoy IP klashs A, mporei na katatmh8ei, wste na epitrecei ton diamoirasmo ths se merika (an oxi polla) jexwrista diktya. H diaxeirish ka8e tetoioy jexwristou diktuoy mporei epishs na metabibastei.

Ayto epitrepei th dhmioyrgia mikrwn, diaxeirisimwn diktuwn - polu pi8anon xrhsimopoiwntas diaforetikes texnologies diktuwshs. 8ymh8eite, de mporeite na anamijete Ethernet, Token Ring, FDDI, ATM klp. sto idio fysiko diktyo - mporoun parol’ ayta na diasynde8oun!

lloi logoi ypodiktuwshs einai:-

• H fysikh katanomh toy site einai dynaton na dhmioyrgei periorismous (mhkos kalwdiwn) sxetikous me to pws h fysikh ypodomh mporei na synde8ei, apaitwntas pollapla diktya. H ypo -diktuwsh epitrepei thn ylopoihsh toy parapanw, se ena periballon IP, xrhsimopoiwntas ena mono ari8mo diktuoy IP.

Oysiastika to parapanw ginetai polu syxna apo toys ISPs, poy epi8ymoun na dinoyn stoys, monima syndedemenoys pelates toys me topika diktya, statikous ari8mous IP.

• O fortos toy diktuoy einai arketa ychlos, wste na prokalei shmantikes epibradunseis. Me to na xwrizoyme to diktyo, xrhsimopoiwntas ypodiktya, h kinhsh poy einai topikh se kapoio diktyako tmhma, kratietai topikh - meiwnontas thn synolikh kinhsh kai epitaxunontas thn syndesimothta me to diktyo xwris thn apaithsh perissoteroy pragmatikou diktyakou bandwidth (xwrhtikothta)

• Oi prodiagrafes asfaleias mporei epishs na ypagoreuoyn pws diaforetikes klaseis xrhstwn de moirazontai to idio diktyo - ka8ws h kinhsh se ena diktyo mporei panta na ypoklapei apo enan ”sxetiko” xrhsth. H ypo-diktuwsh parexei ena tropo na krathsoyme to Tmhma Prow8hshs apo to na parakoloy8ei/ypokleptei thn diktyakh kinhsh toy Tmhmatos Ereynas kai Anaptyjhs (R & D) (h toys foithtes apo to na ypokleptoyn to diktyo toy Tmhmatos Diaxeirishs)!

• Uparjh ejoplismou poy xrhsimopoiei asumbates diktyakes texnologies, kai h anagkh na tis diasyndesete kai aytes (opws anafer8hke kai parapanw).

6 Pws na ypodiktywsete enan ari8mo diktuoy IP

Afou apofasisate pws xreiazetai na ypodiktywsete ton ari8mo toy diktuoy IP sas, pws 8a proxwrhsete; Ta parakatw einai mia sunach twn bhmatwn, ta opoia kai 8a ejhgh8oun argotera me leptomereia:-

• Kante thn fysikh sundesh (kalwdiwsh diktuoy kai diktyakes diasyndeseis - opws dromologhtes.

• Apofasiste poso megalo/mikro xreiazetai na einai ka8e ypodiktyo, me bash ton ari8mo twn syskeywn poy 8a einai syndedemenes se ayto - p.x. posoi xrhsimopoioumenoi ari8moi IP apaitountai gia ka8e epimeroys tmhma toy diktuoy.

• Ypologiste thn katallhlh maska diktuoy kai dieu8ynsh diktuoy.

• Dwste se ka8e interface ka8e diktuoy thn dikia toy dieu8ynsh IP kai thn katallhlh maska diktuoy.

• Ry8miste tis dromologhseis (routes) stoys dromologhtes kai tis katallhles pules (gateways), tis dromologhseis kai tis proka8orismenes dromologhseis stis diktyakes syskeyes.

• Elegjte to susthma, luste ta problhmata kai meta xalarwste!

Gia toys skopous aytou toy paradeigmatos, 8a ypo8esoyme pws ypo-diktywnoyme ena mono ari8mo diktuoy klashs C: 192.168.1.0

Aytos arkei gia to polu 254 syndedemena interface (host), syn ton ypoxrewtiko ari8mo diktuoy (192.168.1.0) kai thn dieu8ynsh ekpomphs (broadcast address) (192.168.1.255).

6.1 Kante thn fysikh sundesh

8a xreiastei na egkatasthsete thn katallhlh ypodomh kalwdiwshs gia oles tis syskeyes poy epi8ymeite na diasyndesete, wste na antapokrinontai sthn fysikh sas organwsh.

8a xreiasteite epishs ena mhxanismo gia na diasyndeete metaju toys ta diafora tmhmata (dromologhtes, metatropeis meswn (media converters) klp.).

Einai profanws adunath mia leptomerhs syzhthsh aytwn twn pragmatwn edw. Se periptwsh poy xreiasteite boh8eia yparxoyn gurw sumboyloi sxediasmou/egkatastashs diktuwn poy parexoyn tetoioy tupoy yphresies. Dwrean symboyles einai dia8esimes epishs se ena plh8os Usenet news groups (opws to comp.os.linux.networking).

6.2 Mege8os ypodiktuwn

Yparxei ena pazari metaju toy ari8mou twn ypodiktuwn poy dhmioyrgeite kai twn ’xaramismenwn’ ari8mwn IP.

To ka8e diktyo IP exei dyo diey8unseis poy einai axrhstes gia diey8unseis interface (host)- ton idio ton ari8mo toy diktuoy IP kai thn dieu8ynsh ekpomphs/anakoinwshs. Otan ypodiktywnete, ka8e ypodiktyo apaitei apo mono toy, monadiko ari8mo diktuoy IP kai dieu8ynsh anakoinwsewn - kai 8a prepei na einai egkyres diey8unseis apo thn gkama twn diey8unsewn poy parexetai apo to diktyo IP poy ypodiktywnete.

Etsi, ypodiktywnontas, ena diktyo IP se duo jexwrista ypodiktya, dhmioyrgountai duo diey8unseis diktuwn kai duo diey8unseis ekpompwn- ayjanontas tis ’mh xrhsimopoioumenes’ diey8unseis interface (host); dhmioyrgwntas 4 ypodiktya dhmioyrgei oktw axrhstes diey8unseis gia interface (host) k.o.k.

Sthn oysia, to mikrotero xrhsimo ypodiktyo apoteleitai apo 4 ari8mous IP:

• Dyo xrhsimoys ari8mous IP gia interface - enas gia to interface toy dromologhth aytou toy diktuoy kai ena gia ton monadiko host sto diktyo ayto.

• Enas ari8mos diktuoy.

• Mia dieu8ynsh ekpomphs/anakoinwshs.

To giati kapoios bebaia 8a h8ele na dhmioyrghsei ena toso mikro diktyo einai mia allh erwthsh! Me mono ena host sto diktyo, ka8e diktyakh epikoinwnia 8a ginetai pros alla diktya kai mono. Parola ayta, to paradeigma ejyphretei sto na epideijei ton nomo poy isxuei sthn ypo-diktuwsh.

Oysiastika, mporeite na diairesete ton ari8mo diktuoy IP sas, to polu se 2ˆ n (opoy n einai ena ligotero apo ton ari8mo twn bit ston ari8mo diktuoy IP sas) idioy mege8oys ypodiktya.

Kai etsi, as eisaste realistes kata to sxediasmo toy diktuoy sas - 8elete ton elaxisto ari8mo jexwristwn topikwn diktuwn poy antapokrinetai stoys ylikous periorismous kai stoys periorismous diaxeirishs, ejoplismou kai asfaleias poy exete!

6.3 Ypologizontas thn maska ypodiktuoy kai toys ari8mous diktuwn

H maska diktuoy einai ayth poy kanei ola ta topika magika ths diaireshs enos diktuoy IP se ypodiktya.

H maska diktuoy gia ena mh-ypodiairemeno ari8mo diktuoy IP einai apla mia diaxwrizomenh me teleies tetrada ari8mwn poy exei ola ta ’bit diktuoy’ toy ari8mou diktuoy ws ’1’ kai ola ta host bit ws ’0’.

Etsi, gia tis treis klaseis twn diktuwn IP, oi klassikes maskes diktuoy einai:

• Klash A (8 bit diktuoy): 255.0.0.0

• Klash B (16 bit diktuoy): 255.255.0.0

• Klash C (24 bit diktuoy): 255.255.255.0

O tropos me ton opoio h ypo-diktuwsh dra, einai na daneizetai ena h perissotera apo ta dia8esima bit kai meta na kanei ta interface topika na metafrazoyn ta daneika bit ws meros twn network bit. Etsi, gia na diairesoyme enan ari8mo diktuoy se duo ypodiktya, 8a daneizomastan ena host bit 8etontas to katallhlo bit sthn maska diktuoy toy prwtoy (kanonikou) host bit se ’1’.

Gia mia dieu8ynsh klashs C, ayto 8a katelhge se mia maska diktuoy san thn 11111111.11111111.11111111.10000000 h 255.255.255.128

Gia ton ari8mo diktuoy mas ths klashs C 192.168.1.0, aytes einai merikes apo tis epiloges ypo-diktuwshs poy exete:-

No of      No of
subnets    Hosts/net    netmask
2            126        255.255.255.128 (11111111.11111111.11111111.10000000)
4             62        255.255.255.192 (11111111.11111111.11111111.11000000)
8             30        255.255.255.224 (11111111.11111111.11111111.11100000)
16            14        255.255.255.240 (11111111.11111111.11111111.11110000)
32             6        255.255.255.248 (11111111.11111111.11111111.11111000)
64             2        255.255.255.252 (11111111.11111111.11111111.11111100)

Oysiastika, den yparxei apolutws kanenas logos gia na akoloy8eiste ton parapanw tropo ypodiktuwshs, kata ton opoio ta bit ths maskas diktuoy prosti8entai apo to pio shmantiko bit toy host pros to pio ashmanto.

Parola ayta, an den to kanete kat’ayton ton tropo, oi ari8moi IP poy 8a prokucoyn 8a einai se mia POLY periergh akoloy8ia! Ayto kanei polu duskolo gia emas toys an8rwpoys, to na apofasisoyme se poio ypodiktyo anhkei ka8e ari8mos IP, ka8ws den eimaste polu kaloi sto na skeftomaste sto dyadiko susthma (oi ypologistes apo thn allh einai kai 8a xrhsimopoihsoyn opoiodhpote sxhma toys peite, me thn idia panta eykolia).

Afou apofasisete gia thn katallhlh maska diktuoy, xreiazetai na katalabete poies einai oi diafores diey8unseis Diktuoy kai ekpomphs/anakoinwshs - kai thn klimaka twn ari8mwn IP gia ka8e ena apo ayta ta diktya. Pali, 8ewroume mono enan ari8mo diktuoy IP klashs C kai apeikonizontas mono to teleytaio meros (toy host) exoyme:

Netmask         Subnets Network B'cast  MinIP   MaxIP   Hosts  Total Hosts
--------------------------------------------------------------------------
    128            2       0     127       1     126    126
                         128     255     129     254    126     252
    192            4       0      63       1      62     62
                          64     127      65     126     62
                         128     191     129     190     62
                         192     255     193     254     62     248
    224            8       0      31       1      30     30
                          32      63      33      62     30
                          64      95      65      94     30
                          96     127      97     126     30
                         128     159     129     158     30
                         160     191     161     190     30
                         192     223     193     222     30
                         224     255     225     254     30     240

Opws mporei na idw8ei, yparxei mia polu kala ka8orismenh akoloy8ia se aytous toys ari8mous, h opoia toys kanei ton elegxo toys sxetika aplo. H ’arnhtikh pleyra’ ths ypo-diktuwshs einai epishs emfanhs, oson afora thn meiwsh toy olikou ari8mou twn dia8esimwn host diey8unsewn, oso to plh8os twn ypodiktuwn ayjanei.

Me aythn thn plhroforhsh, eisaste pleon se 8esh na ana8esete ari8mous IP se host kai diktya ka8ws kai maskes diktuoy.

7 Dromologhsh

An xrhsimopoieite ena H/Y Linux me duo kartes diktuoy gia na dromologeite metaju duo (h perissoterwn)ypodiktuwn, xreiazetai na exete energopoihsei thn Prow8hsh IP (IP Forwarding) ston pyrhna sas. Kante ena

        cat /proc/ksyms | grep ip_forward

8a prepei na sas epistrecei kati san...

00141364 ip_forward_Rf71ac834

An oxi, tote den exete energopoihsei thn Prow8hsh IP (IP-Forwarding) ston pyrhna sas kai xreiazetai na epanametaglwtissete kai na egkatasthsete enan neo.

Gia xarh toy paradeigmatos, as ypo8esoyme pws exete apofasisei na ypodiktywsete ton C klashs ari8mo diktuoy sas 192.168.1.0 se 4 ypodiktya (to ka8ena apo 62 xrhsimopoihsimoys interface/host ari8mous IP). Parola ayta, duo apo ayta ta diktya syndyazontai se ena megalutero eniaia diktyo, dinontas tria fysika diktya.

ayta einai :-

Network         Broadcast       Netmask                 Hosts
192.168.1.0     192.168.1.63    255.255.255.192         62
192.168.1.64    192.168.1.127   255.255.255.192         62
182.168.1.128   192.168.1.255   255.255.255.126         124 (des shmeiwsh)

Shmeiwsh: o logos poy to teleytaio diktyo exei mono 124 xrhsimopoihsimes diey8unseis diktuoy (oxi 126 opws 8a perimename apo th maska diktuoy) einai giati sthn pragmatikothta einai ena ’yper-diktyo’ duo ypodiktuwn. Oi Host sta alla duo diktya 8a metafrazoyn to 192.168.1.192 san th diktyakh dieu8ynsh toy ’mhyparktou’ ypodiktuoy. Paromoia, 8a metafrazoyn to 192.168.1.191 san th dieu8ynsh ekpomphs/anakoinwshs toy ’mh-yparktou’ ypodiktuoy.

Etsi, an xrhsimopoieite to 192.168.1.191 h to 192 san host diey8unseis toy tritoy diktuoy, tote oi mhxanes twn duo mikroterwn ypodiktuwn den 8a einai ikanes na epikoinwnoun mazi toys.

Ayto katadeiknuei ena shmantiko 8ema me ta ypodiktya - oi xrhsimopoihsimes diey8unseis ka8orizontai apo to MIKROTERO ypodiktyo ston xwro diey8unsewn sas.

7.1 Oi pinakes dromologhsewn (routing tables)

As ypo8esoyme oti enas ypologisths poy trexei Linux dra san router gia ayto to diktyo. 8a exei tria interface diktuoy sta topika LANs kai pi8anon ena tetarto interface sto Internet (poy 8a apotelei kai thn proka8orismenh toy dromologhsh).

As ypo8esoyme oti to Linux xrhsimopoiei thn xamhloterh dia8esimh dieu8ynsh IP se ka8e ypodiktyo sto antistoixo interface gia to diktyo ayto. 8a ru8mize ta diktyaka toy interface ws:

Interface       IP Address      Netmask
eth0            192.168.1.1     255.255.255.192
eth1            192.168.1.65    255.255.255.192
eth2            192.168.1.129   255.255.255.128

H dromologhsh poy 8a egka8idrye 8a htan:

Destination     Gateway         Genmask         Interface
192.168.1.0     0.0.0.0         255.255.255.192 eth0
192.168.1.64    0.0.0.0         255.255.255.192 eth1
192.168.1.128   0.0.0.0         255.255.255.128 eth2

Se ka8’ena apo ta ypodiktya, oi host 8a ry8mizontan me to proswpiko toys ari8mo IP kai maska diktuoy (katallhlh gia to sygkekrimeno diktyo). Ka8e host 8a dhlwne to Linux PC ws th dikia toy pulh/dromologhth (gateway/router), 8etontas thn dieu8ynsh IP toy interface toy Linux gi’ayto to sygkekrimeno diktyo.

Gia sxolia, parathrhseis, dior8wseis, enhmerwseis peri ths Ellhnikhs metafrashs aytou toy HOWTO, steilte email sthn Boula Sanida : voulariba@hellug.gr h ston Eyripidh Papakwsta : evris@hellug.gr kai enal-

laktika : ep@rocketmail.com

Robert Hart Melbournh, Aystralia Martios 1997.