1 For s long s I ve een working with the Internet protools, people hve een sying tht IPv6 will e repling IPv4 in ouple of yers time. While this remins true, it s worth knowing out IPv4 ddresses. Even when IPv6 does tke over the ore of the Internet, there will proly e smll pokets of IPv4 networks left round, nd knowledge of how IPv4 ddresses work will e useful. Tht s wht this hpter is out: IPv4 ddresses, it-msks, nd how routeing tles work. Unlike the 48-it hrdwre or MAC ddresses ssoited with Ethernet rds (see the Chpter on Projet 802 LANs), IPv4 ddresses relly re ddresses: they ontin informtion out where the node is on the network. They re omposed of two fields, network identifier (whih identifies whih network the node with this IP ddress is on) nd node or host identifier (whih identifies the individul node on the network). The network identifier omes first 1 : Network Identifier Node/Host Identifier Also, unlike these 48-it MAC ddresses, IPv4 ddresses re only 32-its long (just over four illion unique ddresses) nd tht hs used lot of troule s the Internet hs expnded 2. Both ddressing shemes me from two different kgrounds: IP ws designed from the outset to servie wide-re network where pkets might hve to e forwrded through severl intermedite nodes efore rehing their finl destintion. IP ddresses therefore needed to ontin informtion out the lotion of the destintion node. 802 LANs were designed to run on shred medium, where everyone ould tlk diretly to everyone else, nd there is no need for the ddresses to men nything. 1.1 Introdution to IPv4 Addresses IPv4 ddresses re lwys 32 its long 3, nd re most ommonly written in wht s known s dotted deiml nottion, suh s X.X.X.X where X is deiml numer from 0 to 255, for exmple 176.54.23.207 is vlid IPv4 ddress. Eh deiml numer represents eight its, so the totl IPv4 ddress is 32-its long. Hexdeiml B036174D Dotted-deiml 176 54 23 77 Binry 10110000 00110110 00010111 01001101 In theory then, there re 2 32 4.3 illion IPv4 ddresses: not quite enough to give everyone in 1 Note this is the other wy round from postl ddresses, where the house numer (the equivlent of the node identifier) omes first; however it s the sme wy round s post odes, where the first few hrters identify the town, nd the reminder the street nd house. 2 In ft, if IPv4 ddresses were 48-its long, the single lrgest motivtion for IPv6 would e removed, nd it s possile IPv6 would not hppen t ll. 3 IP version 6 ddresses re 128 its long. 2007 Dve Pere Pge 1 09/11/2007
the world one eh, ut pretty lose. The designers of the originl ARPANET thought this ws suitly lrge numer, nd would e fine for ll future use of their network. In ft, IPv4 ddresses re in very short supply, re due to run out ompletely in few yers, nd lredy some odges hve hd to e mde 4 to mke sure tht there re enough to go round. Why? Well In the eginning (RFC 760) IP ddresses were divided into two prts: n 8-it network numer (NetID) nd 24-it host numer (HostID), identifying the mhine in tht network. Tht llowed 2 8 2 = 254 networks 5 to join the Internet, eh with 2 24 2 = 16777214 nodes 6. Two things soon eme pprent: fr more thn 254 orgnistions would wnt to join, nd none of these networks ontined nything pprohing 16 million nodes. Asking round, it eme ovious tht some networks hd the potentil to e very lrge, with millions of nodes (for exmple, IBM s network), wheres others were very smll, nd were unlikely to ever hve more thn few nodes. Assigning ll of these networks the sme (huge) numer of ddresses to use ws very wsteful. The proposed solution ws known s lssful ddressing (RFC 791). The ville ddress spe ws divided up into five lsses, known s lss A, B, C, D nd E. (Addresses in the Clss D ddresses spe were intended for multisting, nd ddresses in the lss E spe re reserved nd not ville for use; the other three lsses were used for the ddresses of individul nodes on the Internet.) Clss A ddresses hd the sme formt s the originl sheme: n 8-it network identifier nd 24-it host identifier identifying n individul node on the relevnt network. Clss B ddresses hd 16-it network identifier nd 16-it host identifier, so there were lot more lss B ddresses, lthough eh ws limited to 2 16 2 = 65534 nodes. Clss C ddresses hd 24-it network identifier nd n 8-it host identifier, so there were thousnds of possile lss C networks, lthough they were ll limited to mximum of 254 nodes. Clss A 0 1 0 2 3 4 8 16 24 31 7-its 24-it HostID 8-it NetID Clss B 1 0 14-its 16-it HostID 16-it NetID Clss C 1 1 0 21-its 8-it HostID 24-it NetID 4 The most importnt of whih is known s network ddress trnsltion (NAT). 5 Why 254? Beuse s usul in networking ll '1's mens "ll / everyone" nd ll '0's mens "this / not-known" nd neither n e used to identify n individul network. 6 Agin, you hve to sutrt two of the possile ddresses, sine ll '1's mens "ll / everyone" nd ll '0's mens "this / not-known" nd neither n e used to identify n individul node on network. 2007 Dve Pere Pge 2 09/11/2007
Figure 1-1 IPv4 Clsses A, B nd C This llowed muh more effiient use of the IP ddressing spe: nyone who only hd few nodes on their network ould e given lss C ddress nd 256 IP ddresses, rther thn over 16 million. You ould tell whih lss your ddress elonged to y looking t the top few its of the IP ddress: ll lss A ddresses egn with 0, ll lss B ddresses with the two its 10 nd ll lss C ddresses with the three its 110. There re, in theory, only 126 possile lss-a networks 7, nd originlly only hlf of them were ssigned. Any IP ddress with first yte of 9, for exmple, elongs to IBM 8. There re 16382 possile Clss B ddresses were very populr, you ould hve resonly lrge numer of hosts (up to 65534) nd mny orgnistions thought this would e very suitle numer. There ws n pprently huge numer of possile lss C ddresses (2,097,150 to e ext), ut they weren t populr. They were fine for nyone with just one smll network nd no plns to expnd, ut nyone who thought their network ould grow to more thn 254 nodes wnted lss B ddress, to void the omplete nightmre of hving to go round nd hnge ll the IP ddresses in the network when dding the 255 th node. This resulted in most lss B networks hving only few hundred nodes on them t most, whih wsn t very effiient use of the possile IPv4 ddress spe (eh lss B network ws ple of supporting 65534 nodes, fter ll), nd it ment tht the lss B network identifiers soon egn to run out. Consequently, lthough lmost ll of the possile IP ddresses were ssigned, only few perent were tully used. Address Rnge of NetIDs Rnge of HostIDs Clss A 0.0.0.0-127.0.0.0 0.0.0-255.255.255 Clss B 128.0.0.0-191.255.0.0 0.0-255.255 Clss C 192.0.0.0-223.255.255.0 0-255 Figure 1-2 Address Rnges for Clss A,B nd C Networks There re few speil ses s well tht re useful to know out, in prtiulr: 0.0.0.0 All zeros. You might think this one should men me. It does, ut only when the node doesn t know its own IP ddress, nd it s only ever used s the soure IP ddress, so it ould perhps more urtely e desried s I don t know yet. If you wnt to send pket to yourself, nd you don t know your own IP ddress, you n lwys use the destintion IP ddress of 127.0.0.1 7 One gin, you n t use ll zeros or ll ones s the network identifier. Also this is 126 networks in theory only: in prtie some of these network ddresses re reserved: for exmple the lss A ddress 10.0.0.0 is reserved for privte use, nd ny pkets ddressed to suh network should not e forwrded y ny router on the Internet. 8 Or t lest it does now. Originlly it elonged to Fort Brgg's pket rdio network. One militry mp, with one network, nd the rights to 0.4% of ll the IP ddresses in the world. It s enough to mke the Chinese weep. 2007 Dve Pere Pge 3 09/11/2007
127.0.0.1 This is the lol loopk ddress: ny pket sent to this IP ddress 9 will e reeived y the node tht sent it, ut no other node. In ft, it would never leve the node: pkets to this ddress re never trnsmitted over ny network. (You ould of ourse use your own IP ddress ut using 127.0.0.1 voids the need to find out wht your own IP ddress is, nd n e used even when you don t hve n IP ddress. Also, send pket to your own node ddress, nd it will e trnsmitted onto the lol Ethernet, so other people ould see the pket. Send pket to 127.0.0.1, nd no-one else will ever see the pket.) 255.255.255.255 In other words, ll ones. This does not, s you might expet, men ll nodes on ll networks. It s just limited rodst ddress, nd pkets sent to this ddress re reeived y ll nodes on the urrent network only, ut not forwrded through ny routers 10. It s n ddress tht sttion n use to shout for help when it hs no ide whih network it is on. The NetID followed y ll zeros This is known s the network ddress. It s not used, nd nnot e ssigned to ny individul node. The NetID followed y ll ones This is the direted rodst ddress. Pkets sent to this ddress should e reeived y ll nodes on the sme network, ut not y ny nodes on ny other networks. Note there is no ddress tht mens the whole Internet. If there were, some idiot somewhere would send millions of pkets to it, nd irritte everyone. Some people re like tht. 1.1.1 An Exmple Internetwork using IPv4 Lrge Bridged Ethernet: 138.80.0.0 138.80.255.255 Sttion: 138.80.43.124 Router: 138.80.65.123 & 135.15.42.7 Router: 19.154.101.7 & 135.15.42.14 Token Ring 135.15.42.0 to 135.15.42.255 Network 19.0.0.0 to 19.255.255.255 Figure 1-3 Exmple Internetwork using IPv4 Note tht routers hve t lest two IP ddresses: one for eh network to whih they re tthed. 9 Atully, this should hppen for ny ddress in the rnge from 127.0.0.1 to 127.255.255.254, ut onventionlly 127.0.0.1 is used. 10 There re some exeptions to this, ut they hve to e expliitly supported in the routers, nd 2007 Dve Pere Pge 4 09/11/2007
1.1.2 Where to get n IP Address IPv4 Addresses re running out. At the moment, they re mnged for the world y the Internet Assigned Numers Authority (IANA) (http://www.in.org) who ssign loks of numers to the five regionl uthorities 11. In Europe, our lol uthority is RIPE (Reseux IP Europens) (t http://www.ripe.net) 12. If you wnt set of IP ddresses, you ould go to them, ut unless you wnt lrge lok of ddresses, they ll proly refer you to lol Internet Servie Provider (ISP) offering servie in your ountry (these providers n oth ssign you some IPv4 ddresses, nd give you onnetion to the Internet). There re dozens of these ISPs: their detils re on the RIPE wesite. 1.2 Clssless Addressing nd the Current Sitution While lssful ddressing helped, it still resulted in rther ineffiient use of the rpidly diminishing numer of unssigned IPv4 ddresses. Anyone who wnted more tht 254 nodes on their network hd to hve lok of t lest 65536 ddresses, nd proly used only smll frtion of these. A ouple of ides me long to help: firstly, sunetting (RFC 950). Sunetting llows lss A nd B networks e split into sunetworks with smller rnges, so tht severl networks ould shre lss A or B ddress. (You ould split lss C ddresses s well, ut tht s not s useful.) Seondly: supernetting, whih is in some senses the opposite: supernetting llows severl onseutive lss C networks to e joined together to mke lrger network spe. For exmple, nyone who wnted 300 IPv4 ddresses ould request two onseutive lss C ddress spes, nd omine them into one lrge network with room for up to 510 nodes. Of ourse, this mkes mokery of the lss system. Essentilly we now hve lssless system wherey people re ssigned rnge of IP ddresses, nd the numer of ddresses they hve hs nothing muh to do with whether their ddresses fll into the trditionl lss A, lss B or lss C rnges. Whih retes new prolem: if you n t tell how ig network is from looking t the top few its of the ddress (nd therey seeing if it s lss A, B or C ddress), how n you tell how ig the network is? Answer: y using it msk. The it msk is 32-it numer omposed of series of 1 its followed y series of 0 its. (There re therefore only 33 possile it msks, rnging from 0 to 255.255.255.255). The msks hve 1 its where the IPv4 ddress hs its NetID field, nd 0 its where the IPv4 ddress hs HostID field. For exmple: trditionl lss-b ddress would hve it msk of 255.255.0.0, sine the top sixteen its re the network identifier, nd the ottom sixteen its re the host identifier. A trditionl lss-c ddress would hve it msk of 255.255.255.0. Construting it-msks in this wy mkes it very esy to work out whih network n IP ddress elongs to, you just do logil AND of the IP ddress with the it msk. The result is the network ddress. 11 RIPE for Europe, AfriNIC for Afri, ARIN for North Ameri, LACNIC for Ltin Ameri nd the Crien, nd APNIC for Asi nd the Pifi. 12 If you wnt to know who s reserved wht IP ddresses in the UK, then http://www.ripe.net is the ple to go nd look. 2007 Dve Pere Pge 5 09/11/2007
Sine msks lwys ontin run of 1 s followed y run of 0 s, nd they re lwys 32-its long, you n write them using just one numer: the numer of 1 its in the msk. So, for exmple, IBM's lss-a ddressing spe ould e written 9.0.0.0/8 ny IP ddress with the first eight its equl to "00001001" (i.e. nine in inry) is in IBM's ddressing spe. An exmple: suppose omputer hd n IP ddress of 130.1.9.1, with sunet msk of 255.255.248.0 (this ould lso e written 130.1.9.1/21). Wht is the network numer nd host numer? How mny omputers ould e on this network? Firstly, there re 21 its in the it msk, nd ANDing the it msk with the ddress gives 130.1.9.1 AND 255.255.248.0 = 130.1.8.0 (0.1) Tht s the network numer: 130.1.8.0. The remining 32 21 = 11 its in the IPv4 ddress n e found y doing logil AND with the inverse of the it msk: 130.1.9.1 AND 0.0.7.255 = 0.0.1.1 (0.2) so the host identified ould e written s 0.0.1.1, or 1.1, or just 257. As to how mny hosts re on this network: ny numer etween 000.00000001 nd 111.11111110 is vlid host-id, whih mkes 2046 of them (rememer ll zeros nd ll ones hve speil menings nd n t e ssigned to host omputers). Note tht this lso mens tht the numer of IPv4 ddresses in given rnge is lwys power of two. Anything / Y mens tht there re (32 Y) its left for the node identifier, nd tht mens there re 2 (32 Y) possile IPv4 ddresses: (2 (32 Y) 2) n e ssigned to individul nodes (the other two re the network ddress nd the rodst ddress). A few exmples: Rnge Network Address Brodst Address 172.0.0.0 / 31 See footnote 13 Numer of Individul Addresses Aville 172.0.0.0 / 30 172.0.0.0 172.0.0.3 2 172.0.0.0 / 29 172.0.0.0 172.0.0.7 6 172.0.0.0 / 28 172.0.0.0 172.0.0.15 14 172.0.0.0 / 27 172.0.0.0 172.0.0.31 30 172.0.0.0 / 26 172.0.0.0 172.0.0.63 62 172.0.0.0 / 25 172.0.0.0 172.0.0.127 126 172.0.0.0 / 24 172.0.0.0 172.0.0.255 254 172.0.0.0 / 23 172.0.0.0 172.0.1.255 510 172.0.0.0 / 22 172.0.0.0 172.0.3.255 1022 13 You might think tht it s impossile to hve network msk 31 its long: this rnge only ontins two IPv4 ddresses, nd fter tking out the network nd rodst ddress, this leves none left for individul nodes. In ft, it n e done (see RFC 3021), lthough you hve to turn off the rodst ddress. If you wnt to use rodst ddress for these networks, you hve to use the limited rodst ddress 255.255.255.255. 2007 Dve Pere Pge 6 09/11/2007
172.0.0.0 / 20 172.0.0.0 172.0.15.255 4094 172.0.0.0 / 17 172.0.0.0 172.0.127.255 32766 nd so on. In eh se (exept / 31), the rodst ddress is 2 (32 Y) 1 higher thn the network ddress. Another exmple: the ompny I used to work for, Mdge Networks, ws ssigned some IP ddresses y RIPE, nd the RIPE entry looked like this: uk.mdge (Mdge Networks Ltd) 19981221 212.107.128/19 ALLOCATED PA Tht mens they hd the rights to use IP ddresses strting t 212.107.128.0, with totl network identifier msk whih strts with 19 1 its, with the remining its in the network msk eing zero. How mny IP ddresses do they hve? Wht is the lrgest IP ddress they n ssign to ny omputer? 14 1.2.1 Clssless Inter-Domin Routeing (CIDR) nd so it ws deided tht ll this lss-sed stuff hd een d ide in the first ple, nd we d e etter off without it 15. The new sheme, using it-msks, is lled Clssless Inter- Domin Routeing (CIDR) nd it repled the previous lssful system. The only rel drwk is tht insted of just hving to send someone 32-its (the network ddress) to tell them out new network, you now hve to send them 32-it network ddress nd 32-it msk, nd routers need some dditionl memory to store the it msks. However, one you ve got lssless ddressing, there is very useful tehnique you n use to mke the jo of routers on the Internet esier. This is vrile-length sunet msking (VLSM). The ide is tht the network msk orresponding to ertin IPv4 ddress doesn t hve to e the sme length everywhere on the Internet. Different routers n store different sunet msks for the sme IPv4 ddress. At first sight, tht might seem rther odd however, onsider typil smll network, tthed to the Internet, s shown in the figure elow. Assume tht the network dministrtor of this network hs een ssigned the IP ddresses 19.53.0.0/22. Tht gives 2 (32 22) 2 = 1022 different IP ddresses, whih here re distriuted round five Ethernet segments. Without VLSM, ll of these routers would hve to hve entries in their routeing tles for ll of these five sunetwork segments. The routeing tle for router A would hve to look something like: IP Address Send Pket to: Send Pket from: 19.53.0.0 / 25 Router C Port 19.53.0.128 / 25 Router C Port 19.53.1.0 / 25 Router B Port 19.53.1.128 / 25 Router B Port 14 Answer: 8192, nd 212.107.159.254 (they n t use 212.107.159.255, tht would e rodst to ll omputers in the network). 15 IPv6 doesn't hve lsses t ll. Lesson lerned. 2007 Dve Pere Pge 7 09/11/2007
19.53.2.0 / 24 Diret to destintion Port Everywhere else ISP Port A To the rest of the Internet sunet n 19.53.2.0/24 B C 19.53.1.128/25 19.53.1.0/25 19.53.0.128/25 19.53.0.0/25 Figure 1-4 A Smll Network Atthed to the Internet However, router A n use tehnique lled route ggregtion. All it relly needs in its routeing tle is: IP Address Send Pket to: Send Pket from: 19.53.0.0 / 24 Router C Port 19.53.1.0 / 24 Router B Port 19.53.2.0 / 24 Diret to destintion Port Everywhere else ISP Port nd ll ny router in the ore of the Internet needs to know is tht to deliver pket nywhere in the rnge 19.53.0.0 / 22, it should e sent to router A in this network. Tht mkes the routeing tles in the ore routers very muh smller, nd tht s very good thing: it sves memory, speeds up the looking up of destintion ddresses in the router s tles, nd redues the mount of informtion tht hs to trvel etween routers s they ontinully try to keep their routeing tles up-to-dte. Then there s router B. All it relly needs in its routeing tle is: IP Address Send Pket to: Send Pket from: 19.53.0.0 / 24 Router C Port 19.53.1.128 / 25 Diret to destintion Port 19.53.1.0 / 25 Diret to destintion Port 19.53.2.0 / 24 Diret to destintion Port Everywhere else Router A Port It doesn t need to know tht the ddress spe 19.53.0.0 / 24 is divided into two sunetworks y router C. It just sends pkets to nywhere in this ddress spe to router C, nd lets router C worry out how the network is su-divided on the other side. 2007 Dve Pere Pge 8 09/11/2007
Note tht the IPv4 ddress 19.53.1.73 is, ording to router B s routeing tle, in the sunetwork 19.53.1.0 / 25. In router A s routeing tle, it s in the sunetwork 19.53.1.0 / 24. And in the routeing tles of the ore routers in the Internet, it s in the network 19.53.0.0 / 22. The sme IPv4 ddress, ut it s got three different it msks of different lengths in different routers. It might seem it onfusing t first, ut it sves lot of time nd effort keeping ll the routeing tles in the Internet up-to-dte. Now, the network dministrtor of this network n divide one of these su-networks gin if he wnted to, or trnsfer some ddresses from one su-network to nother, nd the rest of the Internet wouldn t need to know. 1.2.2 A Slight Vrition: Unequl Sized Sunetworks In the lst exmple, ll the sunetworks on ports nd of routers B nd C were the sme size: they ould eh support 126 nodes. Wht if one network grew muh fster thn the other, so you wnted to hve 200 nodes on one Ethernet, nd only 20 on the other. Could you do this? In theory, it s not hrd. You ould, for exmple ssign the IPv4 ddresses from 19.53.0.0 to 19.53.0.31 to the smller sunetwork (sunet s in the digrm elow), giving enough IPv4 ddresses for 30 nodes (19.53.0.1 to 19.53.0.30); nd the rnge from 19.53.0.32 to 19.53.0.255 to the lrger sunetwork (sunet r in the digrm): A To the rest of the Internet sunet n 19.53.2.0/24 19.53.1.128/25 sunet p B 19.53.1.0/25 sunet q 19.53.0.32-255 sunet r C sunet s 19.53.0.0/27 Figure 1-5 Exmple Network with Unequl Sunetworks It s esy to see how sunet s ould e put into the routeing tle for router C, it s just the rnge 19.53.0.0 / 27. But wht out sunet r? How n you express the rnge of IPv4 ddresses from 19.53.0.32 to 19.53.0.255 in terms of network ddress nd it msk? The simple nswer is: you n t. Not with just one network ddress nd one it msk, nywy. The prolem is tht it msk lwys leves n integer numer of its ville for the node identifier; nd tht implies the numer of IPv4 ddresses ssoited with network must e power of two. Here, we ve got 255 32 + 1 = 224 ddresses ssigned to sunet r, nd tht s not power of two. One solution is to express this rnge of ddresses s the sum of severl rnges, ll of whih do hve numer of IPv4 ddresses tht s power of two, for exmple: 19.53.0.32 / 27 Rnge from 19.53.0.32 to 19.53.0.63 (32 ddresses) 2007 Dve Pere Pge 9 09/11/2007
19.53.0.64 / 26 Rnge from 19.53.0.64 to 19.53.0.127 (64 ddresses) 19.53.0.128 / 25 Rnge from 19.53.0.128 to 19.53.0.255 (128 ddresses) ut tht tkes three entries in the routeing tle, nd retes three sunetworks. It s it of wste of IPv4 ddresses too: there re now six ddresses in the rnge of IPv4 ddresses ssigned to this sunetwork tht n t e given to individul nodes: three network ddresses, nd three rodst ddresses, one for eh of these rnges. Fortuntely, there s solution. Assign the rnge 19.53.0.0 / 27 to sunet s, nd the rnge 19.53.0.0 / 24 to sunet r. Then router C s routeing tle would look like this: IP Address Send Pket to: Send Pket from: 19.53.0.0 / 27 Diret to destintion Port 19.53.0.0 / 24 Diret to destintion Port 19.53.1.0 / 24 Router B Port 19.53.2.0 / 24 Diret to destintion Port Everywhere else Router A Port Now you ve proly spotted tht there s n interesting prolem with this: the IPv4 ddresses from 19.53.0.0 to 19.53.0.31 re now mthed y oth of the first two entries in this routeing tle. How does the router know where to send these pkets? Answer: to the destintion with the longest it msk. In this se, tht mens they go out of port, sine this entry in the tle hs longer it msk (27 its, s opposed to the seond entry in the tle, tht only hs 24 it long it msk). The IPv4 ddresses from 19.53.0.32 to 19.53.0.255 only mth the seond entry, so they get sent out of port. This mkes it very esy to represent the entry for everywhere else, you n represent this rnge s 0.0.0.0 / 0. All IPv4 ddresses lie in this rnge: ll tht is required is tht the top zero its in the ddress re equl to 0.0.0.0, whih is lwys true. However, sine the it-msk is zero its long, this is routeing tle entry of lst resort. If pket s destintion ddress mthes ny other entry in the routeing tle, it will not e used. This gives finl routeing tle of: IP Address Send Pket to: Send Pket from: 19.53.0.0 / 27 Diret to destintion Port 19.53.0.0 / 24 Diret to destintion Port 19.53.1.0 / 24 Router B Port 19.53.2.0 / 24 Diret to destintion Port 0.0.0.0 / 0 Router A Port You might lso hve spotted some other potentil prolems: for strt, the network ddresses for sunet r nd sunet s re the sme: 19.53.0.0. However, sine pket is never sent to the network ddress, nd networks re identified y the omintion of their network ddress nd it-msk, there is never ny onfusion here. Also, the direted rodst ddress on sunet s is 19.53.0.31, nd this is vlid IPv4 ddress tht ould e ssigned to node on sunet r. Agin, this isn t prolem in prtie, s long s you don t ssign this ddress to ny node on sunet r. In ft, this method tully sves n IPv4 ddress: sine the network ddress of these two networks is now the sme, there re only three IPv4 ddresses in the rnge 19.53.0.0 to 19.53.0.255 tht nnot e ssigned to n individul node: 19.53.0.0 (network ddress), 19.53.0.31 (rodst ddress for sunet s) nd 19.53.0.255 (rodst ddress for sunet r). 2007 Dve Pere Pge 10 09/11/2007
Admittedly, this is rther inelegnt nd it onfusing, nd if you ve got enough IPv4 ddresses, it would e muh etter to ssign the sunets the sme numer of IPv4 ddresses. IPv6 lrgely voids this prolem; there re so mny IPv6 ddresses you don t hve to e so reful out preserving them. 1.2.3 A Look t Windows If you look inside Windows, you ll find tht the node knows the lol sumsk s well s the IP ddress. My windows IP Address ontrol ox looks like this: Figure 1-6 Setting-Up IPv4 on Windows 2000 Computer Why would the end sttion in your omputer need to know the lol sumsk? Beuse it needs to know wht the lol rodst ddress is. This sunet hs 23 it msk, whih mens the lol rodst ddress ends with 32 23 = 9 ones. Tht mkes the lol rodst ddress 144.32.137.255. This node should reeive pkets ddressed to 144.32.137.255, ut not, for exmple, pkets ddressed to 144.32.136.255. (144.32.136.255 is vlid host ddress on this sunet, nd ould e the IPv4 ddress eing used y nother omputer.) (If I tiked the Otin n IP ddress utomtilly option, the mhine would try nd find out its own IPv4 ddress using DHCP. See lter in the ook for more detils out DHCP). If I open ommnd prompt, nd enter the ommnd route print, then I see this: 2007 Dve Pere Pge 11 09/11/2007
Figure 1-7 A Routeing Tle in Windows Mhine Note tht the defult route is 0.0.0.0 with network it-msk (netmsk) of 0.0.0.0 s expeted, nd ll pkets tht don t mth ny of the other entries will e sent out of interfe 144.32.136.46 (this omputer s IP ddress, ssoited with the Ethernet rd in my PC) towrds 144.32.136.253 (the defult gtewy 16 ).Key Points Originlly, IPv4 ddresses onsisted of 8-it network identifiers (net-ids) nd 24-it host identifiers (host-ids), nd tht the demnd for more networks led to lss-sed ddressing; lthough this did not provide very good solution, nd these dys the Internet uses lssless ddressing. IPv4 ddresses re onventionlly written in dotted-deiml formt, nd rnges of IPv4 ddresses re written in the X.X.X.X/Y formt where Y is the length of the network it msk. For the rnge X.X.X.X / Y, the network ddress is X.X.X.X, nd onsists of the top Y its of the IPv4 ddresses of ny node on the network, nd the ottom (32 Y) its re zero. This network ddress n never e ssigned to node. For the rnge X.X.X.X / Y, the rodst ddress hs the ottom (32 Y) its ll set to one, nd pkets sent to this destintion ddress re reeived y ll nodes on this network. The rnge X.X.X.X / Y, n ommodte 2 (32 Y) 2 nodes: the highest nd lowest ddresses in this rnge nnot e used for individul nodes. 16 A gtewy is router tht ts s the link etween one network nd nother: in this se the one going outside the lol sunet. The two terms ( router nd gtewy ) re often used lmost interhngely, lthough stritly speking some routers re not gtewys: there is router funtion inside every single node on the Internet (for exmple, see the routeing tle in the PC in the figure ove), lthough my omputer is not gtewy: it doesn t provide link etween two networks. 2007 Dve Pere Pge 12 09/11/2007
1.4 Tutoril Questions **1) Go nd hve look t the RIPE we site, (http://www.ripe.net) nd find out whih IP ddresses hve een ssigned to the Holy See in the Vtin (ountry ode v ). How mny IP ddresses does the Pope ontrol? Wht s the mximum numer of host omputers in the Vtin? 2) Consider the sitution if only lss A, lss B or lss C ddresses were ville. Assume everyone who wnted lss A ddress hd one million hosts, if everyone who wnted lss B ddress hd one thousnd hosts, nd everyone who wnted lss C ddress hd ten hosts. How mny hosts would there e on the Internet when ll ville ddress spe hd een lloted? Wht proportion of the totl ville ddress spe does this mke? 3) Whih of the following ddresses lies in the rnge 12.62.148.128 / 26? 12.62.149.15 12.62.149.24 12.62.149.204 12.62.148.160 4) Whih one of the following rnges mthes 237.223.131.179? 237.223.224.0 / 19 237.218.0.0 / 15 237.223.0.0 / 17 237.223.128.0 / 17 5) Whih one of the following rnges ontins oth 139.123.124.158 nd 139.123.124.128? 139.123.124.128 / 27 139.123.124.32 / 27 139.123.124.160 / 28 139.123.124.0 / 27 6) Whih one of the following rnges ontins 165.218 / 15? 165.212 / 14 165.216 / 14 165.220 / 16 165.192 / 13 *7) A network dministrtor otins the rights to use the rnge of IPv4 ddresses 203.132.52 / 22. He uilds the network shown in the digrm elow, with four sunets. If there re 100 nodes on eh sunet, ssign the IP ddresses to the vrious sunets in sensile wy, nd give possile set of entries for the routeing tles in the three routers shown. 2007 Dve Pere Pge 13 09/11/2007
A To the rest of the Internet sunet n B sunet m sunet p C sunet q *8) Revisit question 7), ut now onsider the se where there re 180 users on sunet m, 280 users on sunet p, 200 users on sunet q nd 73 users on sunet n. How ould you ssign IPv4 ddresses to the four sunets now? *9) A user with n llotion of 130.26.184.0 / 23 uilds network with the following topology: A To the rest of the Internet d B sunet n sunet m sunet p C sunet q If there re 180 nodes on sunet m, 50 on sunet p, 40 on sunet q nd 60 on sunet n, suggest suitle llotion of IPv4 ddresses to the vrious sunets, nd dedue simple routeing tle for router A. *10) The originl RFC desriing sunetting did not llow the first or lst sunet in ny network rnge to e used, wheres most modern routers re quite hppy to ssign these ddresses to sunetworks. Wht hnged? Why were these sunets not llowed in the first ple? 2007 Dve Pere Pge 14 09/11/2007