You are on page 1of 976
pe a il Human Relief Foundation éailaigl iy) daaija ” idl gl oot cai di a ad McGraw-Hill Higher Education 39 A Des f The MeGraw- HU Compan ‘TCPIP PROTOCOL SUITE, SECOND EDITION Published by MeCcaw-il business unit of The McGrail Companies. Ie. 121 Avenue of the Americas, New York, NY 10020. Copytight ©2003, 200 bs The McGraw-Hill Compan, Ine. Allg esrved, No pt ofthis publication may be reproduced or distibued in any Tor or byany means or stored ina databate or reetal system, witout he prior wtten consent of ‘The Mccraw il Companies, Ine, including, but noite. in any network ee lectronie Siorge or transmission or broadest fr distance ean. Some ancillaries. inctuing electtonie and print somponents mas ao be aailabe to customers ‘use the United States. “This hook is printed on acid-free paper Ieroational_ 1 23.4367890D0CIDOC 098: Domestic 1234567890DOCIDOC 0937 ISBN 0-07-246060-1 ISBN 0-07-119962-4 USE) Fiber Blinbeth A Jones ; Seior develoenenta edits. Lupa Execute marting manager oh Warmenccher Project manages Sila Front Prolactin superior! Sher b Kane Bedia projet manager: Jo K. Bonercts jaan Serie eda chooogy producer Philip eet | Accession No Cordiator of fetace design: Rick D. Noe! - Gover desgnts Joanne SchpletOrephie Vio |= eat Gover images Ofader Stock, nage number 362261, HEGTOT We Chater Rear Cambridge MA By James Lemos Goujon nective Compson Corporation “Typeface: 0/12 Times Roman Pim RR, Donncles Sans Compons/Cranforite. Y Univers tral Us ; Library of Congress Cataloging i-Publication Data Forouzan, Behr A. "TCP prooco suite Behrouz A. Forouzan, — 204 Pett (McGraw-Hill Fratzan networking Sos) Includes bibiognphiea! references and iadex ISBN 0-07-246060-1 —~ISBN0-07-119962-4:1SE) LLTCPRP (Computer network protsco). Tile, Seis. “TKSi05.585.F67 2003 oe 2—8e2t soo202eens cr INTERNATIONAL EDITION ISBN 0-07-119962- (Copyright © 2003. Exclusive rights by The McGrail Companies. In. or mamufstre Sn export, This book cannot be re-export om the county 1 which ts sold by McGraw Hil ‘The Ineratonl Eton is aoe avalale in North Ameri. vowwemite om TCP/IP ; Protocol Suite Second Edition Behrovz A. Forouzan with: Sophia Chung Fegan a Boston Burr Ridge, IL Ououque, IA Madison, WI New York San Francisco St.Louis Bangkok Bogota Caracas Kuala Lumpur Lisbon London Madtid Mexico City Mian Montesl New Delhi Santiago Seoul Singapore Sydney Taipei Toronto TCP/IP Protocol Suite J fogut University * Central Library \ aceon tion Dept. Fe, ‘McGraw-Hill Forouzan Networking Series ‘Titles by Behrouz A. Forouzan: ‘Data Contmunications and Networking ICPAP Protocol Suite Local Area Nenworks Business Dara Communications To the memory of my father, the source of my inspiration —~Behrouz Forouzan - A BRIEF TABLE OF CONTENTS Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter § Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14, Chapter 15, Chapter 16 Chapter 17 Chapter 18 broratuction £ The OSE Malet and she TCPHE ¢ socal Suse 19 Underlying Teclinlogies 47 IP Addresses: Classful Addressing 89 Submetsing/Supernesing and Classless Addressing 119 Delivery em

, mbtracted earned 4, mosited 6, When datas wansmined ftom device A to device B, the header fom A's aver 5s read by B's ler. «physical anspor 7e. sion 4. presentation +, Which layer functions a Hisson between user support layers and network: ip port layers? 4, negwork ayer by physical layer 5: seanspot ayer a. session layer 8 Whats the main funtion ofthe anspor Layer? 1 node-to-node livery _A>. proses to-process message delivery synchronization 1. updating and maintenance of routing ables 9, Session ayer checkpoints ‘allow just «portion ofa ile wo be resent by detect and recover errs contol the adion of headers re involved in ding contol 10, Bryption and decryption se functions ofthe anspor bs session yee _sesntation| ‘application 6 CHAPTER? THE OSI MODELAND THE TCPAP PROTOCOL SUITE 11, Which ofthe following is an application layer service? a netwoek vita erminal by file ransfer, access, and management mal sevice 4. allof the above 12, When aos on network A sends a messuge toa hast on network B, which address oes the router lok a? 2 port oP «physical 4, none oF the above 13, To deliver & message tothe comect application program running on a host, the adgess most be consled. & por oP physical 4. none ofthe adore 14, Pro as si adresse, a2 be © 28 4. variable 15. IEMPv6 includes ___ IGMP b ARP . RARP dame Exercises 16, How are OSI and ISO relate to each ober? 17, Match the following © one ofthe seven OST layers: a route determination Bow conto «. iterfae to ouside would 4. provides acces to the network forthe end user «changes ASCII to EBCDIC packet switching 18. 19. n. 2. 2s. SecTION28 PRACTICESET 38 Match the following o one ofthe seven OST ayers a relable process-0-process message delivery by. ewwork selection defines frames {proves user services such as ema and fle transfer fe, wansmission of bit stam eros physeal meio ‘Match he following 0 one ofthe sven OST ayes a. communicate directly with uses application program >. error cometion and retansmission mechanical electrical, and fanctonal interface ‘responsibilty for infermetion between adjacent nodes reassembly of data pockets “Maich the following to one ofthe seven OST Layers format and cade conversion services bs esablishes, manages, and terminates sessions «ens reliable transmission of data 6, login slog out procecures «provides independence fom diflerences in data representation f. synchronization of users ‘Domain Name System or DNS (ee Chapter 18) isan application program nthe "TePMP protocol suite, Do some research and nd te egivaleat of this protocol {if any) in the OSL model. Compare and contrast the. Tile Transfer Protocol or FTP (se Chapter 20) isan aplication program inthe "TCPIP protocol suite. Do some research abd find the equivalent of this proteol {ifany) nthe OST model. Corppare and contrast the 1. "Tvl File Transfer Protocol or TFTP (ste Chapter 21) is an aplication progam inthe TCPI protocol suite. Do some research and Gnd the equivalent ofthis ro tocol (fan) inthe OST mode Compare and contrast the Wo. "There are severah transport layer models proposed in the OS model. Do some ‘eesich and Sind all of them. Explain the diferences between them, "There are sever network layer models proposed in the OST model, Do sme ‘evcarch and fin ll of them. Explain the differences between them. R3 Underlying Technologies ‘We can think of the Inert as series of backbone networks that are run by intra tional, nations, and regional ISPs. The backbones aze joined together by connecting deve such as routers or by switching Stations. The end users are eiber pate the local ISP LAN or connected via poineto-point networks tothe LANs, Conceptally. the Intmet is a set of switched WANS (backbones), LANE, poit-to-point WANS ad connecting or Switching devices as shown in Figure 3.1 Figure 341 inerr made, a age Se Although the TCPYP protocol site nonmlly shown a8 ive-ayer stack, only {efnes protocols forthe upper thee layers, TCPIP is only coneered about the ne work, tanspert, and aplication layers. This means that TCPAP assumes the exsence af tase WANS, LANS, and the connecting devices that jin them, "We do the seme, We assume thatthe reader i already faite withthe undeying technology of data communications, tlecommunications, LANs, WANS, and comet ing devices (CHAPTER 3 UNDERLYING TECHNOLOGIES However af briet review, we touch upon these underlying technologies in this chapter, Note ha we cannot cover aty of these topics i detail this would require & ‘ok os two. For more in-depth coverage, se Forouzan, Introduction 1 Data Comm ications and Networking, 2 ed McGraw-Hill, 201, and Forouzan, Local Area Net trons, MeGrsw Hil, 2003 3.1 LOCAL AREA NETWORKS (LANS) ‘local area network (LAN) is data commosication sytem tat allows a numberof independent devices to communicate directly with each ocer in a Timited geographic fea such asa single department, a single building, ora carpus. A large organization ‘may need several connected LANS, “The most popular LANs are Ethernet LANS, Token Ring LANS, wireless LANS, and ATM LANs, We briefly review the fit thre technologies inthis section; we dis- fuss ATM LAN after we have discussed ATM technology. or fuer discussion of LAN, see Forouzan, Local Area Networks, McGraw ua, 2008 Ethernet "Ethernet sth mst widely ws local ara network protocol. The protocol was designed in 1973 by Xeton with «data rate of 10 Mops anda bus topology Today it has a data rate of 100 Mbps and 1000 Mbps (I gaat per second). Ethernet is formally defined bythe IEEE 02.3 standard (se Appeodix F). ‘Traditional Eshernet (10 Mbps) ‘The original Etheme, usally refered to 8 traditional Beret, had 10-Mlps data rate, We discuss this Bthemet version fist. ‘Access Method: CSMA/CD The TEEE 802.3 standart defines carrier sense malt ple acess with colision detection (CSMA/CD) asthe acess metod for editions {Biome Sstions ona traditional Ethernet ea be connected together using a physical ts or star topology, bt the lpia topology is aways bus. By this, we mean thatthe ‘medium channe) sshazed between stations and only one sation atime can use it I flo implies that ll satons rove a frame seat by a station (roudcasting). The rel “estination keps the frame while the est drop i I this station, how can we be sare that to stations are not using the medium afte same time? If they do, thei ames ‘wil code with cach other, CSMALCD is designed to solve the problem according to ‘he folowing principles: 1. Every sation hasan equal right othe medium (tulip acces) 2. very sation witha rame to send fist listens to (Senses the media. I ther is20| dats onthe dius, the sation can start sending (Carer sens) 5, emay happen that to sation both sense the medium, fn it ie and start send fing. this ease collision occur. The protocol forces the sation to continue t0| fist othe line ater sending as begun Mt there sa collision, all stations sense SECTION 31 LOCALAREA NETWORKS(LAN) 49 ‘he colision; each sending tation sends jam signal to estoy the data onthe line land, afteeach wat a difeent random ie, uy agin. The random ies prevent the snltaneoosre-sending of at Figur 3.2 shows CSMA/CD. Figare'32_ csMacco cote sana Con et "Dee factors ar rete inthe CSMAICD standard: the minum frame length, ‘te data transmission cate and the ellison domain. The time the station needs tn wait tobe sre thal there is no data on the lines the minimum frame Tenth divided by the transmission rate (he time required to sead out the minimum frame lent). This time fs proportional to the time needed for the ist bit to travel the maximum network is- tance (collision domain. In other words, weave ‘Minium re leopih/Tanenision ate "spopaions Colson dat ropaion speed Sn tational Etro, he minimum fame length is $20 bits, te transmission ate {is 10 Mbps the propeition speed i almost the speedo ight, andthe colisin domain {is alimost 2500 meters, Layers Figure 33 shows the 10-Mops Ethernet layers. The dts lnk ayer bs two ublayens: the logical ink contol (LLC) sublayer andthe media acces contol (MAC) fablayer The LLC layer ie responsible for Bow and error contol atthe dt ik ayer ‘The MAC sublayr is responsible for the operation ofthe CSMAICD acees method. ‘The MAC sublayer lo frames data ceived frm the LLC layer and passes thefames tothe pysieal layer for encoding. The physical layer transfers data nto electri si als ad ends them to the nex tion vi he transmission medium. This botm ayer tlso detects and reports collisions othe data ink aye. Frame IEEE 802.3 specifies one frame type containing seven fields: preamble, SED, DDA.SA. lengthype of PDU, 802.2 frame, andthe CRC. Fthemet doesnt provide any ‘0 CHAPTER3 UNDERLYING TECHNOLOGIES Figure 33. Bere layers ‘mechanism for acknowledging received frames, making it what is known a an unl shle medism, Acknowledgments mast be implemented atthe higher ayers. The format of the CSMAICD MAC frame is shown in Figure 34, Figure 34 tere frome | SiO Seine nctitoa.y | sro Pages | atc | 7 cS | Teer Tie yer thes Des er 18 Preamble. The preamble ofthe 8023 Frame contains 7 byes (56 bits) of alterna fing Os ands that lert the receiving system to the coming frame and enable it synchronize its inpat timing: The peamble i craly ald a he pysia! layer ‘nds ot (formally) pat of the fame. ‘© Start frame delimiter (SED). The SFD fli (1 byte: 10101011) ofthe 8023 frame signals the beginning ofthe frame. The SFD gives the station a last chance fer syfehronization. The last two bis are 11 and ate a signal thatthe next eld i the esinaton adress, ‘= Destination address (DA). The DA fed is 6 bytes and contains the physical ess ofthe intermediate or destination station, Source address (SA), The SA Seld is also 6 byte end contains the physies! dress ofthe sending or intermediate sation, ' Lengthtype. The length ype field has one of two meanings. If the value ofthe felis tess than 1518, its a length eld and defines the length ofthe data el that follows. Ifthe vale of tis felis greater than 1536, it dines the upp aye pro tocol tha uses the service ofthe Interact. "Mata. The dats fete caries data encepsulted from the upper layer protocol, is minimum of 46 and » maximums 1500 bytes. SPCTIONW 3.1, LOCALAREA NETWORKS(LANS) $1 1m CRC. The last ld inthe 802.3 frame contains the ero detetion infomation, in this cas & CRC-32 (ee Appendix D), Addressing Each station suchas a PC, workstation, or peintes on an Elernet net- ‘work has is own network interfce card (NIC). The NIC fis inside the station and ‘provides the sation with a 6-bytephyseal adress. The Ethernet addess is Gbytes {48 bts) that is orally waten in hexadecimal notation wih a hyphen to separate bytes shown below roaraca “The adateses in Ethmet ae seat byte by byte, let to righ; however, foreach byte the least sigaficant is sent fist and the ost signiicant iti ent ast "There are te types of addreses in Ethernet unicast, multicast, and broads. In a unicast address, the last significant bit ofthe fist bye is 0: in the muilcast ‘adres, the least sgafcat bit is 1 broadeast addres 8s. A source ares is flwvays nicest Te destination adress can be unicast (one single ecpient), muss {a group of reipint), or broadas (all stations connected tothe LAN). Implementations The IEEE standard defines several implementations for atonat Internet. The ellowing foar ae common: ‘a TOBASES (hick Ethernet) uses a bos topology’ with a thick coaial cable asthe transmission mediom. 1m 1OBASE2 (hin Ethernet or Choupernet) uses a bus topology wih a tin coaxial cable asthe transmission medium. sm LOBASE-T (ised pie Beet) ws a physical star topology (te logical epology is all abs) wih ations conocted by wo pis of twistd- pi eable woe hab = TOBASE-FL (fiver lnk Bitomet) uses a star topology (the logical topology is tl ‘bus with tations connected by a pair of fiberoptic cales othe hub |A simple representation ofthese four implementations is shown in Figure 35. The transceiver, which can be exteroal oe internal, is responsible fr encoding, ellison ‘detection, sod ransmtingloceving signals. Fast Ethernet "The eed fora higher data rate reuled in the Fast Eheret protocol (100 Mp). Ia the MAC layer, Fast Ethernet uses the same principles as traditional Eahemet (CSMAV (Cb) except tha the tunsmision rate has been increased from 10 Mbps 0 10 Mls. For CSMAICD fo work, we have two choices: either increase the minimum fame Tengthor decrease te eallsion domain (he speed of light cannot be changed). ees ‘ng te minim length ofthe fame involves eeltionl overhead, Ifthe data tobe seat ‘not long enough, we mst ad extra bytes, Which means more overhead and oss of ‘eiiiene. Fast Eternet bas chosen the other option; te collision domain bas been fsereased bya factor of 10 (from 2500 meters to 250 meters). With a star topology. 2350 meter is acceptable in many ears. nthe physical layer, Past Ethernet wses ifr ent signaling method and different madi to achieve a data rate of 100 Mbps CHAPTERS UNDERLYING TECHNOLOGIES Figure 3.8. Eheret nplenenaons Tamra Tiseomaiane anc | ae | nn oe | | Ls tomas wast Fast Ethernet Implementation Fast Ethmet can be categorized ae cers two-ire cr four wre implementation. The tvo-wire inplemetation scaled 100BASE-X, with ihr wise pir ale (OOBASE-TX) o¢ Shep cble 1OOBASE-FX, The four tite implementation is designed only fortis paie cable (IO0BASE-T4) I er ‘words, we have hee implementations: 100BASE-TX, 100BASE-FX, and 10OBASE-T4 (cee Figue 3.6, (Gigabit Etnernet "The peed for a data rte higher than 100 Mis result inthe Gigablt Edneret proto ‘col (1000 Mbp). To achieve this data rate the MAC layer has two options: keeping. CCSMAICD or dropping it For the former, thet choices ar, once again, to decrease the collision domain or increase the minimum frame length. Sine a callison domain of 25 meses is unacoepable, the minimum length ofthe fame is increased in avery clegant way, SECTION 1 LOCAL AREA NETWORKS LANs) 53 igure 26 Fast Ethene mplomentons Twisted pir abl pened =) ol Tin A Sema maser smasse ol cromase-te Inthe second option, dropping CSMAVCD, every ston is conected by two spe sate paths othe ental hl, his called l-dupen Ebert with no collision snd no need for CSMAICD. TA the physica! level, my changes have een mae allow the transmission of data at sr. ‘Gigabit Ethernet Implementation Gigabi theme can be classified citer «t40- ‘vite o four implementation. The wo-Wite implementation is called 1000BASE-X, With opal bers transiting sbort- ave laser signal (IOQ0BASE-SX), optical fers Transmiting long-wave lise signal (1000BASE-LX), and shieted wise pir tarsmit- ting electrical signal (JQQ0BASE-CX), The four wie version uses twisted-psr cables [CODIBASE-T). note words, we have Soar implementations, tre of which ae shown inFigue 37. ‘Token Ring. “Token Ring is a protocol define n IEEE Project 8025. Te uses a token passing acess ‘method, Token passing ie iustrated in Figure 38, Whenever the network is unoespied, 1 simple 3-bye token circulates, Ths token is paste from station station unt i Encounters a saion with data to send. The sation keps the token and sendy 2 data frame, This daa frame proceeds around he ring, being regenerated by each sation Fach intermediate station examines the desiation adress, nds thatthe frame is 54 CHAPTERS UNDERLYING TECHNOLOGIES Figure 37 Giga Ethernet implementations reso to another station, and relays it it neighbor. The intended epint recog. ‘izes its own ates, copes the message, check fr err, and changes 4 bits in he last byte ofthe Frame to indicat adress ecognizod and frame copied. The fll packet ‘hen cones around the eng unt returns 1 the station that sent Layers ‘Token Ring wes the same two layers as Ethernet. Theda link layers divided int two sublaers: LLC and MAC. Te LLC plays the same role as in Ethernet The MAC sub- SECTION 21 LOCAL AREA NETWORKS LANs) 58 luyeris responsible forte token passing an eseation operations Is also esponsble ‘or frame ctston end frame delivery 1th physical layer Frame “Token Ring defies thee 1ypes of frames: data, token and abort. Data Frame In Token Ring, the data frame isthe only one ofthe three types of ‘ames that can cary a protocol data unit (PDU) ad the only one addressed 0 pe- ‘fic destination eather dan being evailabe to the rng a lage. Figure 39 shows the format ofthe data frame igure39 Duo frame So Seta ap AD eddie) Ae hewn ol 1S Press ‘Reames oe pe The Toe Toye Shyer — Ser Ope GaDoyS Fes Te Ti “The following desries each ld in the fame: ‘= Start detimiter (SD), The first ld ofthe data frame, SD, i byt tong acd is ‘sed fo let de receiving station othe aval ofa frame as well to allow it to synchronize its eval timing ‘= Access control (AC), The AC eld is 1 byt log ad includes four subflds The frst 3 bits ae the priority eld. Te fou bits called the token bit and is wo indicate thatthe frame is dla frame rater than a token or an abort frame. The token bits fllowed by & monitor bit The ls 3 bits are a reservation field tha an be sey stations wishing to reserve secs to the ring. ‘= Frame control (FC). The FC fd is 1 bste long and contains two fields. The iat isa P-bit feld used to indicate the typeof information contained inthe PDU (eter ts contol information r daa), The second uses the remaining 7 bis of| the byte and coutins information wed by Taken Ring (eg. Row to use the infor ‘mation inthe AC felt). ‘= Destination address (DA). Tho G-yte DA fick contains the physical addres of the frame's next destination. 1m Source addres (SA) The SA fields also 6 bytes long and contains the physical address ofthe sending station. ‘= Data, The sath ic, data is lloued 4500 bytes and contains the PDU. A Token Ring frame doesnot incde @ PDU length or type fe. ‘= CRC. The CRC field is 4 byes long and contains a CRC-32 error detection sequence. |= End delimiter (ED). The ED iss second ag eld of 1 byte and indicates the end ofthe sender's data and conta information. om [oel@ ls CHAPTER 3 UNDERLYING TeCHNOLOGIES 1 Frame status (FS). The las byte ofthe frame isthe FS fel. It canbe set by the receiver to indicat ha the frame hasbeen ead, or bythe monitor to indicate tha the frame bas azeady been around the rng. This eld isnot an acknowledgment, butt oes tel the sender thatthe receiving station has coped the frame, which can ow be discarded ‘Token Frame Because a token is really a placeholder and reservation fame, thas only three feds: SD, AC, and ED. The SD indicates that «frame ie coming, The AC indicates thatthe fame is a token and ineludes the priority and reservation Held. The [ED indicates tho end ofthe frame. Abort Frame An abor frame cares uo information a ll—jst starting and ending ‘delimiters. 1 canbe generated ether by the sender to sop is own transmission (for whatever reason, or by the monitor to purge an od ansmission from the lne. Addressing Like Ethernet, most Token Ring implementations use a Gbyt adress ‘The addressing mechanism isthe same as the Etbernet, except that Token Ring sends ‘the mos significant bit ofeach bye fin. Implementation The sng ina Tokea Ring consists of a sree of shielded twisted psi sections linking each station to its immediate neighbors. Configuring the network as aring introduces a petal problem: One dissed or disconnected node could stop {he ow of afi around the entize network. To elve this problem, each station is con. nected to an automatic switch. This switch can bypass an inactive station, While ast tion is disabled, the switch closes the ring withoat it. When the station comes on. a signal sent by tbe NIC moves the switch and brings he sation into the ring. For prac «al prposes, individ antomatcswtces are combined into a ub called & mals tion access unit (MAU); ee Figure 3.10. One MAU can support up to eight satins. [Looked at fom the outside, this sytem Jooks ike a sar with the MAU atthe middle Buti fat rng. MAUs canbe combined to create a large ring. Figure 3.10 Maw Wireless LANs Wireless communication is one of the fastest growing technologies. The demand for ‘mobile devices has led ta need for wireless wide and local area networks, Ia this SECTIOW3.1. LOCALAREA NETWORKS(LAN®) $7 section, we ist discuss the general concep of wireless ransmission techies before we discuss wiles LAN technology Spread Spectrum Wireless devices can wansmit signals using reveal techniques including radi fre quency spread spectrum and radio frequency narow band and infrared waves, We die- cuss here only the spread spectrum technique because ofits applications in the Item. "The spread specuum echique requies «bandwidth thi several mes the org inal bandwidth. There ae two spread spectrum techniques: Frequency hopping and Aire Sequence 35 shown i Figure 3.11 Figure S11 Spread spectra techiques Acpiate Capen canter Sa do sor on 011 a a fee ee eee Prequency Hopping Spread Spectrum (FHSS) Tn this scheme, the sender vans- sms atone caries requency fra short period of ine, dan hops to another eae fe {quency forthe same amount of sme, hops agin Toe the same emount of time, snd 30 ‘on. After hops, the eyele is repeated. Ifthe spectra (bandh) of che ogi ‘als, the spread spectrum (bandwidth) tht i allocated for tanssson 8 NB, where Nis tbe number of hops in each eye. Por example, Figure 3.11 shows FHSS for B-=10 Mbps and N’=5, to our example, ansmission reqires only 0.01 Giz or 10 Miz, butte system neds 0.05 GHz to spread the spectrum, Spreading preveats an intuder from obnining conicental information, Te sender and receiver apeeon the sequence ofthe allocated bans. Inthe figure, the fst it (oe _roup of bis) seat in band 1 Qbutween 2.01 and 2.02 GHa), the second bit (or soup Of bits is sent in band 2 (2.03 to 2.04 GH), and soon, A ineuder Who tone his receiver to frequencies between 2.01 and 2.02 may receive the fst bit but reczives nothing inthis band during the next 4 bit itera, Direct Sequence Spread Spectrum (DSSS) In tis scheme, each bit tobe sea by the sade spaced by a sequence of bts called chip code, To avoid buen, how: ‘eth ime needed to Send ome orginal bts the same asthe ie needed to send one ‘hip coe. Tis mean hat the data rate for sending chip codes is (Vis tbe number of bits in each chip coe) times the dt ate ofthe original bit seam. For example i the Sender generates the original bitstream a 1 Mbps, and the chip code is 6 its lon, the at sate for waning chip codes is 1 6= 6 Mbps (CHAPTERS UNDERLYING TECHNOLOGIES 1s obvious thatthe bandwidth required to send the chip codes i times greater than the bandwideh for sending the origina bit steam. Ifthe ginal bitstream needs B Hz, the chip codes need NB Ho, the same asin FHSS. 18M Frequency Band In 1985, the Federal Communications Commission (FCC) ‘modified the radio spectrum regultons fr unlicensed devices. The modistion autho- ‘izes wireless LANS to oper in Indust, Sciatic, and Medical (ISM) bands, The tue ofthese bands does fot requir license from the POC ifthe equipment operate ‘under 1 W of power. Figure 3.12 shows the ISM bands. Figure 12 15s bands ‘The 902 Mz band and the 5.725 GHz band are availabe only in the United States; the 2.4 GHz band is available globally Architecture (ur dscusson of wireless LANs here isimited tothe IEEE 802.11 standard. The etan- dard defines two kinds of services: the basic service set (BSS) andthe extended service set (ESS). ‘Basie Service Set_The IEEE 802 defies the base service set (BSS) asthe build ing block ofa wigeless LAN. A basic service se is made of stationary or mobile wire less stations and an optional central base station, known as the access pont (AP). Figare 3.13 shows two sts inthis standard. igure 313s: ‘The BSS without an AP is x stnd-lone network and cannot send ata to other [BSS%.Itisan ad hoe erehitectre SECTION3.1 LOCALAREA NETWORKS (LAN) 59 Extended Service Set_An extended service set (BSS) is made of 190 or more BSSs ‘with APS. In this case, the BSS are connected through a distribution stem, wtih is sully a wired LAN, The dsuibtion system connects the APs in the BSSs. The IESE 802.11 doesnot restrict the disribtion system; ican be any IEEE LAN euch as an Etheret or Token Ring. Note tha the ESS uses two types of stations: mobile and a tionary. The mobile stations are nrmal tations inside a BSS, The ttionary stations sa AP sous that ae par ofa wited LAN, Figure 3.14 shows an ESS. Figure 3.14 ‘When BSSs are connected together, we have an infrastructure nenwork In this ‘work, the stations within each of each cer ean communicate without the se of an AP. However, two stations in two diferent BSSs usually communicate va two APS ‘The ideas similar to communication in celular network if we consider each BSS to bea cell and each AP o be abase station, Noe that» mobile station can belong to mate than one BSS athe seme tne, ‘Access Method Wireless LANs ate an acess msthd called carer sense mate ‘tccess with collision avoidance (CSMA/CA). The fist two priniples of CSMAICD tlso apply to CSMAICA; cach station as qual sees othe medium (multiple acces) and each station senses the medium before sending. However, collision detection i ct applicable for several reasons, the dominant one being the hidden terminal probe. “To understand the hide temminal problem, imine we have thes sions (1,2, and 2) Station I sends a frame to station 2a the same time that station 3 send frame {o station 2. I may happen that stations and 3 cannot hear each other (perhaps ‘because of some abstraction like a mountain or a wall) In this ease, collision may ‘eet, with tations Land 3 unable to detect i they think thei pckets have ried safely ‘To prevent this stuation, collision must be avoided. Exch station defines how ln St ceds the medium and tells ober stations to refrain from sending data duriag this petod The procedure is as Fllows: |. The sending station, after sensing that the medium i ie, seads a ypecil smut frame called aquest to send (RTS). In this message, the sender defies the tol time it neds the medi, 6 cuspren? UNDERLYING TECHNOLOGIES 2. The receiver acknowledges the request (broadcast to all stations) by sending a smal packet called ler to send (CTS). 53. The sender sends the data fame. 4. Tho eceiver acknowledges the recip of dst, igure 3.15 shows the proces, igure 318 coMmarca i 4 3 i 4 3.2, POINT-TO-POINT WANs ‘The second type of network we encounter in the Internet is the poe-to-poit wide area rework. A point-to-point WAN connects two remote devices using a line available rom a public nwork sch a a telephone nctwork. These public companies noemally ‘provide the sevice atthe physical ayer, the ser is responsible fo he prowocol athe ‘ata nk ayer, Physical Layer A the pysical layer, the point-to-point connection between two devices can be accom plished using one ofthe services availabe today sach ay traditional modem technology withthe reglar telephone line, DSL line cable modem, a line, SONET, ‘90 (86K) Modem “Many end user of the Internet are connected from home or stall business to an ISP ‘hough a watonl modem. One carent development isthe V90 (86K) modem which SEcTION12 POIWETO-POINT WANs 61 uses the existing telephone line. The subscriber is conecte to the switching sation of the telephone company and wee the connection from te switching sation to he ISP ‘Computer (sores). ‘The connections asymebi;dhe use an download dst at 56 kbps, ‘butpoading is ony at 33.6 Kbps. Digital Subscriber Line (DSL) “The digital subscriber lin (DSL) is «newer technology that uses the existing le ommniation networks suchas th local lop telephone line (8 connection between fuberber resident aod the telepose company) 1 accomplish high-speot delivery of tata, vie, video, and molimedia, ‘DSI is family of technologies. Five of them will be disenssed here: ADSI [RADSL, HDSL, VDSL, and SDSL. [ADSL Telephone companies have insted high-speed digital wide area networs to fandle communication between tei central oces. Te link between the user (0- ‘eau and the network however, iil an anslog line (atleast part of i). The cal Tenge isto make these links digital digital subseriber Tne—without changing = ‘sting lel loops: The lol loop wes tvsted-pair cable wit a poental bandwith of atleast | MHz ‘Asymmetric dightal subserber line (ADSL) is asymmetrical, which means it provides higher bitrates inte downsteam direction (rom the teepoe central eee fo the subsribers site) tha the ypsteam dzection irom the subscriber sitet the tle ‘hone ceil ofc) Tiss what subseibers usually Wan, They want 10 receive Bigh- otume Ses icky from the Internet, but they usually have small les, sch a abort mal message, o sen. "ADSL divides the bandwidth ofa tisted-pair cable (1 MHz) into thre bani as shown n Figure 3.16, The fist bend, normally between 0 spd 25 KHz is wed fore Tar elephone service (kaowa as pin old telephone service or POTS). This service tucs only 4 Ait ofthis band; the rst used asa goard band to separnte the voice ‘Sanne! fom the data chaanels, The second band, usually between 25 and 200A, is ed for upsteam comunicain, The third band, usually 20 Kz to 1 MH, isused for downstream communication, Some implementations oversp the downstream and "upsteam band fo provide more handwith inthe downstream direction. Figure 316 Bans forADSt [RADSL ‘The rate adaptive asymmetrical digital subscriber line (RADSL) is technology based on ADSL I allows itferent data ats depending on the typeof com ‘munication: voice, data multimedia, and so on. Diflering rates may aso be assigned 10 subscribers based on their demand ofthe bandwidth. RADSL is beneficial to the cus tomer because the cost is based on the data rate needed. [HSL The high bit rate digital subscriber ine (HDSL) vas designed by Blione {ow Telcordia) as an alternative othe TI Tne (1544 Mbps) whic has a1 km length ‘stction. HDSL can operate at lengths up 0 3.8 km [SDSL The symmetric (oc singl-ine) digital subscriber lie (SDSE.) is he same as [HSL bat uses one single twisted abe, available o most residential subscriber, 0 achive the same data rt as HDSL. A technique caled eco cancellation is employed 0 eat aful-dupex transmission, \VDSL The very high bit rate dlgtalsubserber tie (VSL an stemasve spp ‘hots similar to ADSL. uses coaxial iter opi, ortvisted-pir cable for shor distances (300 to 1800 meters A bitrate of 50 to $5 Mbp downstream and 1.5 102.5 Mbps ‘upsteam canbe scieved with VDSL. (Cable Modem Another technology used for emote connection is the cable modem. This technology ‘ses the cable TV services availabe in mort areas. The technology uses a S00 Mile coaxial cable to deliver TV channels to residential areas. Because cach TV channel ‘needs only 6 MBz, more than 75 channels cn be simultaneously broadcast through the cable. Some ofthese chanels canbe used o transmit data through the cable TV pro- vider to the Ethernet ‘TLines ‘Tings are standard digital telephone carsoes designed originally to multiplex voice channel (aller beng digitized). Today, however T lines canbe used to cary daa from ‘residence or an organization tothe Tniernet They can also be used to provide apy al ink berween nodes in a switched wide tea network. T lines are commercially ‘nailable into daa res 1 and T-3 see Table 3.1. Table 3A DS end Tine ser ‘Serie [Tine | Rae (ips) | ice Chamels (bse 2 ps3 [rs [mre on TA Line The data rete of a7 line is 154 Mbps, Twenty-four voice channels are sampled, with each sample digitized to 8 bits, An extra biti added o provide syochro ‘ization. This makes the fame 193 bitin length. By sending 8000 frames pe second, we get a data rate of 1.544 Mbps, When We us aI line to connect the Interne, we an use the Whole or pat of the capacity ofthe line to send digital dala. T3Line ATS line has data rate of 44.736 Mbps. is equivalent to 28 1 ines, spcriows2 POWTTO-POINTWANs 6 any subse may not es he entire capacity ofa T Un, To comma Ss Many eloone companies have developed factional T ine serves, which saa a satcrbes to share one tne by mlpexing thei ansmisions SONET she nigh bats of erp cable are sub for rays Nest The high erg vido conferencing) and for carrying large mbar of Wr Lea pce a the sme time. ANSI created a wet of standards Net sae St Optical Neorork (SONET) 1 ante ws of hers bles 8 ‘Gebines a high spend data caer. wa ee defines a set of clctical sigals called synchronous anspor? sia eS), He inverse ital topes sia calle opin cares ‘Age Ge opi signals ar tasted at 800 fees pes secon, a rain dan rats foe STSS and OCs- Now tha he lowest even Hs ere a ata ate of S140 Mips, which sees han that of 2 73 oe (44.736 Mbps. ‘Table 32_SONET ae ‘eatin | wer [oct] sis St poos | ss “sso | 009 166.560 _| [srsiz foci | 622080 Se poeie | 9aa0 Sen poe | 16 Sem joc | 185 Sea oc | 208500 Verse | 00-96 | 4976640 srgisa [OC 192 | 9958280 Data Link Layer ‘Tene a reliable poinso-point conection, «wie needs plac he doe Tak Tess nt snon pool fr pa 8 Fino Peat rota (PF pre ve leone line or cable compares provid a physical ik batt cone ra pdm of dnt tere anced for special rss, The Poitse Font Pratel (PPP) was designed o respond to this nee. UP Layers PP as only pps and ink aes Nospecie pool isa! OT Lager ape PP Tse sete inlemene tse walt ae ery ofthe proms ecognizal by ANS. Atte das ink yet PPP (CHAPTER 3 UNDERLYING TECHNOLOGIES tine the format of a frame and the prcocal ht ar used fr controling the fink and ‘ransporing wer dats The format of 2 FPP rane is shown in igure 3.17 igure 317 PPP fome [emit] frome} Ze mane [= [=] ee ee ‘The descriptions ofthe folds ar as fllows Fag field. The fag felt ideatifies tho boundaries of PPP fume, Nts vais oui. 2 Address field. Because PPP is wed for a point-o-point connection, it uses the broadcast adress used in most LANS, 11111111, t avoid data nk address in the proses 5. Control lel. The contr! felis assigned the vale 11000000 to show tha asin most LANS, the fame has no sequence nomber each fame i independent 4. Protocol field The protocol eld defines the type of data beng eri inthe data fel user dts or cher ifrmation. ata field. This field cases iter user dat or other information, 6. FCS, The fame check sequence Fld is simpy a byte or 4-byte CRC used for ceordetesion Link Control Protocol (LCP) ‘The Link Control Protocol (LCP) is responsible for establishment, msinteoanc, and termination ofthe link. When the dan field ofa rane is carrying data related to tis ‘protcol,itmeans tat PPP is handing the Link it doesnot erry dts. "Network Control Protocol (NCP) ‘The Network Control Protaeol (NCP) has been define to give Bexiilty to PPP. PPP can cary data fom different network protocols, including IP After establishment of ‘he fink, PP can cary TP packets i is dats eld, 33. SWITCHED WANs ‘The backbone networks inthe Internet ae usually & switched WAN. A switched WAN {sa wide area network that covers age area (a state ora country) an provides access at several points (othe user. Inside the network, there is « mesh of point-to-point SECTION33 SWITCHED WANs & rncrwonks that connects switches, The switches, multiple por connectors, alow the can fection of several ints and outputs. ‘Switched WAN technology differs from LAN technology in many ways, Fit inead ofa us or star topology, sites are use to create maltipe paths. LAN echm- ‘ogy is conser aconnestinless technology; there so connewion Between pacts st by ser to a reece Switched WAN technology, an the other hand, sa Comectna- ‘vented technology Before a sender ca sed upoket, connection mist be established tetwoon the sener andthe reeever. fer the conection i estaished itis assigned an “mie, which is used during the tansmsson, The conection i formally eringed ‘nhen the transmission is over The conection iat is used instead ofthe source and ‘Gestion adresses in LAN technology ‘We discuss three common switched WANS in this section. The first, X25, is simon obsolete The second, Frame Relay, will sil be in use for afew more years to ‘Some, Te thd, ATM, is the prevalent echoolog. Oar discussion forthe isto wil tr short; we devote more time tothe hid X25 X25, inoduced i the 1970, was the fst switched WAN to become popular btn in Europe and United Stats. Aough sill used ia Europe, itis disappeaing from the {United States. Iwas mostly used a «pubic network to connect individ comptes ‘LANs. I previes an endtoend servic. ‘Aithouz X25 was (and stil to some extent) used as he WAN to cary IP pack: ‘és from one pat ofthe world to snoter, thre was alway confit between DP and Sis IP ia thir: (network) layer protocol, An TP packets supposed tobe cavo8 by ‘Tne at the second (data ik) Taye X25, which was designed before the Inter is ‘three ayer protocol: irks its own network layer IP packets had to be encapsulated in th 225 network layer packet tobe cited from one side of the network fo anther. "This analogous to a person who has car but sto load itn a tuck go fom: one point to another "Another problem with X.25 is that twas designed at atime when wansmission media were not vey fcible (00 ee of opal fibers). For this eason, X.25 performs flow and eror contol at both te data fink layer and the network layer. This wakes ‘munamisson very slow an ie n0t popular given the evr increasing demand for speed. Fr the above reasons, X.25 will ost key son disappear from the ntemet, ‘Frame Relay ‘Frame Relay, a switched technology that provide low-level (physical and data link layer) service was designed to replice X25. Pome Relay has some advantages over x25) 1. High Data Rate, Although Frame Relay originally was designed to provide @ [est Mbps data ate (equivalent to 4 lie) today most implementatoes can handle up 044.736 Mops (quivalea to «3 ine. 2, Buraly Data, Some services offered by wide area network provides assum that the unr fas fixedate need. For example, 27 line i designed fora user who a CHAPTER 3 UNDERLYING TECHNOLOGIES ‘wants to use the in at a consistent I 544 Mbps. This ype of service isnot suitable for the many users today that need to Send bursty data (aonfinctrate data). For example, a user may want to send data at 6 Mbps for 2 seconds, 0 Mops nothing) for 7 seconds, and 344 Mbps fr 1 second for total of 15:44 Nb during a pevid ‘9f 10scconds. Although the average data rae is sill 144 Mbps, the Tet line ‘cannot full this type of demand ecase itis designe for Gx ato dla not ‘bursty data. Busty daa requzes what i aed bandwidth on demand. The viet needs different bandwidth allocations at different times. Frame Relay accepts bursty dota. A user is granted an average data rate that can be excveded when needed, 5, Less Overhead Due to Improved Transmission Media, The quality of ransmis- sion media has improved tremendously sine the last decade. They are more reli able an less exor prone. Thre is no ed t have & WAN that spends time and ‘sources checking and doubl-checking potential enor. X25 provides exensine nor checking and flow cont. Frame Relay doesnot provide error checking or ‘equi acknowledgment inthe data ink layer. Instead all eror checking i lef the protocols a the network and transport layers that use the services of Frame Relay. Frame Relay Architectare ‘The devices that connect users to the network are DTES. The switches that rote the frames through the network ae DCEs (Se Figure 3.18). Frame Rely sory used 15 a WAN to connect LANs or mainframe computers. In the first eas, a router oft bridge can serve asthe DTE and connects, trough a lesed tne, the LAN tothe Fame Relay switch, which s considered a DCE. In the second cate, the mnnfame isl ean ‘be used as a DTE withthe instalation of appropriate sotware- Figure 318 Prone Relay nerork SECTION SWITCHED WANs 6 ‘Virtual Circuits Frame Relay like other switched LANs uses a virtual cicut and virtual circuit ident erscalled DIC Frame Relay Layers Fram Relay has only physical and data ink layers, No specific protect is defined for ‘the physical layer in Frame Relay. Tntead, tis le othe ipplemente to use whatever isatilable, Frame Relay supports any ofthe protogallFecognized by ANSL ‘ee at ink ee, rane Ree eng spl rol espe fr etvesing dats from one DTE to anatee : 1 leeds ATM \ A 2Guasth Asychronns Taner Moe ATM) ish clay rol designed hy he AN rum and adopted bythe ITU-T Design Goals ‘Among the challenges faced by the designers of ATM, sx standout Fist and foremost isthe noe fora transmission system to optimize the use of high-rate transmission medi, npatcularopical be, Second ithe ned foes sytem that can interface with trising systems, such asthe various packet network, snd to provide wide are inter Connetivity between them without lowering thee effectiveness or requiring their Feplacement. Thin isthe need for a design tha canbe impiemenied inexpensively so thatcost would no be baie to adopton. If ATM iso become the backbone of ite ‘atonal communications a intended, It mast be available at low cost to every user ‘who wants Fourth, de new system must be ale to work with and suppor the exis ing telecommuniestions hierarchies cal loops, local providers, lng stance eaten, tnd so on). Fifth, the new system most be consection-orented to ensore aoearate and predictable delivery. And las ut not lest, one objective isto move as many ofthe Fantins to hardware as posible (for sped) and eliminate as many software functions as posible (agin for speed). (Catt Networks [ATM isi cellnenvork.A cell is small data unit of fixed size that ste basic unit cf dat exchange ina eel network. Inti typeof network, all data ae loaded into ient= fal calls hat ean be transite with complete predictability and nifty. Cells xe ‘ruliplexed with other els ad routed throagh sell network. Because each ell isthe Sane sie and all are small, any problems associated with multiplexing different-sized packets are avoided ‘Rca ecwonk ses the el she Bae wt of dt exshage. Aces detned a wal. feeb sed book of ifrmaton, 6% CHAPTERS UNDEaLUING MaCHNOLOGIES Asynehronous TDM [ATM uses asynchroaous ime-divsion maltiplesingtst i why iis called Asyn- chronous Transfer Mode—to mulipex cells coming from diferent channel, I ukes fixedsze slots the size ofa cll ATM multiplexes il sot with x el fom any inp anne hat asa cell he slots empry if none ofthe channels sell send. Figure 2.19 shows how els from three inputs are multiplexed. Atte fs ck of ‘he lock, channel 2 has o cell (empty input lt, so the miler Bll the slot with ‘call fiom the thd chanel. Whee ll he cells from all he chines are malpexed, the ouput slots are empty, igure 319 Art maipeing mE ATM Architecture ATM isa calswitched network. The usr acess devices, cll the end points, are ‘comecied through a user-to-network interface (UND to the switches inside the net work. The switches ae connected trough network-fo-network interfaces (NNIS). Figure 3.20 shows an example of an ATM network igure 320 Archiecne of an ATM nerork SECTION2 SWITCHED Wane Viral Connection Connection between two end points i accomplished through transmission paths (TP), vistual path (VPs), and viral circuits (VCs). transmise sion path TP) isthe physical connection (wie, abl, satelite, and soon) between an fe point and switch or between two switches, Think of to switches as two cites. A ‘tansnasion path these of all highways tat directly connects the tvo cits “A transmission paths eivided ito several viral paths. virtual path (VP) po vides a connection ora set of connections betweca two switches. Think of a vstaal path es highway tht connect two eis. Each highway isa virtual path the st ofall Highways isthe tansmission path ‘Cell networks ae based on virtual circuits (VCS). Al cells belonging 1a single message fallow the same virtual circuit and remain in their original order until they Teach heir destination, Think o vrualeiruit os the lanes ofa highway (vst path) ‘6 shown in Figure 321 gare 321. val coets “The figure elso shows the relationship between 4 wansmission path (a physical conection), virtual paths (4 combination of viral circuits that are bund together ‘because pars of thet pasar the sme), and virtual creuits tha logically connet 660 points together. Ina virtual circuit network, to route data rom one end point to anther, the virtual connections need to be identified, Fortis purpose, the designers of ATM crated hirarchiel identifier with tvo levels: a virtual path identifier (VPI) aod virtual ‘dreuit identifier (VCD. The VPI dfines te specific VP andthe VCT defines particu lar VC inside the VP. The VPI isthe same for ll vial connections that are banded (logically) into one VP. ‘Ne hata vial ones is died by a pai of munber the VP he VC (Calls ceili 53 bytes in length with 5 bytes allocated to header and $8 bytes cary ing payload (user duta may be les than 48 bytes). Most of the header is ocupied by the \VPLand VCI.Figue 3.23 shows the eel structure, AM Layers ‘The ATM standard defines thee layers. "hey are, from top to bottom, the appcation adaption layer, the ATM layer, and the physical layer a shown in Figure 3.2. ” CHAPTER} UNDERLYING TECHNOLOGIES Figure 322. An ari elt Application Adaptation Layer (AL) The application adaptation layer (AAL) allows existing networks (uch 38 packet networks) to connect to ATM feilities, ‘AAL protocols accep ransmissions from upper layer services (eg, packet dat) and map them into fixed-sized ATM cells. These transmissions ean be of any type (voce, sta, audio, video) and ean be of variable or Hxed ates. At the receives, ths procees is reverset—segments are reassembled into their original formats and passe to the receiving service AALA,AAL is designed for constant-itrate (CBR) data coming fom aplica- tons that generate and consume bit at constant ae In this typeof application, ‘eansmission delays must be minimal and transmission rmust simulate real ne [Examples of constan-itsate applications include realtime voice (slephone calls) and eal-ime video (television) % AAL2. AL? is designed for varable-bit-rate (VBR) data coming fom applica tions tat generate and consume bis at viable rts. ln this typeof application, the bitrate vates from section to section of the transmission, but within esaby lished parameters. Examples of variable-bitrate aplication include compressed voice, data, and video. [8 AALV4. ALIA is designed for connection vented packet protocol (sch as X25) tha use viral circuits, "© AALS. AALS is designed foe comnectionless packet protocols that use datagram 'pproech to routing (such as the IP protacal in TCPIP). ‘Tae poco! we he AALS wpe SECTION 3 SWITCHED WANs 11 [ATM Layer The ATM layer provides routing, trafic management, switching, and multiplexing services. processes outgoing tri by accepting 48-byte segments fron the AAL sublayers and wansfomaing them no 53-byte cells bythe addition of aS-bye ade Physical Layer The physical layer defines the transmission median, bit transmis sion, encoding, and electrical o opcal transformation, I proves convergence with Physical transport protocols, such ae SONET and T3, aswell as the mechanisms fot transforming the Rw of cells ino a fow of bis, ‘We wil aces IP one ATM in Caper 26 ATM LANs [ATM is mainly a wide area network (ATM WAN): however the technology can ke ‘opted to local area networks (ATM LAN) In this section we discus the lechnoogy ss applied to LANS, The high ata rate ofthe technology (155 and 622 Mlps) has atraced the ate: tion of designers who are looking for increased dat ates in LANE, ATM LAN Architecture Today, we have three ways to incorporate ATM technology in & LAN architecture: cre- sting a pure ATM LAN, making legacy ATM LAN, or nstureof both a5 shown in Figure 324, Pure ATM Architecture Ina pute ATM LAN, an ATM switch is sod to connect the stations ia a LAN, in he same way sation are connected to an Ethernet th In ths ‘vay, stations can exchange data atone of two standard eacs of ATM technology (SS sud 652 Mbps). However the sation wses vital path identier (VPI) and a vital ‘connection identifier (VCD instead ofa source and destination address. Tis approach hus amor drawback. The system needs o be built from the grouad up existing LAN cannot be upgrade ino pure ATM LANS. Legacy LAN Architecture A second approach i o use ATM technology asa back- bone to connect rational LANS. In this way, stations on the same LAN can exchange dat tthe rate and format of traditional LANS (Btherct, Token Ring, e)- Bat whea two stations a vo differest LANs need to exchange dai, they can go trough a converting device that changes he fame format, The advange here itt output fom several LANS can be multiplexed together to creates igh dts rate tpt to the ATM sich. We wil see a hee are Several issues that shouldbe resolved ft. Mixed Architecture Probably the best solution isto mix the two previous arcites tures, This means keeping the existing LANS and, atthe same time, allowing new ns tobe directly connected to an ATM switch, This approach allows the gradu signtion of legacy LANs into ATM LANs by adding moce and more drelly cow ‘oct stations othe switch. Again the Stations in one spciic LAN can exchange dea 2 (CHAPTER 3 UNDERLYING TECHNOLOGIES Figure 324 ATM LAN aiecuee lelALe Sain See Sot, Se Sion Se se ATA LAN Leger ATILAN a «Mitac ATM LAN ‘sing the format and data rat ofthat particular LAN. The stations dicey conn to ‘the ATM switch can use an ATM fame to exchange data, However, the problem is how «sation in traditional LAN can communicate with aration dcctly connected othe ‘ATM switch or vce vers LAN Emulation (LANE) Atte surface level, the use of ATM technology in LANs seems very natural, However, ‘he similarity is only atthe surface lovl: many issues need tobe resolved, as mm sized below "= Conneetioniss vs. Conmection-riented. Traditional LANs, such as Eteret, are ‘sonpectioness protocols. On the other hand, ATM isa connection-riented proto cal station that wishes to sen cell to another sation fst etablishes a connec tion and afterall he cells ae seo, terminates the conection. 1 Physical Addresses vs. Virtual Connection Identifers Cloely related tothe fist ‘aie nthe difference in addressing. A connectioaless protocol, sich as Ethernet, SECTION 23 SWITCHED WANs 73 eines the rote ofa packet rough source and destination adreses, However, 3 connection-riested protocol, such as ATM, defies the route ofa cell rong vi tual connection denis (VPIs and VCIs, ‘= Molicasting and Broadcasting Delivery. Traditional LANS, such as Eenet, «can both moliast and broadcast packets staan ean Send packets Yo a group of Stations orto all stations. There i wo easy way’ to multicast or broadcast cht ‘ATM network although point1o-mulipoint connections are availabe (© Interoperability. n a mixed architecture, a station connected to 2 legacy LAN ust beable to communicate wih station directly eannected to an ATM switch, An sppoach calle Local Area Network Emulation (LANE) solves the above menoned problems en allows stations ina mixed architctere to communicate with each other. The appoac uses emulation, Stations can use a connections service tit emus connecton-orieted sevice. Stations se the source and destination adeses fo ii- tal connection and then use VPLand VCI adresing. The spproach allows states to se unicast, malticast, and broadcast adresses. Finally, the approach converts fames using a legacy formato ATM cells before being seat through the switch (ClenServer Model LLANE is desiged asa clieauserver model to handle the four previously discussed problems. The protocol uses one typeof lint and three types of servers, LAN Emulation Client (LEC) _ All uations hve LANE client sftvare insted on top ofthe tree ATM protocols. The upper layer protocols are unaware ofthe existence ofthe ATM techaclog. These protocols sed their requests fo LEC for a LAN service Such as connections delivery sing MAC unicast, micas, or broadcast adresses. ‘The LEC, however, js interprets the request, and passes the result ont the Serves, LAN Emulation Configuration Server (LIECS) The LANE configuration server is ted for initial connection between the clint and LANE, This serve is lways waling to receive the inal contact. Ihsan adres tat is known to every let in the sya, [LAN Emulation Server (LES) LANE server softwares insalled onthe LS sever. ‘When a sation receives frame tobe sent wo apoer station using a physical adress, LLEC sends a special frame to the LES server. The server creates ¢ virtual cuit [between the source and the destination sation. The source sation can now use this Vital circuit (and te coresponding identifies) to Sead the frame or fumes tthe esiaton. Broadcast/Unknown Server (BUS) Malicasting and broadcasting require the use of smother server called the Broadcas/Unknown Server o BUS. If a station meas to ‘senda frame to «group of sation o o every sation, the au Sst goes tothe BUS server this server hss permanent Vieual connections fo every sation. The server ee- sts copies ofthe recived fame and sends a cop to 8 group of stations oft al stax tions, simulating a multicasting or brotdcasting process The server can also delier ‘unicast fame by sending the fame to every station In this ease the destination adress is uaknowa. This is sometimes more eficint than getting the conection ideifer from the LES sere ” CHAPTER 3 UNDERLYING TecHNoLoGtES Figure 3.25 shows cients and serves in «mixed arcitecure ATM LAN, Figure 325 A med echecure ATM LAN sting LANE | 2 | In the figure, thre types of servers ae connscted tothe ATM switch (they can scualy be pat ofthe switch. Also we show two types of clients Stations A aad B, LLANE stations designed to send and recive LANE communication, ate dscety cos, ‘ected tothe ATM switch, Stations C,D,E, ,G, and Hin traitinal legacy LANs ae ‘sonecte tothe witch via converte. These converters a LEC clas and ome ‘unica on behalf oftheir connected sation, 34 CONNECTING DEVICES [this chapter, we discussed LANs and WANS as the underlying echaologles forthe Internet andthe TCP protocol. However, the Inemet today isnot made of a single LAN ora single WAN. The ltereti a combination of LANS ait WANK Thee nec SECTION 14 CONNECTING DEVICES *S tea way to joi hese LANs and WANs togeter We call thes joining wols connecting deviees ‘We discuss five kinds of devices in this section: repestes, hubs, ridges, routes and switches. Repeaters and hubs operate inthe Sst layer of the TCPAP protocol sui. {This is compaebl tothe physical layer ofthe OSI model Brides operate in the fst two layers. Routers operat nthe ist three layers. We have tW0 (ype of switches the fist ype isa sophisticated bridge and the second isa sophisticated router. Figure 3.25 ‘hows the ayers in which each device operates. Figure 326 Comecig devices Repeaters [A tepeatcr sa device tha operates only inte physical yee. Signals that cary ior ‘Raton within & petwork ean travel a ned distance before stenvation codangers che Iinegalty of the data A repeater eceives a signal, and before it becomes too Weak or Couupted, regenerates te orginal bit pasers Ic shen sends the refreshes signa. repeater can extend the physical length of network as shown in Figure 327 igure 327 Repeter "reper onset tegmes Fu LAN oat. 1% (CHAPTER UNDERLYING TECHNOLOGIES A repeater can overcome the length restition on a LOBASES Ethernet. tn this Standard, the length ofthe cable is limited to 500 meters. To extend this lengt, we Avie the cable ito segments and install repeaters between segments, Note tha the whole network is sill considered one LAN, but the orton of the networks separated by repeaters ae called segments. The repeater ats asa two-nterface node, bu operat ‘only in the physical layer. When it receives a packet rom any ofthe itstaces repens rates nd forwards tothe other interface. A repeater frwarls very poke bar no lng capably Hubs ‘Although, i 8 general sense, the woed bub can refer to any connecting device, it does have a specific meaning. hub is actually @ multiport repeater. It is normally used to reateconnecions betwen stations in a physical star topoogy. We ve seen examples of hubs in some Ethemet implementations (1OBASE-T, for example). However, bs can alo be used to create multiple level of hierarchy as shown in Figure 3.28, Figure3.28 Hubs [Not that the whole network ssi ne single LAN, Note also thatthe news is consiered a logical bus topology (i sation sends a packer, itis reocved by every other station. The herucica we of habs removes the length imitation of 1OBASE-T (100 meter) Bridges ‘A bridge operates in both the physical andthe data link layers. As a physical layer sevice, it egeneates the signal it oceves. Asa ata ink layer deve, the bridge tan check the physical ues (Source and destination) contained inthe packet Noe tata bridge, ke repeater, has no physical adress. It ats ony as a filter, not an ogi sender oa inal destination, Filtering (One may ask what isthe diference, in fanctionaliy, between abridge anda repeater? ‘A bridge has tering capability. It can check the destination acess ofa packet and SECTION34 CONNECTINGDEVICES 77 decide ifthe packet shouldbe forwarded or droped. I the packet sto be forwarded, he decison must specify the interface, A bridge has a table that map adresses to intertees. "Rois has able eee Gog dion ‘Let us give an example, In Figure 329, a LAN is divided into evo segments sepa rated by a bridge Ifa packet destined for station T12B134S6161 (or 712B13856142) ‘rive a interface 1, the bridge consults its table to find the departing intersc. ‘Reconting to its table packets for 712813456141 leave through interface, Therefore, ‘thre no need foe forwarding the pickets dropped, Onthe ober hand, ia paket for ‘TIOB13436141 aves at inerface 2, the departing intesfce, agin, i interface 1 nd ihe pockets forwarded nthe first ease, sepment 2 remins fee of afc i he send aot both segments have tfc. fn our example, we show a two-nterface bridge: in teal a bridge ean have several nterfices. Not that all he segments connected 0 a ‘re are tl prof one LAN. Figure329 Bree Bester angers reams eaniuseit2 65138613 Coenen Seon? —__ "ridge convents egients ofa LAN ogee "Note also that bridge does not change the physical adresses contained inthe packet. (CHAPTERS UNDERLYING TECHNOLOGIES ‘Transparent Bridges “Today's bridges are transparent (or learning) bridges: they can be easily installed between two segments of a LAN (plug and play). The bridge’ table i originally ‘ert, but as soon asa bridge receives and forwards a packet erates en ety i ‘table with the source ares andthe ariving interface. From then onthe bide knows ‘hat every packet to hit destination departs frm that laterface. The bre lo ecards information about the destination using the infomation contained in the packet We do something similar when we reply to ml or emi), Routers ‘routers three-layer device; it operates in the physical, data ink, and network a fs. As pysical layer device, it regenerates the signa receives. Asa data ik ayer device, the router checks the physical addresses (source and destination cotaid in the packet. Asa network layer device, a router checks the network layer adenies (adeeses in the IP aye) rowers ete layer (phy ca dain aed wetwoeh) device A router can connect LANs together; router can connect WANS together and a router can connect LANs and WANS togetber In other words, a route isan internet working device it connects independent networks togeter to fom an intemetwork. According to this definition, two networks (LANs or WANS) connected by # rovter ‘become an ntemetwork oa internet ———_________ ‘reps or bridge connect segs of LAN ‘Arar const indcpententLANS of WANS nce tn ner work iter). ‘There are three major differences betwen a router and a repeater o «bridge. 1. Aroues has a physical and logical (IP) adres for each ofits interfaces, 2. A roster ats only on those packets in which the destination adress matches the ‘adress ofthe nterfce at which the packs ives, Tiss tue for unicast, mult castor broadcast addresses. 3. router changes the physical address ofthe packet (bath source and destination) wen i forwards the packet. ‘Let us give an example. In Figure 3.3, we show two LANS separated by route. Tae Jeft LAN has two segments separated by «bridge. Te outer changes the source and destination adresses ofthe pcket. When the packet travels inthe let LAN, it source dress isthe aces ofthe ending station; it destination adress is tbe aden of the router. When the sume packet travels inthe sooond LAN, its source address i the adres ofthe outer and its destination adress ste adres ofthe final destination. Routes route packets among multiple interconnected networks. Thy rte packets {om one network to any of a numberof potential destination networks onan inert, SecTION 34 CONNECTING DEVICES 79 Figure 330 Rowing exonple Rovers ct ke stations on a network But ualike most stations, which are members of only one network, routers hav adders on, and inks to, two Or more networks ‘rte changes pe adnan nape We will Jer more aboot routes and routing in fate chapters after we have dis- cussed IP addressing Switches ‘When we use the term swith, we shouldbe careful because a switch an meant di {cet hogs, We musta the term byading te lavel at which he device operates ‘Wecan have atwoluyer switch ora three-layer switch. Let us rill dicuss each ‘TworLayer Switch ‘A two-layer switch is abridge with many isterfaces and a design tha allows bexor (ase) performance. A bridge with afew inerfaces can connect few segment of & TAN together A brig with naay interface may be able to allocate a unique interface to-each station, with each station cn is opm independent segment. This means 0 cor peting traffic (no collision as we sv in Ethernet) In his book, avoid confuses, We tee te term bide fra two-layer switch. ‘Three Layer Switch [A tree layer switch s router with an improved design to allow better peformance. A thee layer swith can rosie, proces, and dispatch a packet much faster than atradi tional router even though the fanctionality is the same. In this book, to ave cotision, we use the term outer fora three layer sich CHAPTER} UNDERLYING TECHNOLOGIES 3.5 KEY TERMS 1O00BASE-CX 000BASE-LX 0008ASESx_ 10008AS-7 1WOHASE-FX 1OORASE-T4 100BASE-TX 100BASE-X BASE OBASES 1OBASE FL. 10BASE-T sor frame pplication adaptation layer (AL) asymmeuic digital subserbe ine (ADSL) synchronous time division ‘multiplexing Asyncheanoos Transfer Mode (ATM) ATM switch ‘bandwidth on demand bose service et (HSS) bridge ‘rondcasdunknown server (BUS) broadcast address camer sense multiple acess with ‘cillsioa detection (CSMA/CD) cell channel callsion ‘connecting device ‘omectonlss protocol ‘conneton-aiented protocol destination adres (DA) ital sbserber in (DSL) Aizet sequence spread spectrum (DSSS) SS-tasion mobility Ethernet extended service set (ESS) ast ihcret fractional T tne fame frame check sequence (RCS) Frame Relay frequency hopping spread spectum HSS) fol. duplex Ethernet Gigabit Ethernet, high bit ate digital subseiber line DSL) infrared (OR) LAN emulation (LANE) LLAN emulation client (LEC) LAN emulation configuration server (ECS) LAN emlation serves (LES) legacy LAN Link Control Protcol (LCP) local area network (LAN) local oop SECTION5 SUMMARY 1 mixed architecture LAN Synchronous Digital Hierarchy (SDH) rmuleast adress Synchronous Optical Network (SONET) rmultsteion access uni (MAU) Network Control Protocol (NCP) network iaterfoe eaed (NIC) synchvonous anspor module (STM) ‘yehromoos transport signal (STSi networkto-network interfaces NNT) Bes optical canier (OC) ine packet Tine Physical ade woken Poinct-Point Proacol PPP) ee reanbie (oken passing pure ATM LAN ‘Token Ring ni requeney wave teanscever rt adepive ayrometical digital onias adress subscribe line (RADSL) eser-o-network interface (UNI) repeater very high bitte digital subscriber tine router «vst source adress (SA) inal cru deaier (VED) syne specu ‘viral connection identifier (VCD ‘veel path identi (VED) wide area network (WAN) wireless transmission x25 ‘sat frame deiner (SED) site itch Ethernet symmenie dgial subsrber ine (SDSL) 3.6 SUMMARY ‘Ethernet isthe most widaly uso loca are network pro¢oca ‘8 Teadtonal Ethernet uses CSMAVCD with a data ate of 10 Mbps and clision domain of 2500 mer, 1 The data ink layer of Ethernet consists ofthe LLC sublayer and the MAC su layer f= The MAC sublayer is responsible for the operation of the CSMAICD access method. 2 (CHAPTERS UNDERLYING TECHNOLOGIES ach sation onan Pthemet network has a unique 48-bit addres imprinted on its network interface cad (IC). ‘The common implementations of 10-Mbps Ethernet are 1OBASES, 10BASE2, OBASE-T, and 10BASE-FL. ‘Fst Btheret uses CSMAJCD with a data rate of 100 Mbps and collision domain 0f 280 meters The commen Fast Ethemet implementations are 100BASE-TX, 100BASE-FX, snd 100BASE-T Gigabit Ethernet has a data rte of 1000 Mops. Common implementations are 0GOBASE-SX, JOQDBASE-LX, and 1000BASE-T, ‘A point-to-point connection othe Internets posible using regular telephone lines nd wadtonal modems, DSL ies, cable mesdems, ines, or SONET networks ‘The Poinsto-Point Protocol (PPP) was designed for users who need 8 eine pine‘ point connection othe ntret. PP operates athe physical and data ink layers ofthe OSI mode ‘Tae Link Consol Protec (LCP) is sesposibe for extablishing maintaining con- figuring, ond terminating links, X25 sa switchad WAN tats being replaced by ober technologies, Frame Relay eliminates the extensive eror checking nocesary in X25 protocol Frame Relay operates in the physical and daa link layer ofthe OST model ‘Asyehroaons Transfer Mode (ATM) is the cll elay protocol designe Lo support the transmission of dat, voice and video trough high dita rate rnsmission media suchas fiber-optic cable ‘The ATM ata packet is called a cell and is composed of 53 byes (5 bytes of header and 48 bes of pyle, ‘Accll network is based on permanent vrwal ret routing, ‘The ATM stacard defines thee layers the aplication adaptation layer (AAL),the ‘ATM layer, andthe physical layer “There are four diferent AALS, each specifi fora datatype. TCPAP wses AALS, which converts data coming fom a conneconless packet switching network ATM technology canbe adopted fr use in 8 LAN (ATM LAN). na pure ATM LAN, an ATM switch connect stations. In 2 legacy ATM LAN, the backbone that connects traditional LANs uses ATM technology. A mixed asctitecure ATM LAN combine features ofa pure ATM LAN and a legacy ATM TAN Local Ares Network Emulation (LANE) is a ciendserver model that allows the ‘se of ATM technology in LANS. LLANE software includes LAN emulation client (LEC), LAN emulation coafigura- ‘don server (LECS), LAN emulation server (LES), and broadcasvunknown server (BUS) modules ‘Connecting devices can connect segments ofa network togeter they ci alo ‘conaect networks togetier to create a Internet ‘Thee are five types of connecting devices repeaters, bubs, bridges, routes, and sehen, Secriow37 pracriceset 53 12 Repeaters regenerate a signal tthe physical layer A hub isa moltipr cepeater. ‘Bridges have access to station areses and can forward or ile packet ea net ‘work They operate a the physical and data ink ayes, ‘= Rouer determin te path a packet should ake, They operate at the physic, data Tink, and nerk layers. "= A two-layer switch ia sophisticated bridge: a voe-layer switch isa sopisicaed 3.7, PRACTICE SET ‘Multiple-Choice Questions 1 1OBASE2 wes cable while HOBASES uses 2 thick coaxial thin cowl twisted, thick coaxial thin coil, thick couxil 4. Hher-opi, thin cons 2. ___ specifies a star topology festring «central hob and unshielded twisted: ae wire a the medium, 4. TOBASES b 10BAsE ©. 1OBASE-T none ofthe ove 3. Frame Reley operates inthe 1. phystel layer data link ayer © pysical and dat ink ayers 4. physic, daa link, and network layers 4, Which ATM Iyer species how user dats should be packaged into cells? physica b AIM ©. application adeptation <4. ata adaptation 5. Which ATM layer has a 53-byte call as an nd product? 2 physical b ATM © application adaptation 4. cel transformation 84 CHAPTERS. UNDERLYING TECHNOLOGIES 6. Which application adaption layer ype can process a data steam having a non- constant bitte? 2 ALL bh AL © AALS 4. AALS 7. Which AAL type is designed to suppor data steam that has constant bit ate? ALL AL? ©. AALIM @ AALS 8. Which ofthe following is nota connecting device? a bridge taneceiver 4. repeater 9. Repeaters function in the_ layer physical data link © network aang 10. Bridges function i the 2 physical data ik network 4 amdd 1 Abed bas aooees tothe address ofa station onthe sume network, physical network «. service acess point 4 allof the above 12, Routers function inthe layers. physical and data ink > physical, ata tnk, and network ata ink and necvork 4. network and anspor layer, 18 SECTION27 PRACTICESET 38 Ina___ATMLAN all stations ate connected tothe ATM swite, a pure bs leacy mised architecture 4. any ofthe above ‘A______ATM LAN could bave Btheret LANs and Token Ring LAN comecied {oa ATM switch pure be legacy mined architecture a bande Tian ATM LAN, a stiton oa an Btherst LAN needs ‘with Token Ring LAN. a repeaters by Inbs to exchange dita convenes software i installed on the cient machin. eee » LECS. LES 4. BUS ‘The sever is used forthe iil eonaetion between the client and LANE. 2 LEC Lees ©. BUS 48 none ofthe above nan ESS the __staion is mobi. a ar bs server ©, BSS. 4. all ofthe above nan SS the. stations are part of «wired LAN. 3 AP b ener © BSS 1. all of be above 8% CHAPTERS UNDERLYING TECHNOLOGIES 20, 21 2. 2, SONET is standard for networks. a. twisted pair cable coaxial eale «. Biheret 4. fiber-optic cable SSONET is an acronym fr Nework ‘4. Synchronous Opscal, by, Standard Optical Symmetrical Open 4. Standard Open PrPisa «physical dita ink physical and data link seven ‘Whats the purpose of LCP? 4 establishment of Kink maintenance of ain «termination of ink alo the above ayer roca, Exercises 2, 2. 26. 2. 2. 3h What colision? ‘Suppose thor is heavy tealfic on both & CSMAVCD LAN and a Token Ring LAN. ‘A sation on which system is more likely to wait longer to sea a fame? Why? ‘Why do you think that an Ethemet fame shoal havea minimum data sie? Imagine the length of a JOBASES cable is 2500 meters. It speed of propagation ine thick coaral eable is 200,000,000 meteetecond, bo fn does it take for a ‘ito ave! from the beginning 1 the end ofthe network? Ignore any propagation ela inthe equipment ‘Using he dat in Exercise 27, ind the maximum time takes to sense x collision. ‘The worst ease occurs when date are seat from one end of the cable an the oli> sion happoas athe other end. Remember that the sgral needs to make a round- tp. ‘Te dats rte of 1OBASRS is 10 Mbps. How long dest take to crete the smallest frame? Show your eleaaton. Using the data in Exereises 28 and 29, ind the minimum size ofan Ethera frame {or cillision detection to work propery. An Bihernet MAC sablayer receives 42 bytes of data fom the LLC sublet, How ‘many byes of padding must be added to the data? SECTION7 PRACHICESET 81 32. An Bihernet MAC sublayer receives 1510 bytes of data from the LLC layerCan the data be eneaplate in one frame’? I not, how many frames ned 1 be vat? Whats the sige of he daa in each rae?” Programming Exercises 33. Complete the following struct declaration forthe Etherot paket, ‘sevctihemet t lussigned ong iat CRC hs 34. Complete he following struet declaration for the Token Ring packet struct Token Ring c jpeedion it CRE 35, Complete the following struet declaration for an FDDI packet, emict FDI { ‘signa tong int ERE H ‘Atte neswotk (or IP) aye, we aed to uniquely identify each device on he Inerseto low global communication between all devices, Tis is analogous to the teleptone fystem, where cach telephone subserber has a.unigue telephone mmber we consider the coir code and the aea code as ar of the identifying scheme Tn this chapter, we dieu lasefl addressing, one ofthe addressing meshanisms of the caent version (Pv8) ofthe TCPAP protocol suite Tn Chater 5, we nroduce cass- tess adtessing, mother addressing mechanism in te eure protocol. f Chapter 31 tne sigcuss the adresing mechanism ofthe next-generation TCPMP protocol site 6, 4.1 INTRODUCTION “The identi used inthe IP layer ofthe TCPAP protocol site wo identity each device onsectd othe laterne scaled the ntret adres or TP adress. An IP desi 8 ‘Somat binary adress that wniguely and wniverslly defines the connection of a hos! ora router tothe Tnteret, ‘an adr 32-5 as. 1P adetesses are unique. They ae unique inthe sense that each adress defines ‘one, and only one, connestion fo the Inerel, Two devices on the Internet an aever ‘have the ame adress. However, fa devie has two connections tothe Inert, via two networks thas two IP adresses, “Te aoe we nie “The TP adresses are universal in the Sense tat the addressing system mast be scceped by any host ha want tobe conpected othe Interne. 9% CHAPTER4 IP ADDRESSES: CLASSFUL ADDRESSING _ Address Space 'A protocol ike IP that defines addresses has an address space. An addes space is the toual numberof adresses used by the protocol fa protocol uses bits Wo define an es hares eis asec an ae let ales Oa 1) sand bits can have [Pv anes 32 bie adieases, which means thatthe addres space is 2” or 4,294,967 296 (more than fou billion. This means ba, theoredcally, if thee were 0 restrictions, more thin 4 billion devices could be connected tothe laternet. We will See sory that the actual number is moc les “Te adress pce of Pt ie P or 4298 967296, Notation ‘There ae tree common aoation to show an IP adres: inary notation, doted decimal otton, and hexadecimal otto, Binary Notation In binary notation, the IP adres is displayed as 32 bis. To make the adress more readable, one or more spaces is usually inserted between each cce (8 bits). Bach octet is often refered 1 as a byte So tis common wo hear an TP addees refered to as 2 32- Iitadess, a 4-octet adress, oa 4-byte adress. The followin isan example of an IP dessin binary notation: oxrio01 seoro1ar oosidibi “iio Dotted-Decimal Notation ‘To ake the IP address more compact and easier to read, Internet adresses are usally writen in decimal form with a decimal point (dt) separating the bytes. Figure 4.1 ‘hows an IP address i doted- decimal notation. Note that because each byte (ote) is only Sits, cach number in the doted-decimal soution is between 0 and 28S. Figure 4.1 Dose cima nosaion RAZ ‘The by dovinal: and eden asber yes ae viewed in Append B, seeniow 41 IviRoDUCTION 9. AA ABT SRY LI Example 1 ‘ups oning 1 arses om iy ation dtd deci nota. teapot oooibit eonoont 1104111 eos toooor1 amis 4th Sinton stools sootor axor1m SLatttoo, tooon1 #101 anos Sotaon retelne cach group o bis with ts equlen decimal nner (ee Appendix B) an sd os oc eatin 21293111239 1983127258 fe Biz9439.11 4 249.155281.15 Example? Chee fotiorng TP aks rom dot eine mon iy noms. 22 MLS68878 . bass © MLRS6I2 9 878453678 Soltion a cach esis arth Bir eut Go Apgend BY © (THT oro onsti04 oFp0120 {iota ecto. omens orooe10 {1111001 001000 0121900 0001100 {{ovoato 0011301 ooiee0 o10s110 Example3 te eno ny, athe lowing Padres: fe T1RSeg45.78 bay) 8a0 garter 4 11noo1023.1467 Solution ny Thee ee go letig oe in ted ei ncton O48) 1b Wemay nt hae ort fur nambern an Paes dot declan, ech ube ies fan oc qu 9285; 301 one ‘ange 4 rare of tnry station and ted decimation sot allowed. (CHAPTER 4. IP ADDRESSES: CLASSFUL ADDRESSING Hexadecimal Notation ‘We sometimes see an TP address in hexadecial notation. Each hexadecimal digit is esuivalent to four bits. This means that 232i adress has 8 hexadecimal digits. This notation is often ued in network programming. Example ‘Change the following Paarees rom inary notion fo exalt, { tone0907 eooI04 acooLOH} 11011 11000001 1ogooii cooi}onf 11124311 Solution ’ ‘We replace cach group 4 bits with is hexadecimal equivalent (ee Appendix B) Now that xs decimal notation normally hs no added paces or det however, OX (r Ox) sad th beponing othe sbscop (6a he nd tosh tht the sunt in hexadecimal 4.2. CLASSFUL ADDRESSING IP addesses, when started afew decades ago, used the concept of classes. This erchi- tecture is called classful addressing. Inthe mid-1990s, anew architecture, called assess addressing, was introduced that wil eventually supersede the origina archi ‘tecture. However, most of the Interne is stil using else adessing and the mig ‘om slow. fn this chapter, we introdce the concep of clasfal addressing inthe next chapter, we discus clssess addressing. The concept of “clasful”is needed to under stand the concept of classless” Tn clasfladressing, te IP adres space is dvd into five clases A B.C, D, snd E. Each class occupies some part ofthe whole addres pace. Figure 42 shows the lass occupation ofthe adress space (proximation) Figure 42. Occupation of te ates space ‘We can see fom the gure hat las A covers half of the adres space serous design flaw. Class B covers 1/4 ofthe whole adress spice, another desin law. Class ‘Covers 1 of the addres space, and classes D and each cover 1/16 ofthe adress space. Table 4.1 shows te number of adesees in each class. SECTION 42 CLASSFULADDRESSING 93 ‘Tnble AA Adresses perclass Gia | Raber fades | ec A | Baars | S08 B | Paton | ae | | s=ssearoo | ase D_| #=6435656 | 625% BE _| aiameaasass | 625m Incas adessng Beers pce iid i ve cases AB. Dad Recognizing Classes We can find the class of an adress when the addcess is given in binary notation or doted-Socimal notation, Finding the Class in Binary Notation Ifthe adress is given in biary notation, the first few bis can immediately tll usthe class of the address a shown in Figure 43, Figure 3 Finding he lan i bina ottion ciye_ Stony Tye Fah ae thse oma ILI Ld ows GI CCS om? fi od) owes Ed (One can follow th procedure shown in Figure 4.4 to systematically check the is and find the class. The procedure canbe easly pongrammod in any langage 3M CHAPTERS. IP ADDRESSES: CLASSFUL ADDRESSING Example 5 ie we an poe that we have 7483608 adresses in class A? Solution reat A, ely 1 tt defies he las, The sexnning 31 it are avaible Fer the des. With 21 bis wean hve Yo 2.17 483688 ares, Example 6 Ft cas fh lass a. eegoan opr cms01 S001 Clas Sint tern emis! 1111 = Bc 2O10ONIT 11011011 0901011 o1L011A1 class snmteots toontots trns011 oooorstt Solution Sev the rosie in Figure 44 The fist bit i) Tis is class Aas. 1 Thetis ise third iis This las C adres Th ait isthe cod itis This cas B ads. (6 Thefiat biter I hiss acs Eades. Finding the Cass in Dotted-Decimal Notation “When the adres is given in doted-dcimal notation, thea we ned to Took only a the frst (umber) to determine the clas ofthe ade. Each class has a specific range of numbers. Figure 4.5 shows te ides. igure 45 Finding the coe decimel norton ovine Suontiye Tietye_ Rare [ ows Coe) SI ows (te oT] ESS EE CSE cme (oroas] (SES EEL EEA coo [ateae! Eas ESE SEA om: Games] ES “This means tha ifthe fs byte Gin decimal) is berween Od 127, the cassis A IE the fist bytes between 128 and 191, the clas is B. And soon. Example? Fine cas of cach dos agiassT clave paps n4ss22 Aas € MBE cla 5 SECTION 42 CIASSFULADDRESSING — 95 arasisin clas = 2 BAIIESE lee 8 Solution {The fistte s 227(ataen 26 and 28th clas is, 1b, heist i 195 (tween 192 and 228 the lass is. The fistbye is 4 (between O and 127}; cassis. Thott ja i 252 (baween 240 and 255) the ease. ¢. The it byte is 34 (ere 128 and 191) he clas iB Example § Tn Example 4 we showed tat clas A hae 2147,489,548) ares, How an we poe his tao fact sing Sted cial potion? Sotton “To ess in cass A rg from 00.010 121955255255, We sd shh he ier cnc were hae wo su 2,475, Tis god eee bcs shaw wt dt tng fates betwen to aes esos a we se eg wih base 236 mmbers oe, Ech yin nota ar smelt Te weigh lo ee ope olighke da 236? 2567, 2561, 2568 owt tad te ing va ach mi we mil ach by wiht sabes: (£94256 +4 W258 + Dr 28 GBD ISH = 21478667 Fimadde: = 0 {ewe subtest fom he las add tt esl (remember we ays ad to ge the rang we Bt 2147485688 02 Netid and Hostid In clasfladessng, an Paes in classes A,B, and Cis vided int net and hos ti. These pars are of varying engi, depending oa the clas ofthe aes. Figure 4.6 Shows the ntl and hostid byes, Note tha classes D and # are no divided nko nti ‘nd std for reasons that we wil discus ater, Figure 4.6. ei and hod vB Bet yes tea cues Rad RED a aE 9% CHAPTERS IP ADDRESSES: CLASSFUL ADDRESSING Inclass A, 1 bye defines the noid and 3 bytes define the oti In elas B, 2 bytes define he net and 2 bytes define the hos. In class C, 3 byes define the netid and ye defines the host, ‘Classes and Blocks ‘One problem with lassulsdresing stat each clas is divided into fixed nomber ‘of blocks with each block baving fixed size. Lat us look at each lass. ass A Class Ais divided into 128 blocks with each block having a different esd. The fst ‘lok covers address from 0.0.0.0 to 0.255.255.255(netid ©). The second biek cov fers addresses from 1.000 1.255 255.285 (etd 1), The las block covers adresses from 127,000 to 127-255.255 255 (net 127) Not that foreach block of addresses the frst byte (et) is the same, bat theater 3 bytes (hostid)can take any vale inthe sven rings. "The fist and the Ist locks inthis class ae reseed for special purposes as we vill cass shod. In adition, one Block (netid 10) is wsed for private adresse. The ‘emaining 125 blocks can be assigned to organizations. This means that the total mum ber of organizations that can ave lass A addresses Is only 125. However, each Block in this class contain 16.777.216 addresses, which means the organization should be @ really large one seal these adrescs Figure 4.7 shows the blocks in class A. igure 47 Bik inclnar ‘Figure 4.7 alo shows how an organization that is granted a block with nes 73 ses it adareses. The fre adres inthe block used to identify the ganization to SPCTION42 CLASSFULADDRESSING 97 the est ofthe Intemet. This address ie called the network address; it defines the set ‘work ofthe organization, nt individual sts. The organization is not allowed to use The lat des: its reserved for a special purpose as we will ee shor. (Cass A addresses were designed for lage organizations with large numberof ost or couters attached to their network. However, the numbe of adresses i ech ‘lock. 16777216, i probably larger than the needs of amos all organizations. Many adresses ae wasted in his lass, oe lion of clas A arses are wasted. Chas B ‘Cass Bis divided into 16,384 blocks wit each block having a diferent neti, Sipe ‘Hooks are reserved for private adresses, leaving 16.368 blocks for ssigament to orga Ihatios, The fst block covers adresses fom £28.000.0 to 128.0.255.255 (ett 1280), The last block covery addresses from 191.286.0010 191.288.255.255 (tid 191285), Nowe tht foreach block of addeses the fst 2 bytes (eid are the same, tothe cer 2 bytes host) can take any vale in the given range "There ae 16368 blocks that canbe signed. This means that the total numberof “orgatzations tha can have 1 class B adress is 16368, However, since each block in this lass contains 65.936 addresses, the organization should be large enough 1 ws all ltthese adresses, Figure 4.8 shows the blocks in cas . igure 4.8 Blocks cloorB | Figure 48 also shows how an organization that is granted » block with neti 180.8 ‘ues its adatesses The fist adress he network adres; the ast adress reserved fora special purpose as we will se shor (CHAPTER4_1P ADDRESSES: CLASSFUL ADDRESSING (Class B addresses were designed for mid-size organizations tht may have tas of thousands of hosts or routers atached to their networks. However, the aumber of tudreses in each block, 65,536, is larger than the needs of most midi organiza. ‘ions. Many adresses are also wasted inthis lass, Many clas Bernese waned chs c (Class Cis divided into 2.097.152 blocks with each block having a different ned. Two Inunded fifty-six blocks are used for private addresses, leaving 2,006,896 blocks for ‘assignment to organizations. The fst block covers addresses from 192.0.00 to 192.00.255 (noid. 192.0.) The last block covers addresses fom 223.255.2580, to 223.285.255.255 (netid 223.285 255). Note that for enc block of addesses the rst 3 bytes (nei) are the same, but the remaining bye (Host) can take any value athe siven range. ‘Ther are 2,096,902 blocks tat canbe assigned. This means thatthe tos number of organizations that can havea class C adress 2.096902, However, cach block in this class contains 256 addresses, which means the organization should be all {enough once less than 256 areses. Figure 4.9 shows the blocks in class Figure 49° Bic cassC eg pan) 5 Nave Figure 4.9 aso shows how an organization that is granted a block with net 200.118 uses the adreses, The fit adress isthe network adres the let aes is ‘escrved fora special purpose a we wl see shortly, Secriow 42 CLASSFULADDRESSING cass addresses were designed fo small organizations with small numberof ost ce atached to their networks, The umber of wares in each lock i50 Tinted tat mast organizations do not want a bok in this lass “Fo ne of branes das sales te ee of ost ors assD “Toure just one Bock of css D adress, is designed fer mlicating a6 we 9 ret ite gosto, Each adress in this last i used to define one group of Dono» er When a group is asiged anaes in hi clas, evry ost that sa mie aoe troup wine 2 micas adress inant its normal (nies) ares cas “Thee ic just one block of cass adresses, 1! was designed for ase os reseed Tree Spe ls ares in ns class, 25.255 255.259 is wed fora special adress fs we wl se shortly Tas bares ue eve or pec poses at ofthe blk waste Network Addresses enna adress play avery important ole lsu essing. A network aes has sverl propertis: he neswork alesis the ist adress in she block 1 The network address defines the network to the rest ofthe Inter, ate cha? 7 el cam tha outers oute a paket based onthe network adres, 4, Gon the network adress, we can id the class of the aes, the lock nthe range ofthe adresses inthe Bio. STC sireing he nor nr (te ft es te oc eo BS sa un he eg floes cn ona einen om he exw wars. sample 9 ncn ne weir ies 17/000, the cs, sk, athe ang ofthe ess Solution Selution seca he rt be ewe and 127, The Bok bas ne of 7 THe ‘insane frm 17.0009 17285255255 (CHAPTER 4 IP ADDRESSES: CLASSFUIL ADDRESSING Example 10 Given the sework ass 192.21.00, find te clas, he ck, andthe age he asses Solution ‘The cas is B became ist byt i hetween 128 a 191, The block has a ei of 13221. address range from 13221.00 1322125525, Example 1 (Given he etn aes 2204.76. fd the clas, he lok, de ane of he ase. Solution The class is C bec the fist byes berwenn JD and 23, The lock as ned 2038.76 The aes range from 229369 220 3475255 ‘Sufficient Information ‘The reader may have noticed that in clasful adresing, the network adress gives suf {cient information about the network. Given the network address, we ean find the nom- ‘ber of addresses inthe block. The reason stat the number of adresses in eae block is predetermined, Al locks in class have the same range. all blocks i las B have the same range, and all lock in class C have the sare range. Mask Inthe previous section, we said tat if the network acess is given, we can ind the block andthe range of adresses inthe Block, What about the reverse? Ian des is sien, can we find the network address (tbe bepnning address in the Bock}? This is Important because to route packet to the correct network, a outer need to extract a network sds fom the desinaon des (aos adres) inte packet header. ‘One way we can ind he network addres ito fre find the class ofthe adress end ‘he neti. We then se the hos 0 220 to ind the network address. For example the sates 13.45.78. piven, we a immedi sy thal the adress belongs to class B ‘The noid is 134,45 (2 bytes) andthe network ade is 13.45.00, ‘The above method is feasible if we have not subnet the network; that i, if we have not divided the network ito subnerworks. A general procedure that can he ied involves a mask o find the nework address fom a given adress, Concept ‘A mask is «32-bit binary number that gives the ist address in the block the network sures) when bitwise ANDed wih an adress in the Block. Figure 10 shows the con- cxptof masking AND Operation Masking Uses the bitwise AND operation defined in computer science, The opertion 's applied bit by bit tothe adress and the mask, For oor purpose itis enough fo know pe ms cman Figare 4.10 meting concept ‘thar the AND operiton does the following 1 Ifthe bitin the mask is 1, the comesponing bit nthe aes is retained inthe ‘utp to change) 2, Ifthe it inthe masks 0, 0 bitin the outpat the rest In thee word, the bitin the address coresponng to the Is inthe mask are preserved {Gemnin Or Iya they were) and he its corespening tothe Os inthe mask change to. Figure 4.11 shows the two cass, er er | —__} Figure 411 AND operation Tn the AND operon for clas addressing, thee are tee mask, one for ech clas ‘Table shows the mask foreach clase. For lass A, the masks eight sand ewenty our (Ou Forclass the mask is snten Is and ssten Os. Fr cas the maki vent oar Ts and cght Os The Ts preserve themed the Os se the hos oO. Remember thatthe ewer dessin any cas the ed with tbe std all OS. Table 4:2 shows the dint ‘mask fo each cas. ‘Table 42 Defoe masts (tare “Mask in binary "Mask in dotted-decimal [AE p9000000 co000000 00000000 25500.0 | 3 [inn roxio aire “| 8838500 © [rmititimiriin wenn | 3283550 | ma (CHAPTER 4 IP ADDRESSES: CLASSEUIL ADDRESSING 'Note thatthe numberof Is in each class matches the numberof bits in the neta andthe number of Os matches the numer of bts inthe hostid In ter words whens ‘mask is ANDed with an address, the neti retained and te ostid i se to ‘The network ese the begining aes ofeach lok canbe oud by apiing eile mito any ofthe adress inthe Blok Gelding ise, Mies he eae, boca set the a oar. Applying the Masks Avolyng the mask to an uneubneted network is simple. Two rule can help find the ‘setwork adress without applying the AND opertio teach bi, 1 tte mask byte i 255, retin the comesponding byte the adess 2. Ifthe mascbyte is 0, set the corresponding byte inthe network adress 10, ‘Example 12 inc the nies 23.56.79 nd te dean clas A mask ind the bepanng aes (erect: ses. \ ° Solution ‘The etal mak is 25.000, which means that ony the sty preseried and he ober byes ae sett 0. The sewer less 23000. Example 13, (Gine he adres 1326.17.88 an the deuce B find he egianing aes never, sates. Solution ‘The def ms is 255.255.00, which mean tha the fist 2 byes ce preserved and he ther bytes ae sett Os The network adres 152600. Example 14 Git he ae 201.18056.5 andthe cas C deft ma, il he beginning aes nt wok sds). Solution ‘he defo ads 25 255.2550, wich mean tht he ist 3 bytes are preserved an the ln tyres seti0 0. The newer adress 201180360" ‘Note ht we mus not apply he dea mk fon das wos adic bngng aoe | ‘Address Depletion Due fo the classfuladdesing scheme an due w the fst growth ofthe Internet, the {ailable addresses are almost depleted, Despite this, the numberof devs othe Intemet is much es than the 2 ade space. We have un ot of addieors haces ze pl PE SECTION43 OTHERISSUSS 103 ‘many organizations have boon assigned more adresses than they ned (las A ard B blocs), and nobody wants a class Cblock. la Chapter 5, we discuss some remedies to this problem. 4.3 OTHER ISSUES In this section, we discuss some other issues that are related to addressing ingereal sand lassladressing in particular “Multibomed Devices ‘An Internet adress defines the node's connection is nexwork. follows, therfore, that any device connected 0 more than one netwrk must have more than One Inmet ‘adres. In fact, a device has a different adress fr each nctwork connected tA ‘computer that is connected wo diferent networks is called multthomed compater and wll hve more than one adres, each possibly Belonging to a different class. A router Imust be connected to more than one network, otherwise i cannot soul. Therefore, @ Toute definitely has more thun one Padres, one for each neface. In Figure 412 we have one mulhomed computer and ope router. The compute is connected to two ne- ‘works and its two IP addresses reflect this, Likewise, the router is connected to fee networks and therefore has tree IP addresses. igure 412 _Mutihomeddevies way tip We) RE a 6 He! bs tae vb te Location, Not Names ‘An Inemet address defines the network locaton of device, not its identity. In ther ‘words, because an Internet adres is made of to pas (acid and host), ican only {eine the connection ofa device oa specific network. One ofthe ramifications ofthis is tha dhe moversent oft computer fam one network to another means that 8 1P ‘adres must be changed. 104 CHAPTER 4 IP ADDRESSES: CLASSFUL ADDRESSING Special Addresses Some pans of he adress space te wed for special adress Ge Tae 43). Table spect adoeser . | Teed pi Seale [aoe [Now | par let ies | Se [ALE | Devt | Tins aca afes [Al Alls | Desi “This hoxton tls nctwork | AllOs | AllOs Speen tia | AO | Spi ‘Loopback address i [Any - Network Address ‘We have steady covered the topic of network adresses. The ist adress ina block in {asses A,B, and) defines the network adress. Figure 413 shows thee examples of netwodk adress one for each cas Figure 413. Nenortoddes: a = Sate SATE same mane | waite See casa Cae ome Ln itso Liat Direct Broadcast Address Iinclasses A,B, and C, if the hos pall I, the adress is called direct broadeast fiddress. Is sed by aur to Send packet oa hosts in a specie network. All boss wl accept a pact having tis ype of destination adres: Note hat this aes {fn be used only asa destination adéces in an IP packet. Note also that his special fadeess uo redces the mumber of avalablehosids foreach nti classes A, B, and C. nFigure 414, rouer sends a datagrm using destination Padres witha host of alls All devices on this network reeive and process te datagram. SECTION‘: OTHERISSUES 105 Figure 414 Eeanple of et broadcast adits Ce te a usar ‘aiagnus musa BL see | Mscocaleneen aca tot "caves an poe he se ‘Sibsaet wont es 77 Limited Broadeast Address a tases A,B, and C, an adress with al 1s fr the nti and bosti (32 bis) defines « Trsntont addres in the cuent network. A bot that wants 1 send 2 MESSE © YET) vepeeiion can use this adress asa destination address in an IP packet, However, ¢ enna Hose packet having this type of address to confine the broadcasting wo the ane work Note that hs adres belongs to clas E In Figure 4.1, a host seas & ‘Gaagram wing a destination IP aes consisting of ll 1s All device on his networ: receive and process this datagram. Figure 4.15. Example oftinied rodent oes 7 Descanoe aoe | Seussasoass amass ined ini aaron rey ahs (CHAPTER 4 1P ADDRESSES: CLASSEUL ADDRESSING ‘This Host on This Network fan IP address is compose of all zeros, it means this hast on this network, This is used by aost at bootstrap time when it doesnot know its Padres, The hast sss at [P packet toa ootsrap server using tis address asthe source adress and limited brodeast adress atthe destination address to find its own address. Note that this address canbe used only as a Source adress. Note also that his address i always = lass A adress regards ofthe network. Itredues the number of networks in clase A by one (ee Figure 4.16), igure 416 amples of "is" host on “tis” nerork ade Badan Ob0ba eres assis we dein set ed ‘igo shot ere | ——— Speciic Host on This Network An IP adress with neta of all zeros means specific host on this network. Iti used bby a host sead a message to another host on he same network. Because the packets blocked bythe router itis a way of conning the packet tothe local network, Not that itcan be used only fora destination adess. Not als it ie actoally a clase A adess ‘eguless of the network (se Figure 4.17, Figure 4.17 Eranpl of pectic hoxton “is” network ano eat secnion 43. OTHERISSUES XT “Loopback Address “Thei eves with heist bye equal 10127 sd forte laphack des Wi eee oe he software on a machine, When his ade se «POs aes nahin: i spy eas f the protcol softwar, 1 can De ed meet tp cneare For example, an application sch “png” can Senda paces se ns nthe destination aes se ibe TP softwar is ep of 2 oot ocening a pckc. As apoter example, the loopback aes ay i put procs a unsng aplication progam) 1 send &MESABE 5% selon son chin Now it scan be wed only ws adnan oS a cated hat hin acully a ls aes Tred the amb of networks in clas Aby 1 (ee Figure 4.18), ‘igure 418 Example oflopbck adress Heures Soe | =e | = Je Private Addresses Apunber of blocks in ach les re asigned for pat us, They sf mo evens ere eabloks are epced in Table 44, Tes adresis ae se tes {ation or in connection with neta sai techniques. We discuss poate ewok i Chapter 30 4 ‘puble Ades for viva nwo ee, = ede Biods on rao cm ~ B_ | 172.1600 172.31 i | 2 ain eT] oe | 108 CHAPTER 4 IP ADDRESSES: CLASSFUL ADDRESSING Unicast, Multicast, and Broadcast Addresses Communication on the Internet can be achieved using unicast, muicast, or broadcast dares, ep PID Velen adareses ty ISS oie ormnication is onetvone. When pak sent om an nvidulsuce to wee sm indivi desis,» unicast communication ake plc. Al systems one eet 10\4 haveatlest oe unique anca adds. Unica abies lon to cass A, or Malicast Addresses . Multicast communication i oneo-many. Wica 8 pcke is seat fom an individual source to rou of destinations, «moles cormuictio aes plac. A mites. 1 sypeyaspe adress is las D adress. The ene adses defies groxpidA system on the 257?” Intact can have one of mar class D mat aes (in addin fot aneast Nn 4 ess or adresses) I system (sully # how) fas seven mucast addresses, it "Pipe tens that itblongs to seven dirt rots. Note hat clas D aes ante sed LA Tg alyssa desiation des aot ase sour ede oe Malang onthe tert can beat the cal lvl othe loa ve. Ath ee level bss ona LAN can form group ane Signed aml adres. Ath hbal level oss diferent networks can fom x group ad be asigned a mult des Matic delve willbe iscssed in depth in Caper Assigned Multicast Addresses The Inmet authorities have designated yore mu as addresses o specific groups. We mention two here, 18 Category. Some malias addresses ar assigned for some special se. These mult- cast adesses start with 228,00 pei. Table 5 shows Some of these adeses. TabledS Conger attrss ‘Adis Gro aang | Resed 228001 | AUSYSTENS ons SUBNET 224002 | AITROUTERS on is SUBNET Zatoos | DVNRP ROUTERS py 35>) “tos | OSPFIGrALROUTERS | 224006 | GSPRGP Designated ROUTERS | Faoenay [Stowe id “24008 [SF Hons | ainsi Rae | BA eR Ras | tat | MA | SECTION 44 A SAMPLE INTERNET WITH CLASSFULADDRESSES 109 1 Conferencing, Some mulicst addresses are for conferencing and slsconfeeae- sng, Toe multicast addesrs stat withthe 2240.1 prefs. Tale 4.6 shows sn these addresses, ‘Tele Ades for conferencing [Haxoa7 | auprowews | 740 110 | ETE LLOWAUDIO PAOLA | METRLAUDIO Daw | ETE T-VIDEO 2240.18 | ETE LOWAUDIO ane | TETF2-AUDIO [vous [1ETF2-vIDEO 40.116 | MUSIC SERVICE AOL I7 | SEANETTELENETRY 240.118 | SEANEFIMAGE Broadcast Addresses ‘rosdast communcstion is one t-al, The Internet allows broadcasting ony athe loca evel. We have aleady discussed two broadcast adresses used at the local lve ‘he ited broadcast adres (all 1s) andthe det broadcast adavess (aed spec, hoa: al No broadcasting is allowed at the global level. This means that a sytem (hast or route) cannot send a message tall hosts and routes in the Ive. You ean imagine ‘te trafic thet would result without thie restriction 4.4 A SAMPLE INTERNET WITH CLASSFUL ADDRESSES Figure 4.19 shows apart ofan internet with five networks. |. A Token Ring LAN with ntork adress 2203.60 (class). 2, An Ethemet LAN with network address 134,180. (ass B)- 5, An Ethemet LAN with nerwork address 1240.00 (ls A). 4A point-to-point WAN (broken line). This network (21 line, for example) just ‘conects tw routers; there are no hosts. Ta his ea, o save addresses, no ethan, dss is usigne to this type of WAN. 5. A switched WAN (sich as Frame Relay or ATM) that canbe connected to many routers, We have shown thee. One router conaecs the WAN to the Token Ring hetwork. One connects the WAN to one ofthe Btheretneworks, and one rue ‘connects the WAN to the eso the Internet 110 CHAPTERS. P ADDRESSES: CLASSFUL ADDRESSING igure 419. Sompieinrner, a inosat 45 KEY TERMS addres pace tint process AND operation eft ask inary notation ire broadcast address block of adaresce ood decimal notation broadoast dares far adress class A adress hexadecimal notation class B adress boetid class C address imemet class D address Tiveret aires class Baddess aca last desing eadaress clas classless adressing Tiina broadeast adress Secnowss sumuay m1 loopback adress eswor adress roask cet masking speci ston this network multicast ads thishoston this network rmulthomed device unicast address tid 4.6 SUMMARY |= Atte network layer global ienteation sysicm that uniquely identifies every host ane ruteris necessary for delivery of a packet from network to network ‘The Intemet aes (or IP edess is 32 bts (fr TPvS) that uniguly and iver sally defines ahost oe route onthe Internet. 1 The potion of the IP adess hat idnsis the network ical he neti |The portion of the IP sires that denies the host or rater on the network ie called the host 15 ApIP address defies a device's connection toa network ‘There are five clases of IP adresses, Clases A, B, and C ier the minder of| Ist allowed per neswork. Clas D is for multicasting and class is for exper 1B The class of network is easly determined by examination ofthe ist byte = A multhomed device is connected to multiple networks and hasan TP aes for ‘cach network to which tis connected. sm For clases A, B, and C, a cnet broadcast alitess (hostid ell 1s is wed by a route to Send a packs tall hosts on a speci twee 1A limited broadcast addres (alts) i sed by a host wo send a packet wal hosts ‘nite rework 8A source IP adress fal Os is wed by a host at bootstrap i it does ot know its TP adress ‘8A destination IP adress witha ned of al sis used by a host to send paket to another host onthe same ncwork 1m A loopback address withthe fist byte equa 127 is used by a host to west its fntemal sofa ‘5 Unicast communication is one source sending a packet to one destination, ‘= Malicas communication is one source sending «packet to mutpe destinsons. ‘= Hosts withthe same mulicast address can either be onthe same network or on di Tecan networks. 1m Muitica adresses ae often wed for infomation eveval and conferencing puposes, ‘a Brosdcest communication i one souroe sending 8 packet oll hosts on is network, 112 GHAPTER4 1P ADDRESSES: CLASSFUL ADDRESSING 4.7 PRACTICE SET Multiple-Choice Questions 1, ety he ass fhe folowing I des: 4567 (2G dus — ches B «diss @ cise 2. Keni he clas of te owing Pads: 2291.2, ery aod » ase eee ie @awsv 3, nit the clas ofthe fotlowing IP aie: 191.123, a. hse sins 8 © els ¢ sD 4. este otoing Paes: 169.500, 2 fom Parse 2 diet ondeast ass «ited rnas adress Qrervork naires 5. Ment the folowing Padres: 19 5.1 2. hon Pads @ sir atest ass fined roast dress 4 meorkarss 6, leit te fotoning Padres: 1695255255 2. ton Paes @ scr boast dies inte ones ess 4 sotvrk aes 7. Wah oe follwing ste of he ads 241.237 4. Theneidis 241 Theclasis Theo is 123. 4 Temes 1110, SECTION 47 PRACTICE Ser U3 8 Acdevice as wo IP adresses. This device could be @ computer arouer © agaeway 4 any ofthe above 9. A device hs two TP adressen. One adds i 92.123.46.219. The oer adress ‘onl be 17546220 AD w2123460 °F © 192.12347.219 ay of te above 10. Which he folowing sie of te adress 192.60, 102 The sid is 192 The biti i010. G he netork ess is 92.000. 4 The bois 0010, 11, Which fhe folowing ia Sore IP adress? e Ditishos onttisnewedk yas wes lite roads aes «loopback adress 6: specifi hos on thi network 12, Using the direct osdcst ress, 3__sends psi o_o the network . 2 hon lotr hss @ rower: atch oss © hot a speci est 4 boat iste 13. Using he limited broadast address, network & host all ther hosts rower all othe hosts © st a specific host A host, ise 14, The loopback adress use to sed packet from the a host all ther hosts route; al ther sts hosts specific host, host ett ents SN sends a packet 0 on the 1A CHAPTERS. IP ADDRESSES: CLASSFUL ADDRESSING a2 7B. muicast 15, What destination adress canbe use to send a packet from a ost with IP adress 188.1. tal hosts om the network 2. 188.000 b ono0 , 255.255.255.255 4 bande 16, A.host can get its IP aes fom its sever by osing ‘acess and asthe desinton addres. a. 127.127.1727; 0000 'b 285255.255.55, 00.00 ©. 127.000; 255.255.285.255 4. 00100,285.255.255.285 17 Atos ith an TP ads of 142.50. tedster soft. What she muliait broadest 4 acrb 19, A packet set fom a node with IP adress 198.123.4620 t all nodes om ntworke (198.123.4600 ea broadeast | 4 nord 20, A packet et fom anode with IP adress 198.123.4620 coal outers on network. 198.125.4600 requires aad, unicast | > mlicast oy Grete 6, brosdeast arb SECTION4? PRACTICESET 1 Exercises 21, Whats the adress pace in each ofthe following systems? 1 asstem with Sit adresses bs, msytem with 16-bit adresses system with 6-bit addresses 22, An address space has a total of 1,024 addreses. How many bis are needed 0 rp ‘resent an adres? I 23. An addtess space uses thee symbols: 0, 1, and 2 rpresent addresses. I each address is made of 10 symbols, how many addresses are available inthis system? 24, Change the following IP addresses Srom doted- decimal notation to binary notion: a, 1143828 1291468 © 208345412 a 2383421 21 M28 25. Change the following IP addresses from doneddesimal notation to hexadecimal a. 143828 ». 12b1468 20836 54.12 2383421 oe, 2413828 26, Change the following IP dresses rom bexaéecimal notation o binary notation: 8, OX1347FEAB OxAB234102 «© x0)2382BE «4. oxo0001111 27. How many digits are needed to define the neti in hexadecimal notation i each of ‘he following classes? a Clas A, b Clas Clase C 28. Change the following IP adresses from biauy notation to doned- decimal nexion 4 OLILIL1 1110000 of 190111 01111101 ', TOHOL11 11000000 11111000 0001110 . HOILIT 10110000 o0911111 01011101 4. 1101111 11110111 11000111 0011101 fe HUIOUL1 11110011 10090111 11011101 (CHAPTER 4 IP ADDRESSES: CLASSFUIL ADDRESSING 29, Pind he clas of the following IP addresses: a. 208345412 7) b 2583421 © 143428 A 41291868 © 213428 © 30. Find the cas ofthe following IP addresses: 11110111 11110011 10000111 HO1LIOL >. 10101111 11000000 11110000 00011101 H1011141 10110000 00011111 01011101 4 THIOLINE 11110111 11990111 o011101 fe O1NILIT 11110000 ox100111 o111t101 Si, Find the neti end the host ofthe folowing TP adresses: a ggaze clase A wack MY hak TH. te g bigsaas css Bo wet Mat dents emery class A we es Mabey tet Ginsao clus A vette Bee 52 Find the neti and the host ofthe follwing IP adresses 2 1791468 clos b 1g25686 >! © 11138148 a. 2619 133, Find the neti and the host ofthe following IP adresses: 2 128562 class © bp dosigo ©. 208.3454.12 4 20523678 . 34, Which ofthe following addresses does no belong to the same network (no sub- eng)? Explain why ~ 123462 1234789 G92.145612) 123400 35, Which ofthe follring addresses doesnot belong tothe same network (n0 b= tng)? Exlin wy Gosso GDS 1304.78 1304.76.11 36, A host with IP addeess 12823.673 sends a ressage toa host with IP adress 193.4528. Does the message travel through any router? 37. A host wth IP address 12823.673 sends a message to host with IP adress 1448.237. Does the message travel trough any route? 38, A host with IP address 12823.673 sends message to 8 host with IP addeess 12845.237. Does the message rave through any outer? 38. 0. a 4. 4s 4 46 48 2. 3. SecTiON47 PRacTiceser wt [A host with IP adds 128.23.67.3 sends « message 1 a host with IP adiess 128:23.23.7, Does the message tavel through any router? Assume no sobnating (abpeting is discussed in Chapter 5). ‘A host with IP adress 195.23.67.3 sends e message 10 host with IP aoss 195.23417. Does the message tavel though ay router? Assume no suboeting (cuboeing is escussed in Chaper 5). ‘A host with IP address 195.2867. sends a message toa host with TP atess 195,23.67:7. Does the message tavel through any outer? Assume no suboeting (subesing is discussed in Chaper 5). ‘A host with IP adress 9.11.67.3 sends s message to a host with IP adiess 11.342.7, Does the message travel through any outer? Assume no subneting (suboeting is ascassed in Chapter 3), ‘A host with IP address 9.11,67.3 seads a message to a host with IP adtess 9.34227, Does the message travel through ay router? Assume no soba Sub- noting is discussed in Cate 5). Draw o diagram of a network with address 80.0.0 that is comneted through a ‘utes toa network with address (31.45 0.0, Choose IP addresses foreach inter face ofthe router. Show also some hosts on each network wit ther IP addeses. ‘What the elas of cach neswork? Whats the elas of he IP adress 255.255.255.235 used in limited broadessing? What isthe cls of the IP address 0.0.0.0 used at bootstrap ine? What the clas of he IP adress 023.562 sed in clas A network for cending message toa specific host located on “this” newark? “Whats the class ofthe IPadaress 0.0.52. 16 used in las B network for sending message toa specific host located on "his" network? ‘What isthe clas ofthe IP addres 0.0.14 used in a cls C network for sencing @ message a specific Hot located on "this network? ‘A router hasan Padres of 1085.18.22 sends direst broadcast packet all hosts in his network. What are the source and destination IP adresses uso inthis pocket? ‘A couter hasan TP addres of 140,15.820 send direct broadeast packet all hosts in this nctwork, Whit are the source and destination IP addresses sed in this packet? ‘A router has an IP adress of 200.48.20. e sends a dec broadcast packet all Jhsisin this network, What are the source and destination IP adresses used in tis packet? A ost with IP adress 108 67.18.70 sends limited broadcast packet all ests in the same network. What are the source and destination IP addresses used i his packet? ‘A host with IP adress 180.68.17 sends limited broadcast packet to all hots in the same network. What ae the source and destination IPadrescs used in this packer? MIS CHAPTERS 1P ADDRESSES: CLASSFUL ADDRESSING 55, A host with IP adress 2027.27 send limited broadcast packet ol hosts in the same network. What ae the source and destination IP addresses used in this pocket? 56, A host with IP address 124.67 39.34 noods loopback testing. What ate the source and destination addresses? 57. A host with IP adress 185 42.56.88 wants to use loopback testing. What are the ‘soure and destination addresex? 58, A host with IP address 218.34.13.89 wants to use loopback testing. What are the source and destination adresses? 59, A host with IP adress 125.27.19:24 sends @ message toa host with IP aires 123.6789 56 using the "Specific Host on This Network” special adress. What are the source and destination dresses? (60. A host with IP adress 187.12.16.38 sends a message toa host wih IP address 187-1218 99 using the “Specific Host on This Network” special address. What are the source and destination adesses? (61, A host with IP addrese 215.14.149 sends & message to @ host with IP address, 215.14.14.22 using the "Specific Host on This Newark special address. What are ‘he source and destination addresses? (6 Ahost in clas A that doesnot know it TP addess wats to send a message to & ‘bootstrap server to find its adress. What ar the source and destination adresses? 65, A hos in class B that does aot know its IP adress wants to senda message to a boosap server to find its adress. What ae the source and dostnation adressas? 64. A host in elas C that does not know is IP adress wants f0 send a message 10 4 bootstrap server o find ic adess. What are the source and destination adresses? Programming Exercises Wirt «fonction ia C (or any language you are familar with) to ehange an TP dese in dtd decimal notation to inary notation, ‘Weites function in C (or any language you ae familie with) to change an IP dress in binary notation fo doted desma notation, 6s 6, (67. Write function in C (or any language you are fuiiar with) to change an TP dress in binary notation to hexadecimal notation. (66, Write a function in C (or any language you are familiar with) that accepts an res and ets the cas of heads, (®, Write 4 function in C (or any language you are familie with) that accepts an sures and returns he deft mas for that adress 70, Waite a function in C (or any tanguage you are falar with) that accepts an adres and returns the fis adress (network aes) inthe block 71, Wete a function in C (or any language you are familar with tht aoepts an cadres and returns tho lst adres inthe block. RS Subnetting/Supernetting and Classless Addressing Inthe previous chapter we discussed the problems associated wit clasfl adresing. Specially, the network sddresen salable fr assignmeat to organizations are cbse te depletion This is coupled withthe everinreasng demand for addresses from on ‘izations tit want connection othe Intemet. In this chapter we dteus two import issues related to IP addressing: suboeting and supemeting 3.1 SUBNETTING In subnettng, «newerk is divided int several smaller subnetworks with each subaet ‘work (or subnet) having tn subnetwork adress. Ae we learned in Chapter 4, an IP fares 6 32 bits long. A portion ofthe adress indicates the network (etd, ard & portion inieates te hort (bossa) on the nebwork This means that there isa sens of birarchy in IP acdressing. To reach a host on he Internet, we must Fist reach the 3e- ‘wor sing the fit portion ofthe address (neti). Then we must each the ost self ‘wing the second portion (host). In other words IP adresses are designed with Wo level of hierarchy — TP adress re designed with wo evel of hierarchy. However, in many ces, thse two levels of hierarchy are not enough. For ex ‘le, imagine an organization with the network address 141.18.0.0 (a class B Blok). "The orgaizatin hae two-level herrcical addressing, but, a showa in Figure ., i cannot have mioe than one physical nerweek. Note thatthe default mask (255.2559) ‘means that all adresses have 16 common bits. Th remaining bits define the different fareses on the nctwork, Note alo that the network adress isthe fst aes inthe ‘block; the bot partis als isthe network adress. ‘With this scheme, the organization i limited to (wo levels of hierarchy. The boss ‘cannot be organized into groups all ofthe hosts ae athe same level. The orgatizaion sone network with many host 19 129° CHAPTERS. SUBNETTINGSUPERNETTING AND CLASSLESS ADDRESSING igure SA nervork with wo level of hierarchy fot steed) ¢ weuyeot unas wuaaoa vaieassash un eassase see (One solution to his problem is subeating, the father division ofa network nto smaller necwors called subnenvorks (or subnes). For example, Figure $2 shows the networkin Figure 5. divided int four suboetworks, gure $2.4 menor ih se levee of Rerachy eet) Wess seme In this example, the rest ofthe tenes not aware thatthe network is divided imo physical subnervorks: The subnetwork sll appear aba single network wo he rest of the ImteraetA packet destined fo host 141.14 192.2 stil reaches router RI. However, ‘when the datagram arrives at router, de interpretation of te IP adress changes ‘Rowter RI ows that nerwxk 1411s physically divided into sobactworks. I knows thatthe packet must be delivered to subnetwork (subnet) 14.14.1920. ‘Three Levels of Hierarchy ‘Adéing suboetworks creates an intermediate level of hierarchy inthe IP addressing sytem, Now weve three Jevel: ite, subnet, a host. The site isthe fs evel The second level isthe subnet. The hos is the thie leva it dates the connection ofthe host tothe subnetwork. Soe Figure 53. igure £3. Addresses no nemo woh ond wih ubneing [a ‘The routing of en IP datagram now involves thee steps delivery tothe site, Sli cry tothe subuetwork and delivery tothe host. "Tis is analogous othe 0-dgtkepone mum in he United States. As Fie 5.4 shows, teleptone number is divided into three levels: area coe, exchenge nanber, ‘nd eoonecion nore igure S_terry concep ina elephone number Co) a - el ‘Subnet Mask ‘We discussed the network maskin Chapler 4, The network mask is used when @ net works noe subneted, The network mask is used to find the rst aes inthe Dock oe ‘he network addres. Howover, when a mask is subveted the situation i different. We ‘stave subnet sk, The subeer has more I. Figure 55 shows the situations in m CUAPTER 5. SURNETTINGSUPERNETTING AND CLASSLESS ADDRESSING ‘vo previous networks (see Figure 5.1 snd Figure $2). Te network ma erates the retwork adres; the subnet mask creates the subnetwork adress. Figure SS Defarmast and ude mask 2825800 auras va14n9 Contiguous versus Noncontigous Subnet Mask Inthe carly day of subneting, a noncontiguous suboet mask might have been wed. By noncontiguous we mean series of bits that sata string of Is followed by a sting of (0s tatamixnure of sand Is: Today, however, nly comiguous masks (arun of sflloned by azun f(s) ae used, Finding the Subaet Addvess Given an TP address, we can find the subnet address the stme way we found the ne ‘wor adress in the previous chapter We aply the mask othe adress. We can do this 4 intwo ways straight or shortcut \c Straight Method _ Inthe straight method, we use binary notion for both the adress - ‘andthe isan then apply the AND operation to ind the subnet adress. Example 1 What he submersion addres 20045346 and he ube maki 235.2552400" aa Solution ‘We aply the AND operation onthe ads andthe sobs mask. Ades = 001020 09101201 0100010 0111000 Sshnet Mask = tniranit nuit r1n000 00000000 Suinemovk Ades: =e 11001000 60101101 07100000 0000000 "Tae bnew ens is 20045320, SECTIONS. suawernNG 128 ‘Short-Cut Method If the subnet mask is contiguous, we ean use shortcut at we ‘id previously find the network address using the default mask. However, we add ‘ne more mile t those lered in Chapter 4, The three rules we use are 1. the bye inthe maski 285, copy the bye inthe adress 2. Ifthe bye inthe mask iO, replace the bye inte adees wih 0 3. Ifthe bye in the mask is neither 258 nor O, we write the mask and the adden binary and apply the AND operation. Example? “Wat isthe subostwork adres if the destinstion adress is 1930,905 andthe rk ie 255.25519207 Solu Figure 86 shows te slut, The st, stond and Fath bytes ae easy forthe hr bye we sete biewise AND operon on 4 nd 192, Figure 86 Example? fault Mask and Subnet Mask “The number of Is in a defanlt mask ie predetermined (8,16, or 24). In a subnet ask the aumber of Is more than the number of Is in te coresponing deft mavk. oer word, fora subnet mask, we change some ofthe leftmost Os in the deft nas to Istomake a subnet mask Figure 5.7 shows the difeence between a class B dealt ‘ask nd a wubnt math fo he same block. Figure 87 Comparzn of dealt mast ond suber mask aE Compre tt even ne __ assassa0 a) 24 CHAPTERS. SUBNETTINGSUPERNETTING AND CLASSLESS ADDRESSING [Number of Submetworks “The number of subnetworks can be found by counting the exe Is that are added to the deft mask to make the subnet mask. For example, in Figure 5.7 the numberof extra tis 3therefore, the amber of subnets 2° o 8 [Namber of Addresses per Subnet “The number of adresses per subnetwork cen be found by counting the number of sin the saboet mask For example, in Figure 5:7 the number of Osis 13; therefore, the am ‘ero posible adresses i each subnets 2"* = 8192. ‘Special Addresses in Subnetting ‘With subneting, two addresses in each subnet re aed to thelist of special adresses ihe iscuned in Chapter 4 The frst address in each subnet ih host al s) is the Tobactwodk adres. The ast adress in ech subnet (wi std al Ii reserved for Timed broadeast inside the subnet. Some eter addresses were originally reserved as ‘rial edresis, but withthe advent ofcasless addressing, as We will see shorty, {his ideas obsolete Designing Subnets ‘To beter understand suboetng, let us show how a network manager designs subnets fori compa. This requires Several steps Deciding the Number of Subnets “The fis sep indesign so determine the numberof sbmets needed for the organiza fom. The decision depends on several fatrs: the pysical location ofthe ste (number ft tlldings or oor), tbe umber of deparaents, te number of host neded for each Suet and soon, For proper operation of masking its strongly recommended that the tmumber of subnetvorks be a power of 2 (0,2, 4,8, 16,32, et). Note hat choice of 0 ‘means no ssbaeing “Te ember of ats et ea poner a2 Finding the Subnet Mask ‘The sesond sie eto finda contigucus subet mask The following rls ca help us to find he eobnet mask easily 1. Find the number of Is inthe default mask k)2 Fin the numberof I hat defines the suboets 5. Add the number of 1 ia steps ¥ and 2. 4, Find the mumber of Os hy subating the numberof Is te 3 fom 32, SeCTIONS. SUBNETTING 128 inding the Range of Address in Each Subnet After determining the subnet mask, the network administrator can find the rage of dresses foreach sabet. Two methods ean be used 1o find the firs andthe last address In each subaet Ts the frst method, we start with the fst subnet, The fist adres inthe fir sub- nets te ist adres inthe block. We then ad the number of addresses in each inet to gt the lst adress (we can ao use the OR and NOT operation todo this, bat we Jeave it as an exereise). Then we add one to this adress to ind the fst adres in te next subnet. We repeat he process fortis subnet. And 90 0, Inthe second method. We start withthe lst subnet. The last ares inthe ns ub- set the last ads in the block We then apply the mask o obtain the frst dessin this beet. We then subract one from his adress obtain the last adress ofthe sb et before the lst. We repeat the procedure for his subet And soon Example3 ‘A compay pated the site ades 201.7064. (class ©. The company needs sx soe Design he abn ~ es Solution 1, The numberof 1 in he deal mak 24 (ase), 2. The conpany sensi ss Tis mute 6 nls pote of The next amber ht ix rower of 21882) We nnd 3 mie Tein the woe mask. 5. Theta mer of sinh sbnetmakia27 43), 44 Theor amber of 5 6382-29, 5. Themis sunntats snn.nnirsnats1 1100000 assassassan4 6, The numberof boat ie 7 The mmerof addresses in cach abet in (Si the umber of 8) 32 8, Wonow nd he ange of estes sing the st method, We st with te Ast sae 1 The fst ares in tissue 20.70.64 aes inthe oe 1 The last adhesin his subnet found by ang 31 1 thi ares (he mater of ‘domes i cach hot 532, tat we a only 31). Te ln aes 01706831, 9. Wenow nd he ange of reser inthe send ne: 1 Te ist ass in tis ube is 20.70.6432 (one aie the ast ness in he ist sated, 1 The lst aes in this swe is found by aliing 31 tothe fst ade. 1 OLA 10. The ange of dessin he remaining sab cn be Fund ino ir srr ge 58 hors th procedure, wich eat ely be ropa 18 (CHAPTER 5. SUBNETTING/SUPERNETTING AND CLASSLESS ADDRESSING igure S8 Examples ‘Sine Example 4 ‘Acompny is pramed the ke ates 181 56.0.0 (cass) The company neds 1000 robot Design te staat Solution 1. Te mumber of In te deta masks 16 ass. 2, The company need 009 subst, Ths abr ot power of 2. The next amber ats power ofc 1024 2), Weed 1 mire Is athe abet mas 3, Toto mumer of sia the abet ash 26 (16 10), 4. Theta mumter of Osis 62-26), mnannrn. nana anata 109000 55256258102, 6, Mhenamrf sbautsie 124. ‘The umber of aes in ach subnets (6s the abe of) [We now a the range of abcess sing the second meted (eating fom the 202K | The ns acest nhs unt is 181, 56255255 (ast adenine Hoc), >. Teint ade in this abet is found by applying te sabact mask othe as des, ‘berfre, 1196255190 the rt ads. SECTIONS! suaNermNG 127 9, Wenow fhe ange of sess in he 10250 aah 4 The las aes ins sume 1856.25.91 (one before he ites i the st sated, ‘The fata nhs bet soon by spying the abet mask tte stale therefore, 11 56.255.128 ste fet aes. 10, We now ithe range fasts inthe 10228 abot: 4 The sade i hs sb 1856.25.17 (on fn te ist aes ithe st sales, "The drs in hs neti found by spying the sabet mask oe asa therefore, 81 562556 fst aoe 11, We conto at all of he subs re dtd. Howes, this problem ca el be ro- grammed sing any ofthe modem computer Inguager Figute39 si the st age, Figure $9 amples ier a i $6255.64 a an seassiar ; | | ane a ! t ——— 1 | fostseaseios APRS sr scaeeaot |! | istseassign «S000 rates || Variable-Length Subnet Mask “The lotena allows a sto to use varialeJength subneting. Fran example of woen this may be desirable, consider site hat granted a class C acess und nocd to ve five subnets with the following number of hosts: 0, 60, 60, 30,30, "The site cannot use & 128 CHAPTERS SUBNETTINGSUPERNETTING AND CLASSLESS ADDRESSING subnet mask with oly 2 bite in the sone section becase tis allows ony Fur subnet tworks each with addresses in each sobuet. Nor can the ste use a subnet mask with 3 atin the subnet section because this llows ight subnecworks each wih 32 adress. ‘One solution to tis site's problem is variable-length subneting. In this conga tion the toner uses two diffrent mask, one applied afer the ther. ts uses the ‘mask with 26 Ys (IUIMTIA1 HIMLATL IILLETTT 11000000 oF 255.255.255.192) to vide the network into four subnets. Thon it applies the mask with 27 ts LULU THTTII1T LHLITTIL 11100000 oF 255.255.255.224) to one ofthe subnets to divide it nto two smaller suboets (se Figure 510). Figure 5.10 Vorishelourthubneing 5.2. SUPERNETTING YX ato cases A ao B alles almost deplete, cls Cao ‘Main However sz oft das lock ih amasimam nb of 236 ‘ac may sun co of tm cpelaion ver ld non tm ml nents Selstcn i aperating I spoetig a epaistoncn canbe een can Coss ets lenge of rs, nob wed sve str ‘conte eae spew By dingo rnin fr {Stet Uke one Pesan patna ed 100) ‘Sars canbe ged forlae C lok Tie orpneon cn ene ee ‘Sten oe aptver shove nig Assigning Addresses ‘When we assign a set of cass C blocks to an organization, we have two choices. We ‘ean ehoote the blocks randomly or based 0a a set of rules. If we choose the blocks SECTIONS2 SUPERNETTING 129 Figure S11. A.nperenort we Finish, Secon c_, randomly, the routers ouside of the organization treat ach block separately: hey think esch block belong oa differen sit. In thi wy, each outer will have Nenzies init routing table where WV is the nomber of blocks. This strategy may increase Ube ‘ze ofthe routing table wemendousy- Imagine un organization is given 100 class © blocks Eich router must have 100 entries inthe roving table although all of tese areses belong to one ongatizaton, a0 10. “The other choice to make a serblock out of he blocks so that each router has ‘only one etry inthe rowting tale. To do so, we need to Follow a set of ules when we assign the blocks: 1, The numberof blocks most be a power of 2 (1, 2,48, 165...) ‘The blocks ust be contiguous in the aes spice (ao gaps between the blocks) ‘The thin byte of the ist address in the superblock must be evenly dvsbe bythe umber of bloks. In ther words I the numberof locks is the hid byte mst be diibe by N. Sample § 1 company ead, Which of he ewig st of a Cas an Be we 0 © forma spear compas? Xa 1AT3EO 19LATS3O. 19847340 Xb WSATS2M 1984720 19847320 rwssTwO Xe WATILO 19847320 19847330 1984720 C7 WRATBD 196.4733.0 19847 4019847350 Solution ‘a Not acceptable there ae only te lacks. We ned t least our locks to male te amber otacks power 02 Not scope: te blocks re ne compos 180 CHAPTER 5 SUBNETTINGSUPERVETTING AND CLASSLESS ADDRESSING Notecopabe; 31 nthe st ki no evenly visible by 4 Accepabe al eee requirments re fulfilled. The company is given more aldeses ‘tant acds, bu we do ote ny ober coc. Supernet Mask ‘When an organization is graned one block of addresses (class A, B, or C), the fist. adress inthe block andthe mask define the block (he range of aesses), We always ‘now this ange of adresses since the maski always known (default mas), ‘When an organization divides its block into suet, the rst adres i the sub Dock andthe subnet mask completly define the sobbiock (the range of adesses), In ‘his case, however, the fst address aloe isnot enough we mast have the subnet mask. Similarly, when an organization combines several blocks into superblock, we eed to know the fis adres inthe block and the supeemet mask. Here also, the Fes. address alone cannot define the range; we need supernet mask to fod bow many ‘locks are combined to make a superbiock, ‘a supemeting. we need the frst address of the supernet and the superset mask to define the | [A superet mask is the reverse ofa subnet mask A subnet mas for clas C has ‘more Is than the defeult mask for this las. supernet mask fr elas C as ess Is ‘han dhe def ask for theca Figure 5.12 shows te diterence between a subnet mask and a supernt mask. A sulaet mas that divides block imo eight subblocks has thee more 1s (2 = 8) than the default mask; a supernet mask that combines eight locks into ove superblock has ‘thoes Is than the dees mat, Figure S12 Comparison of ude defo. and syperet mass ‘Sotoes Mask Divide awor no 8 shoes 1 smc ff pas| Spence § [21] SECTION $2 SUPERNETING BL Zexamptes ne ea 8s aqeen gece Meese Solution ‘We aad 16 blocks. For 16 bloks we ned change for Is 0 Os inte deat mask, Sothe mis 5 1U1n1111 1111111 11110000 00000000 eels a 2552552400 wmnele Using the permet Mask to Find the ist Address “The supeoet mask can be wed by «outer to find the Hirst adress i the superblock deny the ste (he organization) A subnet mask performs the same function. Waen lan adc is ive, a subnet mas Sins the Rist adress inthe subnet; when an adress iS given supenet mask nds the ist edess inthe supere. TF ssanpie? pas nek Ls EE eee A Omsiesrat a 205164056 at fe, 28.1133.16 Aestnabond) che ANP dz ‘Wc pct log he pen Sd jbcless wack J Solution . Sapernek ‘Ne pply th speret mask tose if we can fd the begining ass 205 163744 AND 2552552480 me 2051632. (Est ates) 205168256 AND 2552552480 —e 20816400 (ante ist adéres) © nasi 33.76 AND 2552552480 =e 20517320 (note ist ares) “Tis means the ely aes tlonging othe orazation ee fist ene We prove ti he et scton wh ne ta aoat he Second sage of the soperet mas Using dhe Supernet Mask to Find the Range of Addresses ‘We sid hatte fst adress in the superblock coupled with tbe superet mask deternine {he superblock ange of aren), Comparing the superet mask andthe default mask {dees tu the number of blocks. We know ta th dtu mask has 24 Is, Subuacting the ‘umber of Is inthe spent mask fom 24 ves us the number f blokes. J eames ‘Asoperet ss ess of 26.16.32 and a sperst mask of 552552480, How many ‘nts in hs soperet nd what he range of adress? Solution ‘Te supeac bas 21 Is The deat sk bas 24 I. Since he fence i 3, here ate ot {Totock nis sopernet. The block are 205,16.320 to 205.163.0. The fin as is os tesa Th madres 205 163925. The tot amber of bese is 8% 250.0248, 182 CHAPTERS. SUBNETTINGSUPERNETTING AND CLASSLESS ADDRESSING 5.3 CLASSLESS ADDRESSING “The idea of class addessing has costed many problems. Ul the mid 1990s, range of adresses meant a block of sdreses in class A,B, of C. The minimum number of addresses grated to an organization was 256 (lass C); te maxima was 1677,216 (class A) In beroen these mits an oreaization could have a class B tock o eter clas C blocks. However, the choies wee Limited. In addition, what about a small bus res that needed only 16 adresses? Oa household that needed nly two adresses? Dorng the 1950s, Internet Service Providers (ISPs) came into prominence. An ISP {is an organization that provides Intermet acess for individuals, small business, snd snisize organizations cat donot want to creat an Internet site and become invlved in ‘roving Terme sorvies (such sem services) for ther employees. An ISP ean pro- vide these services. An ISP canbe granted several clas B or clas C blocks and then tiie the range of reses (ingroup of 2, 4,8 oF 16 alesis), giving # range to ‘ Botseold ora small busines, The eunomers are connected via a dis-op mem, [DSL, erable modem tothe ISP. However, cach customer needs an IP addres (we will see he oltions such as pivate adresses, network address tanslation in Chapter 30) ‘To facie ts evoluion, in 196, the Inemet autores announced anew achites- ture called eases addresing hat woul eventually render easfl addressing obsolete Variable-Length Blocks The whole idea of classless addressing is to have variable-length blocks tht belong to no clas. We can have a blok of 2 addresses, 4 addresses, 128 addresses, and s on ‘There are some restrictions that we will discuss shorty, but in general a block ean ange fom very small very lage Ta this architec, the whole adress space (2 addresses) of ifernt sizes. An organization willbe granted a block st Figure 5.13 shows the atchitectute of clasless addressing. Compare this figure with Figure 4.2 in Chapter 4, Figure $13. rile fngth Macks So [Number of Addresses ina Block ‘Thetis only one condition on the number of addresses ina block; it must be a power of 22, 4,8,...)-A household maybe given Bock of 2 adresses. small bosness may be given 16 adresses. A Targe organization may be given 1024 addresses, Beginning Address ‘Tre beginning adress mast be evenly divisible bythe mmber of addresses. For exam ple, if block contains 4 addresses, the beginning adress must be divisible by 4 I the SECTIONS3. CLASSLESSADDRESSING 10 ‘block bas less than 256 adresses, we ned to check only the rightmost byte. I its Tees nan 65,536 adareses, we need to check only te two rightmost bytes, and soon J txample Ara lorie ining nc fe ok at cms se? ee state ionicaae oe © rranan e bey SE 4173452432 pe ONT wie Spel Seaton Shino relight anc) Te aes 205.1637 32 eile esse 32 iii by 16, The nen 17173380 cgi because 80 idle by 16. Example 10 “ic fe allowing ean be he egiring ates of Nock ht ocho 104 aes 105163732 ° bk sn16820 @ 1120 128452452 Solution ‘uly on is cite) Tobe vise ty 1024 he sighos bye of an ares shold Cand eee Sehanst byte est be dvale by 4 grove ths to yours). Only the aos 1717320 ss conio. Mask I you remember, when aa organization as given a blok im classi adresing dhe ‘Srpunzaton was given te binning address of the block and amas (default as), Teaubneting, when an organization was assigaed a subblock, it was given the fst lites and the subnet mask, In superneting, when an organization was gven several ‘hss C dresses, it was given the fist adress and syperet ask. “Te samme concep is cared over to classless adessng. When an organization i ven Bock, itis gente int adres and the mask These two pieces of infra tion can define the whole block. Slash Notation ‘Writing the (byte mask is sometimes cumbersome. We know the mask is made of ne Ie at the tolled by some Os athe ght So instead of 255.288.295.228, we ‘aboot ay thar the masK has 27 Is. We ea tach this mmber tothe end of clases ‘Gluten. Ths ts ealled slash notation, or CIDR classes ntedomain routing) nota ‘erdownain using In Chapa, we discs routing adhe CIDR concept A generic vg Ren coe eas the aes and ing) ne sing tess in slash otaion is shown in Figure 5.14. Nove hata mask and lagh followed by number bot define the same hig: he numb of common bits every adress inthe block 134 CHAPTERS SUBNETTINGSUPERNETTING AND CLASSLESS ADDRESSING Figure $14 Stsh notion AB.CDin ‘Sh otto lo clled CIDR mean ‘Them after he sath defines the numberof bits that ar the same in every ads inthe block So ifm s 20, i means the 20 efunos its are identical in each addres ‘with 12 bis not te same, We ca easily find the numberof addresses nthe block and {he las addess from his information. rec andPetc Lents ‘Two terms that ar offen use incaslessadresing are petx and prefix length. The prefix is another mame forthe common pat of the adres range (sila tothe nei), The pres lngth ithe leapt ofthe pet (nthe ssh notation) Sufix and Seis Length ‘Two othe terms occasionally wed io clases addressing ae sufix and sux length “The sutix isthe vying part (similar tothe Bot), The sfx length Is the length of the sufix 22m) in slash notion. Example 11 {A small organization is given block withthe begining address and th prefs length 205.16372429 Gn sash ation What ithe rang of he Mosk? Sotation The brining adres i 205.1637.2, To in he ast aes we Keep the Sit 29 its and change teat 3s I Begining Addu 11001111 0901000 40140101 01011000 ding Ades S300L44K 00010000 GOIOEI01 0001111, ‘Thera oly 8 adress in hit block Example 2 7 ec inte range of ates in Example 1 by another method. We can argu tht he length fhe stirs 32~ 293 So hare are 2 = 8 aesnsn his lok. Ite aes {5905163724 that desis 2051637 91 2447-30, Prefix Length and the Mask ‘There is one-to-one relationship between a mask and 2 prefix length as shown ia “Tale 5.1. Note that the entries in color are actully the default masks for classes A, and. SECTIONS2 CLASSLESSADDRESSING 136 Table 1 Prete Ta —['m | Wat [a =e mao00 [> [eo [7 cas | asa | iwaano [no |ass1mao | is | asassmz0 | a6 [assassin 2aaann | it [2852100 | n[assasson0 [rr [sass im [aiano0-| m2 | aisamo0 [mo [assassai0 | ne | aaaesaeaa0 [i [pao00 [ns [assamao [ai aeas2e0 [a [asasasai ie | aa000 | na | asan.00 [mr [assassane | mo | asassassan 7 [as1000"| ns [asase00"| ma [assassamo [mi | asassasian 7m [sis0n0"| ne [askassn0 | oa | assassass0 [na | asea896 as = 220" [Rentnan am maccmey we qpemnnn shana wABEDE oe poe | hee aaah alas era cae Finding the Network Address ‘Can we find the network des (the first adress in the block) if one of the addsses in the block and the prefix length is given? The answers deity yes. A prefix length is amask, When we have dhe mish, we ean AND the mask and the aes 0 fn the first addres. However, because the addresses in classless adessing are guaranteed 10 be contiguous andthe prefix determines the nuriber of fixed bits, we ca find the net ‘work adress. Just ep the fst bite and change the rest ofthe bits Os Example 33 ‘What ithe non des fone fhe adres is 67. 19.17082277 Solution “Tees lng is 27, which means tht we must yp te fs isa sand change ne enn ie (5) 00 Te 5 i aT ony the at by. Thea yt 1010010. Changing teas his, we gx 0100000 oF 6 The ek esis 167.198.1764 ros ABIX subnetting Fie ca of coe esecng with cst esi, Woon a egnaon Td sek sfouuen fem sea sua mete mre Te ork Smiter dst now nase ca ena. Te a es nett gh (o oncon tstc te nae Big orca ste pets gh ne gene onto ee eaten egteao30 toe apo CO) Example 14 Kp pe Am organization i rant the Wack 1304.12 646) The organization nods have fut ‘nt, What arte soeet bese and he range oases frac tbe? 136 CHAPTERS SUBNETTINGSUPERNETTING AND CLASSLESS ADDRESSING Solution ‘Te sf lengths 6. This meas the total amber of addresses nthe Hock x 62, we ce ‘se oar abet each sabe wl have 16 aos, 1, Lets fist the subnet poi (bet mas), We ned fou subnets, which means we ‘seed oa wo ma Isto he ite pis The soe reli hen /28. 2 The range fo the ist soboet i 1304. 12.6428 1013034127978, 3 Therang of ke econ subaetis 10:34 12.8008 o13034.129828. 4. Th rmgeof hed sure e 190:34.128608 1303412111728, ‘5. Thernge of the fur abet 130.3412 11228 o 130341212728 ‘Noe wench the rei forever en we refer to. Frthe main se he re is 26, or the roe the pret 28. Figure 5.15 shows an example of site wits Heck With abe ting (we ave Stowe ont the suet dese fo spo) Figure S15 Kianple 14 sample 15 An ISPs prank of arses sting with 190.100.0016. The SP net site these adheses to dhace soap of comers all 4 Their gop has 6 custmers each aed 256 desc, 1b The second group has 128 cuomers cath meds 128 wes The thin soup has 128 cutomers each cee adden, Design he sbbloks and give te slash notation frei abblock. Fin out ow any dresses are stil wal afr lesen Solution 1. Gop Faris goep. cach customer neds 256 aes, Thi ca the sfx nth is (2250) ‘The pei lengths then 32 8=24 Theale IstCstomer 1901000024 me 19010002882 20d Customer 190.100.1024 =e 190,100:.25508 6tibCosamer 19010063024 <> r90.10n6325504 Toul = 64256-16384 SECTIONS CLASSLESSADDRESSING 17 2 Groap2 Fortis group cach se nds 18 ass. Tis means thes enghis 725 125. ‘Teepe length then 32-7 =25. The stress Int Custer 190.1006075 e190 100464.12725 ‘ni Customer 90100.64.1875 eGo IONEL2SS5 128th Cosiomer 1901001271285 —e 1904004272885 3. Group rth pop. ach cstmer nds adress This means the sufi eng i c= 6, ‘Thepoilengih then 32~6=25, The alesis a: {st Customer 190.100.128.026 — 190.100. vesesaud 2nd Cuore 190,100 1286425 we 190,100128.12726 by 128 cotomer 901015919225 => 1901001592580 ba af so Teale 128 648192 sia ‘ amber of gn ewer 65586 yt ont) cK go> Neabrfaositattenesgsw Ha MEK \ nomeeroramintensinens 35516 “un es eT “There eno ned for supernttng in caslss addressing, (The whole ides of classess dressing was to apply the concept of supemeting in class Co ater clases In ‘laslessaresing, an organization is granted te rght size block which means Ure {so asd for supereting. If an organization is ante a Bock and ater ins it needs ‘lager bloc, a new block can be granted ad the original block canbe recycle Migeation (One may ask when the iden of classless adrssing will be wotally implemented The hope is that every organization will se casless addressing. Those organizations that hve steady been grated block n clas A,B, o& C can use slash notation (8, 16,4) corrocyee their block and request a bock ofthe sproprste size. Classiess Interdomain Routing (CIDR) (Castes adresing has solved several etal problems associated wth clas aiess- ing, brthas create a new one, Routers ned fo oot according his new aeitecue ‘We vl ce te dificutes nd the solution when we discus outing in Chapter 6, os (CHAPTER 5 SUBNETTINGSUPERNETTING AND CLASSLESS ADDRESSING 54 KEY TERMS classes addressing prefix classless inferdomain routing (CIDR) slash notation contiguous mask sb mask. fale mask seting bostd seo ask sti masking supemet mask etd superneing ‘ponconiguous mask ‘arable length sabnesting 5.5 SUMMARY Subeting divides one large network int several smaller ones Subneting adds anintermodiae lve of hierarchy in WP adresing, Classes A, Band C adresses ca be suboesed ‘The subnetid dines the physical suboetwor. Masking is process that extracts the network aes from an IP adres Subset masking is a proces that exacts the subnetwork address from an B aceres, ‘A nctwork or subaet adress is obtined from applying the bitwise AND oper tion onthe IP address andthe mask. ‘The concep of special addresses in TP addressing cies over to submeting. ‘A contiguous mask (a sting of 1s followel by a srng of 0s) i highly recom: mended 1 variable length subnetting, more than one subnet mask s appli by the router ‘Supersting combines several networks ino one large on. slasless addressing, thee are variable-length blocks tha belong too class. The ene address space is dvided into blocks based on organizatcn neds “The fst adress and the maskin classless addressing can define the whole block. ‘Ask cam be expressed in slash aoaton which sa lah followed by the mumber of tein the mask Scrion s6 PRACTicEser 19 3.6 PRACTICE SET ‘Multiple-Choice Questions 1. What the reul of ANDing 255 and 152 1255 Os 0 4 undefined 2. Whatie the result of ANDing O and 15? 2.255 bis oo undefined 5, What isthe rest of ANDing 254 and 157 ou 1s <0 Os “Whats the est of ANDing 192 and 657 2192 hos <0 Ga a cosiuoussabnet mask in class A can have ___ 1s wit the remaining tio : arlene v4 CO eee e ets ©. 33 ’ o>. le oul emee A coniqnos subnet maskin class B ean hive ——— iso 29 he ett a3 SK eontigoous sect mask in lass C can have — 1s with the ening tise “10 nas eR a7 10 CHAPTERS SUBNETTINGSSUPERNETTING AND CLASSLESS ADDRESSING 5 Ambostm incl tas 1415 How myst det ee? be ou ti 9. ttmet ein cla Bhs 19, How muy sb ost ef? ca is 10, Aint kin ass Cha 25s How man sts es it defn? @2 es-eyae ne ois ao 11 Wie one ig comin mask? Tossassassa B ssasszn40 12 Wh one eamot bea beet musk ora iss A lek? _ ss259289102 : >, 255,248.00 / — @us000 SP oss2se 1280 15 Wh oe amore a bat mak ora chs B ook? ; a, 255.285.255.192 @ 5524800 33923825819 14. Whee can be a subet mas or acs ok? 755.255.255.192 P assasszne0 2ssn00 1S. Gen he Pals 201.1478 ad te bt mak 255285255224, what i thee aos? Poutarase & 201147868 ev? Quine SECTIONS PRACTICESET 81 16. Given the IP adress 180.25.21.172 and the subnet mask 255.255.1920, wha is the sbnet ads? ,1802521.0 Diw02s00 pur © 1602580 4 180000 17. Gin the IP adress 1825021.14 and he suet mask 255.240. what he st aes? 4 180014 1831014 par 1424000 7 189.014 Beoeser 18, The suet mask fra clas C network is 255.255.255.192. How many sobnerwors se available? = a2 x Sex o + ee sin 19, The subnet mask fra cass B network is 255:255.2240, How many suboeworks sre valle? = na os 16 20, The sat mas for lass C network is 288 255.25.248. How any smears sxc avaible? a4 oe «16 Ox 21. What sth upemet mas for a supenct compote of 16 class C aes? 1. 155295240 16 o- ‘ (Gr55255160 fea ee ee ¢, 255,255.248.0 ce 62552352400 22, An organization is given 16 clas C areses beginning with X.Y80.0, Waa is the spemet mask? A 155255640 255.255.2400 °F 255,255255.192 4.255.285.1920 142. CHAPTERS. SUBNETTINGSUPERVETTING AND CLASSLESS ADDRESSING 23, Asupemet mask ha normally 24s ‘a. more han less than ©. exactly 4. none ofthe above 24, A superet maski 255.255.2480, How many class C netwovks were combined to ‘make this supernet? a2 ba <6 ae 25, A supernet mask has 19 1s, How many class C networks were combined to make this supemer? a2 bs v2 cot 26, Am ocganzation i ranted blook of classless addresses with he starting adess 109 34.76 64/98. How many adresses are granted? — Foi shah = an BY FLAY ER end TTY Joe 27. Am organization is granada block of classless addresses wih the stating adress 199, 34.76.128729, How many adreses ate ganic? Qs 16 e3 aa 28, An organization ie granted a block of classless addesss with the sting adress 199:3432007, How many addresses are granted?” a8 a6 @x do Exercises 29, Ina class A subnet, we know tbe IP aktess of one of the hosts andthe mask as ven blow Aude: 25341256 Maske 25525500 20. 3 32. 3 3 SECTIONS PRACTICE SE 143 Wats ae (tok ean he aes ons as) inne og Inca Boiinet, we now te ites fn of hss nd ema pre tebe Waddie: 12513401266 Mas sassaae0 Wat ste i aie took) ath is aes (ons aes) int Ihecnyebec we now Pt fn of Be sa be mak a re bw Iraddone 80448216 Mase asszssi92 ats te it ads tor aes) ant a a ones aes) Inaosa Fd tem tht cr te following numberof sb in cla A. Asie compan 2 he ed oe ci 380 othe sth ce lowing mir of tn B. Ase 2 como 3 Nee o 30 te 120 0 ind te mak cee llowig ster of mbt inca. Ate cma 3 be 1M CHAPTER'S SUBNETTINGSUPERNETTING AND CLASSLESS ADDRESSING 235. What the maximum numberof subnets lass A using the following masks? 255.255.1920 bs 255.19200 2552552240 4. 255255.2550 136, What isthe maximum numberof subnets in clas Busing the following masks? a, 255.255.1920 25528500 ©. 2852382240 4. 285235.255.0 [37 Whatis de maximum numberof subnets in class C sing the following masks? a 255.255255.192 255255255228 «, 285255285 240 4.255.285.2550 38, For each of he following subnet masks used in lass A, find the aumber of Is that dine the subnet 2552551920 255.1920 ©, 255285:2240 25255, 255.0 39. Fo ech ofthe following subnet masks used in class B, Hind the number of 1 that define the sub. a, 255.255.1920 25528500 ©, 255235.2240 4. 255.255.2550 40, For each of the following subnet masks wed in css C, find the user of 1 that define the sabnet 285.255.255.192 by, 255.255.255.224 1 255255.255 240 4. 255.2552550 41, Am organization is granted the block 16.00.0in class A. ‘The administrator wants to carat 500 subnets, | ind the subnet mask. Find the numberof addresses in cach subnet. Find the ist an the Inst adress in the ist subvet. 41. Find the frst and the last ares inthe lst subnet, 2. 4 “6. 46 a. SECTIONS PRACTICESET Ms ‘An organization is granted te block 130.5600 in class B. The administate swans tm create 1024 bres, 4. Find the sue mask ‘Find the numberof adresses in each subnet. ind the ist andthe last adress in the ist subnet. 4. Find te st an he last adres inthe lst subnet (subnet 1024). ‘An organization is granted the block 211.17.1800 in lass C. The sinistetor ‘wants to create 32 subnets. 2. Find the subet mask 1s. Find the numberof addresses in each subae Find the first an the Ist addon nthe rst subnet 4. Find the ist and the last adress inthe ast subaet (subnet 32), ‘Weitethe folowing mass in the fn format: 2552552550 b 255000 © 255.55:2040 4.253.255.2400 ia the ange of addresses inthe folowing blocks: =. 12356.773229 290.721.2827 s. 173416023 4. 18034.666430 Am ISP is granted a block of addresses stating with 150 80.00/16, The ISP wants to disubute those blocks to customers as follows: 1 The ise group bas 200 mediumsive businesses, eschneods 128 adresses. 'b. The second group has 40 small businesses, each needs 16 adresses. The tied group has 2048 households, each needs 4 adresses. Design the subblocks and give the ssh notation foreach subblock. Find out how many adresses are sl available afer these allocations. ‘One way to find the esuk of ANDing to bytes is to Sirs wee ech a e sum of numbers writen as powers ft (128,64 32, 16, 84,2 and 1) and then find and {the common ones. For example 10 find the result of (240 AND 84), whichis 50, we ean write or 128 + 64432416 8684 1644 ‘The common numbers re 64 and 16; the result is ther sam, or 8. Find the reslt ofthe following AND operations a. 192 AND 122 224 AND 191 © 284AND 204 4.128 AND 7S M6 CHAPTER SUBNETTINGSUPERNETTING AND CLASSLESS ADDRESSING 48, One cominon operation ona maski the complement or NOT operation, The NOT ‘operation changes every 1 O and every 0 10 1 In doted decimal notation the NOT operation subtracts every byte from 25S, For example, NOT (255.255.2240) 8.031.255, Use the NOT operation on the following masks: . 285255.1280 255.285.2550 25525500 4, 255.1920 49, To find the numberof adresses in subnet, superet, or block, we can find the ‘Complement of the mask (NOT operation) and then ad {to the result, Find the number of adresses using the following mass. 8. 255235.1280 255255 2550 25525500 4 255.19200 50. Another common option on adesses isthe OR operation In binsry notation x OR and OR 0 =x In dtd decimal nataton X OR 255 = 255 and X OR Howeves if he conesponing byte inte masks no 255 or, we must use the binary ‘pean oid the esa, Find the re of te OR operation an the flowing! 3. 140R 255 & 1g0R0 5. 140R 192 {419208 128 51, ind a procedure to find the resol ofthe OR operation similar to what we di in [Breese 47 forthe AND operation 5° When masking is coniguovs,the combination of the OR and NOT operations ca Find the last adres ina block f the ist adress andthe mask ae give: Last adress = (First adress) OR (NOT mast), Find the last address in each ofthe following blocks or subbocks wing the above orl: 212356773209 200472112827 ©. 173416023 4 18036646030 Programming Exercises 53, Given an adress and a prefix length, write a fucson that returns the fist adress in the Boek ‘54, Given an address and prefix Teng write a fonction that returns the ast adress in the block. 55, Given a address and prefs length write «function that returns the number of addresses inthe Block. 56, Given an adress number (V) write a function tht determines ithe adress can be seo the beginning address of «Mock with N adresses, CHAPTER 6 Delivery and Routing of IP Packets “This chapter describes the delivery an routing of TP paket other final destinations By delivery, we mean the physical forwarding of the packets. Concepts such as can nectonless and connection oriented serves, and diet and inlet dlivery are dis- cussed. By routing, we mean finding the route (next hop) fra datagram. We discuss routing methods, types of rousing, he outing table, and the routing modal, 6.1 CONNECTION-ORIENTED VERSUS CONNECTIONLESS SERVICES Delivery of a pocket a the network layer is accomplished using ether a conaetion- ‘rented a connectonlssnetvork service. Tina connection oriented situation, the network layer protocol ist makes aconnec ‘on withthe nework Laer protocol atthe remot site before sending a packs. Wheo ‘he connection is exabised,a Sequence of packets from the same source tothe sme ‘estination canbe set one afer another. In this ease, there is a relationship between ‘packets. Tey ae sent onthe same path in sequential order. A pack i logically con- ected to the packet aveting before it nd wo the packet traveling after i. When all Dockets ofa message have bees delivered, the connection is terminated, Ina connection-rientedprotocl, the decison about te route ofa sequence of| pockets with the stme source and detnaion addresses can be made only one, when ‘he connection i established. Routers donot recalulate the route foreach insividual packet. n'a connections situation, tbe network layer protocol eats each packet inde ender, with each pocket having no tlstionhip to any ter paket. The packets in& fessage may or may not avel the sme pth to thr destination, “Tae IP protocol isa connectonless protocol. Its designed this way becuse TP as an internctwork protocol, may have to deliver the packets trough several haeroge- ‘200s networks IFIP were to be conection-orented all ofthe networks inthe interet ‘Should also be connecton-oieted, whichis othe case ra us (CHAPTERS DELIVERY AND ROUTING OF tf PACKETS 62 DIRECT VERSUS INDIRECT DELIVERY ‘The delivery of packet tits final destination is accomplished using two diferent ‘methods of delivery dest and indirect. Direct Delivery Ima divet delivery, the ral destination ofthe packet sa host consecte tothe same pliysical network asthe deliver. Direct delivery oceus when the source and destin tion ofthe packet are located onthe same physical network ori the delivery is between the last router and the destination host (ae Figure 61). Figure 6.1 Diet dlery [ euany as SS ee, ‘The sender can easily detxmine if the delivery i direct, It can extract the network res of the destination packet setting the hostd part t all Os) and compare this ress withthe address ofthe network to which tis connected. Ife match found, the delivery is dire In direct detivery, the sender uses the destination IP addes to find the destination plysical address. The IP software then delivers Ue destination IP adress with the dew ination physical address tothe data ink ayer for actual delivery. This process called ‘mapping the IP adress othe physical addres. Although this mapping ca be dove by finding a roaich in table, we will se in Chapter 8 that «protocol called adress reso. lution protocol (ARP) dynamically maps an IP address tothe coresponding physical sires Indirect Delivery 1 the destination host snot on the same network athe deiverer, the packet is delivered inet. fn an indirect delivery, te packet goes fom router fo router al reches ‘he one connected tothe sane physical network ts fal destination (se Figure 62). ‘Note tata delivery aways involves one direct delivery but zeo or mae iniect eivries. Nw also that the last delivery is always a dice delivery, SECTIONS. ROUTING METHODS 149 Figure 62 Inver etinery Hox ones) Lie 1 am indirect detivery, the sender ses the destination IP adress and arcing table to find the IP address of the next router to which the packet should be denen The seader ten wes the ARP protocol o find the physical addres ofthe next ater "Note at in direct delivery, dhe address mapping s between te TP address ofthe fal v SECTION 65 ROUTINGTABLE AND ROUTING MODULE 157 Example3 Router reeves 20 paces for destination 200.3412: the alg apis the os ro ‘yr fo the detain aes ul math fxn: 1. Diet delivery 200341234 & 255000 = 2m000 omc 1 200361236 a 255255255204 me 005.1232 nomich 200361234 & 255255255226 me 20036.1232 notch 2 Hostspecie a, 200341234 & 255255255255 me 200341234 momeh 3. Nework specie N30 1234 & 255.255.2550 = 20034120 noah 1 2un34 234 & 255552550 = 2036120 nomach e rns cou fle | vselield | (tamper REOS E . Make the oating able for router Rn Fie 6.10, waned vi Sation wg Wek at he fon) ic tition news eo la does Cito nesting (default masks)>Tfere is also one access to the restaethe Tauern (deteult route). This inating ste fro Teng ble show nal 2. The trie Memon /MJRQBie a nl hes set op ake, Ass oe ef eet though inte pg the next-hop adress (ALIE2. Acces to etree 1228.09 (7 pug tse jon tnt np sen 222131680 Accs fo eee 208.0,6 (/ > soon le be bey aes 2213180. 188 CHAPTERS DELIVERY AND ROUTING OF Ip PACKETS rie ‘ble 6.2 Rowing tbl for Examples Mask | Destination | Netliop | ET ROUTE] wias00 | raiaoo | — [0] fo fan wiass00_ [mann | maaew us| oO | mi | [Bssassass | 220360 [Zaisi6s0 [0c 0 [0 [al [ease Toone —Pstiasa_ [us| ojo feo] Examples Mate the ting ble for roster ia Fgae61, igure 6.11 Replog for Example 5 Sotation We tow tt tere ar fie networks hr, a x oR ip wit ota and ‘se ot be te rouing able. The te dhe networks be ele The so try forthe deat. Examiansion the gure shows tat sme tiation lng, Fee ‘ample w donot ow tne I ues of be dei rue Als eset. ee ors 845.0 (an 040 on though rome and oe ovugh ote BS We dont ‘now wich roots opal hs subject is covered a Chap 13 er he ame near ‘oth pats ine king ble ee Tae 6.3), ‘Table 63. Routing ble for Eampte $ Mast | Destination [Nex Bop | EF [RGU] 1) 352552550 | mosao |__| U | 0 [o far ‘Bss2s8a580 | was0 [Bolalos w [ua] 0 | 0 | mior 2uos..12 Lj» | ss2s82550 [aso [aor<103 w [ue] 0 | 6 mw 2mn43.12 a aaa ‘on00 | Frm [US| [ 0 fae SECTIONS CLASSLESSADDRESSING: CIDR 158 Example 6 “Te outing ete or rue seven in Tae 6A, Draw its opopy. ‘able 64 Rowing table for ample ast Desinaon | Near [F [RE [OE , -fasason | romoo |v L» Lo [ao , —pasasson f orsoo | |u| 0 | 0 [me * Aasassnn [avorr00 we fo fat < Teapsassao | wsoann [worse [uo | 0 [0 [wt % -[assassa0 | 10800 | isoiaas [ua] o | o £- [e000 —Toaeo —finoraas tuo [obo Solution ow sme fact but don't have al of then fra define topology We know thatthe ae GinsSonerts diet fer. We Koo Gat rete en aseorks ily Ss ie roto nce eg Seo cee ny sacra Sippennsepenac Scio ete nebo jie tata cone. But rei sont(enaing formate OGTR Taow Hever rectly eosecedt rater 2 o ough 3 pot opi network (WAN) nd noe ose Wea not knife 20 600s snes outer ely eons 2 poinctepo.t ner (WAN) bd ance owe Poi pin wetwarks nore do nt ‘ven ety ake oting be boase no fs ie contre othe, Figure 12 shows ur ese topoloy. Figure 6.12 Guess pags for Exonpie oe eS ot apes © esas 6.6 CLASSLESS ADDRESSING: CIDR So far, the discussion on souting tables concentrated on clasfuledéessing. Now we need to consider clasiess addressing and Classless IntetDomain Routing (CIDR). The ‘hit to classless addressing egies changes to the roxtng tele organization and rut ing algorithms 16 CUAPTER6 DELIVERY AND ROUTING OF Ip PACKETS Routing Table Size ‘When we use clasfladresing, there i only one entry inthe routing abe foreach site ouside te organization, The enty defines the site even if that site is subneted, “When a picket aves athe role, the router checks the corresponding etry and for wards the packet accordingly. ‘Wea we use clasles addressing, the numberof entries in the router's table can cither decrease or increare, It an docrease ifthe block of addresses assigned 0 «8 fezenzaton is larger than the block in classful addressing. For example, instead of faving four ents for an organization that ceatesasuperet fom four class C blocs, ‘we can have one entry in classless outing. “fis mor likely, however, tha the numberof routing table entes will increase ‘This is because the intent of classless addressing isto divide up the blocks of cass A and class B adesses, For exarpl, instead of assigning over 16 million adresses to jt one organization, the adreses can be portioned out to many many organizations. “The problem is that whereas there was jst oe routing table entry forthe class A ‘adres, now there ae may cores in classless addressing, Foe example, ia class B ‘Mock (over 64,000 addresses) is divided up between 60 organizations, there are ‘oiting table ete where before thre was just ne Hierarchical Routing ‘To solve the problem of gigantic routing tables, we create a Sense of hierarchy n the Internet architecture and routing tables. In Chapter 1, we mentioned thatthe Intemet today has a sense of Rierarchy. We i thatthe Intemet is cvided int interational and tational ISPs. National ISPs are divided ino regional ISPs, and regional ISPs ate Aivided ing local ISPs If dhe routing table has a sense of hierarchy Like the Internet ‘sfchitectare, the outing table ean decreas in size. et us ike the ease na lca ISP. A local ISP can be assigned a single, bot large bck of addresses with cotta prefix length. The local ISP ean divide this block into smaller blocks of efferent sires, and ssin these to individoal users and organizations. both large and sal. Hf the block sesgned othe local ISP is A.B.C.DIN, the ISP can Create blocks of E AG.H/MY, where M way vary for each customer and is rete than N. How’ does this redwe the sizeof he routing table? The est of the Ineract does not have fo be aware ofthis division, Allcusomer ofthe loca ISP are defined as AB.C.DIN {o the est ofthe Interne, ery packet destined for ene ofthe addresses in this lange blocks routed to the lea ISP. Theres only one entry in every router in the world for ll, ‘ofthese customers, Tey ul belong tothe stme grou. Of eouse, nse the local ISP, the router must recognize the subblocks and route the packs to the destined customer. Ione ofthe customers i a lage organization, it ls can create another eel of hierarchy by fulmatng end dividing ts abblock into smaller sabbocks (or subsubblocks) In class= Jess routing, the levels ofhirarcy are uninited so log as we flow the rules of , sconnection oriented «, adiect 4, an inact 16) CHAPTERS. DELIVERY AND ROUTING OF IP PACKETS 5. When a diet delivery is made, both the deiverer and receiver have he same routing able bb Badass «. hoatd nets 6, When an indirect delivery is made, the delivers and receiverbave the same I adress bs difren netise «the same neti tome of the above 7. In__routing, the fll IP address ofa destination is given in the routing table, aexthop by notwork-specific «. hostspecitic 4. detatt 8. In __ routing, the mask and destination addresses are both 00.0. in the outing table. next hop be network specific . hostspecii 4. defnte 9 In —_roing te desinton aes i network aes in he ing nexthop network specific . hosespeifc 4. default 10, In__ routing, the routing table holds the address of ust the next hop instead of complete route information, a nexthop network specific & host specitic 4, detant 11, Fora det detivey the, fag is missing. aw gateway hostspecific 4. sed by redirection SECTIONG9 PRACTICE SET 168 12 The fig indicates the availability ofa router. aa gateway « hostspecitic add by redirection 13, The __ fag indiates that already existing information inthe rotig able tas been modified by a edirection mesage. a gateway be hostspecitic © modiied by redirection aed by redirection 14. The flag indicates thatthe ear in the destination column is a host specific addres gateway > hostspeciic «.motifed by reiretion 4 add by reiretion 15, The __ tag indicates that a edtetion message has add anew ent tothe routing abe gateway host specific ©, modified by reiretion ded by reirection 16, The __ column in the routing table ndieaesthe numberof pacts tans ted rough the rater forthe eomesponing destination. 4. destination reference count 4 imerface Exercises 17. A host with IP address 157.23.5623 sends packet to a host with IP adress 137.2367. ithe delivery dict or indirect? Assume no subetng 18 A host with IP adress 137.23.96.23 sends a packet to host with IP adress 1423.69. Is the delivery direct or ndieet? Assume no subneting 19, A router with IP adress 109.3456. sends a packet to est with IP adress 202.3489. she delivery direct or indirect? Assume wo subaetng. 20. A host with IP address 131.23.56:23 sends a packet to a host with IP addres 131.2367.9, Is the delivery director inde if tere is ao submeting? Can the detvery be indeed is subneting? 166 CHAPTERS. DELIVERY AND ROUIING OF IP PACKETS 21, Using Tube 6.1, determine the next-hop addtes if router RI receives packet estined for 1145.32.16, 22, Using Table 6.1, determin the next-hop address if router RI receives a packet des- ‘ined for 192.16:7.3, 23, Using Toble 6.1, determine the ext-hop adiess if outer RI receives packet Aestined for 196172145, 24, Using Table 6.1 determine he next-hop aires if router RI receives a packet des {ined for 20.7147. 25. Using Table 6.1, determine the next-hop address if router RI receives a packet destined for 195.14 3.165, 26, Using Table 6.1, determine the neat-hop ares if router RI receives e paket des- tied for 193.143.196, 27, Using Table 6.1, determine the next-hop adres i router RI receives packet espe for 1157.34 28, Using Table 6.1 determine the next-op addres ifrouter RI receives a packet des tine for 191,61.227, 29, Using Table 6.1, determine the next-hop aires if router RI receives packet estined for 189°73.43.23, 30. Show the outing table fr router R2 in Figure 69. 31. Show the outing tble for rower R3 in Figure 6.9. 32. Show the outing tble for router RA in Figure 6.9 33. Show the outing tble for router RS in Figure 6.9. 34, Show the outing table for router R2 in Figure 6.10. 35, Show the routing table for outer R3 in Figure 610. 36, Show the routing table for router RO in Figure 6.11 37. Show the routing table for roster RB in Figure 611 38. Show the routing tale fr router Ré in Figure 6.11 238. Sbow the outing table fr router RS in Figure 6.11 40, Find the topology ofthe network if Table 6.5 isthe routing table for route Table 6S Rowing sol for Eserse 40 Mak | Dentnaion | Newton [R[ ROLE] E zasim0 [iemio7 | — To 2 assassassam | aoaisi7a0 | [0 [0 [ota ‘ooo “anno vessel lo [o[m 41, Change the routing table in Table 6.1 so that i refets lasses outing (CIDR). 42, Change te routing table in Table 6250 that it eflts classless roting (CTD), 48, Change the routing able in Table 6350 that it reflects clatsless routing (CIDR), “44, Change the routing table in Table 64 oo that it retects classless routing (CIDR), Secrions9 practice ser 167 4. A classful routing table has four buckets the table and single enty for delat ‘outing. The ist bucket i for bost-speciic routing with 10 ents. The second buckets fr clas A blocks with 30 entes. The third buckot is for class B Wack ‘wth 400 entries, The fourth buckets fr class Cblocks with 2000 ents. Pi the ‘erage number of able lookups fr each ofthe following cases a A paket with hort specific ute has ives, A packet witha class A adress has rived. . A packet with class B adress has arrived. 4. A pact with class C address has rived. ‘© A packet as arved thar must be default route. 46, classes routing table hs 32 buckets inthe table ad a single ety fr deat ou ing, The average umber of entries in each bucket is 100, How many tbl lookups sr needed om average foreach ofthe fllowing packets: fA packet with prefix 32. 1. A packet wth prefix 24 A packet with refi 12 4. A packet with a prot 8. Programming Exercises 47. Create a header ito include all constant that you think are needed to implement the routing modble and routing ble in C. Use the define directives, 48. Complete the fellowing struct dcclaraton for the routing table entry. struct Routing Table Eoury c Mask " 49, Writ declaration forthe outing table 50, Wit function in Co simulate the outing module ‘An internets made of «combination of physical networks connected togeterby iter ‘networking devices such as routers and gateways. packet starting from a source host ray pass tough Several diferent physical networks before fiaally reaching the desti- ‘ation host "The oss and sour are recognized tthe network Level by thet logis addesses. A Topical address i en internerworke addess. Us jurisdiction i universal. A Togcal ‘ess is unique waverly. Ks called a logical adress because i is uualyiple- roented in software. Every protocol tht deals with interconnecting networks reset Togical addresses, The logical addresses in the TCP protocol site ac called P ‘addresses andar 32 is long However, packets pas through pysial networks to ech these oss tnd roms ‘At the physical lve, the host and routers are recognized by their physial aldose. ‘A physical address isa local address. Is jurisdition sa local network. It sould be ‘unigue localy, bu not acessarly universally Is clled epsicl addres bess it is usualy (bt not avays) implemented in hardware. Examples of physical addresses ae 48-bit MAC adresses in Ethernet and Token Ring protocol, which are pine fon the NIC installed in the host or route ‘The phytical address andthe logical address are two diferent identifiers, We need both of them Because 2 physical network, such s Ebeet can have eo difereapro- tocals at the network: layer such as IP and [PX (Novell) at the same time. Likewise, a packet ata network layer such as IP may pes trough ciffereat physial networks och av Ethernet and Locale "This means that delivery of a packet 10 a host ora router requires two levels of addressing logical and physical. We need to be able to mapa logical adress to its cor responding physical address and vice vers, These can be dane using either static or ‘dynamic mapping ‘Statle mapping means eating table tht associates logical adress with a psi! adicess. This able is stored in each machine onthe network. Each machine {hat knows, for example the IP address of anoer machine but otis physical adress ‘ean ook i up i the table. This hs some Limitations because physicl adreses may 1 170 CHAPTER?” ARP AND EARP change nthe following ways Ee 1. A michie could change ts NIC resulting ina new physical adress 2 In some LANs, such at Local, the physical addeess changes every time the computer is tarped on 3. A mobile computer can move from one physical network to another, resulting ina change ints physical adress. ‘To implement hese changes, a satic mapping table mst be updated periodically This ‘overhead could affect the nctwork performance Indymamic mapping each sme a machin knows one of the two addresses (gical cx pysica)itcan use «protocol to fing the other one “Two protocol have been designed 1 perform dynamic mopping: address resohi- ‘tion protocol (ARP) tad reverse address resolution protocol (RARP). The fst rape logis! adres toa pysical adres: the second maps a physical adess 1 a Topical adress. Figure 7.1 shows the idea Figure 7.1 ARP and RARP So ea atens Psa ae ia nies ‘ast and broadcast physical adresses in Chapter 3. We meationed that, for example, [Berne ses the all I adhess(FFFFFFFEFFFF asthe broadcas adress. Figure 7.2 shows the postion of ARP and RARP prosceals inthe TCPAP protocol igure 72. Poston of ARP and RARP ix TEPAP protocol suite a SECTION? ARP nt 7.1 ARP ‘Anytime host or a router bas an IP datagram to send to another host ot rte, it has (he logical UP) adress ofthe receiver. But the IP datagram mast be encapsulate in frame tobe abet passthrough the physical network. This means tha the sender needs ‘he piysical addres ofthe receiver A mapping corresponds # logical adres 10 ¢ plysical addres ‘As we sid before this canbe done ether statically o dynamically. The associa- tion berween logical and physical adresses canbe statically sored in table. The Sender can lookin the table and find the physical address comesponding toa logical Adress. But a8 we disussed before this ota good solution. Every time & physical addres is changed, the tale must be updated. Updating tables on all machines re ‘quetinteval very demanding task ‘The mapping, however, can be done dynamically, which means thatthe sender ask the reociver to announce its physical address win needed, ARP is desig fox this purpose. ARP stociates an IP aves with its physical addess.On a typical physical net- ‘work, such 34 LAN, each dove on a link s identified by a physical o sation aedess ‘hats wally imprinted onthe NIC. ‘Anytime host, ova router, necds to find the physical adress of anther bast oF ‘outer on is network, it sends an ARP quecy picket. The packet includes the physical And IP adresses ofthe sender andthe IP adress of the receiver Because the sender doesnot know the physical address ofthe reseiver the quey is broadcast ove he net work (ee Figure 73). Figure 73. ARP peration (Canig cp Suen Saeet ARP pei bat Siem Sant 1 ARP ey et 1” CHAPTERT ARP AND RaRP very het or router on the network reosives and processes the ARP query packet, ‘natony the intended recipient recognize its IP adres and sends back an ARP response packet. The response pucket contains the recipient's IP aad physical addresses, ‘The packet is micas dry to the inquirer sing the pyscal adres ceive inthe query packet, In Figure 73, the system onthe left (A) has a packet that needs tobe delivered to another system (B) with IP address 141.23.5623. System A neds to pas the pack to its data lnk ayer forthe actual delivery, bu it doesnot know the physical adress of the reipient. I uses the services of ARP by asking the ARP protocol wo send abroad cast ARP request packet o as for the physical address ofa system with an IP address of 161.2356.23, "This packets received by every syst on the physical new, but only system 1 wil answer it, a shown in Figure 7b. Systom B sends an ARP reply packet that Jnchades its pysialadess. Now sys A can send al the packets ita fr this de ‘ination using the physical adress it received. Packet Format Figure 74 shows th format of an ARP packet. igure 74 ARP pactet Batewe Te Pres hoe Mite | Pct os ie | Seam Rego? (Fora tye fr Bee) eoreanpyerT) [ | ‘The eds at s follows: {© TYPE Gardware type). This sa 16bit eld defining the type of the newark ‘on which ARP is running. ach LAN has been assigned an integer based om is type. For example, Eerct is given the ype I. ARP ca be used on any physical setwork. SECTION? ARP TS 1m PEYPE (Protocol type. This is a 16-bit eld etning the protocol. For example, the vale ofthis field forte TPv4 protocol is 0800, ARP can be wed with any higher-level proccol, ‘a HLEN (Ttardvare length). Ths san Bit eld defining the length ofthe physi- cal aes in byes. Pr example, for Ethernet the values 6. 1m PLEN (Protocl length), Tis is an S-bit field defining the length ofthe logical ‘adres in byes, For example oe he IP prorcol the vale is ‘= OPER (Operation). This is 16-it eld defining the type of packet. Two psket types are defined: ARP request (1), ARP reply 2. tm SIIA (Sender hardware addres). This Is @ variable-length field detning the ‘hysicel address ofthe sender. For example or Ethernet this eld is 6 bytes ng. ‘a SPA (Sender protocol address). This is varabe-lngi ie defining he lvical {for example, IP) sens ofthe sender. For the IP protocol, this fed is 4 bytes long. fm THA (Target hardware addres). This is @ variable-length fick defining the plysical adress ofthe target, For example, fr Ethernet this Held is 6 bytes ong. Foran ARP request message this ld i all s because the sender doesnot know the physical adress ofthe target. 1m TPA Large protocol address. This i variable-length ed defining the kia (ior example, IP) adress ofthe target, Forth TPvdprovcol, tis Held is bytes Tong Encapsulation [An ARD pocket is encapsulated rectly ito data ink rae. For example in Figure 75 ‘Sr ARP packs is encapsulated in an Ethernet frame. Now that the type field inates that the data erie by the frame san ARP packet Figure 7S. Excopaation of ARP packet | | | oe Paes b- ax | Tine Shy 6h Dia Te 14 (CHAPTER ARP AND RARP Operation Let us see how ARP functions on atypical internet, First we describe the steps involved, Then we discuss the four cases im which a host o router needs use ARP Steps Involved ‘These are the steps involved in an ARP proces: 1. The sender knows the IP adres of the target. We wil se how the sender obtains this shot. 2 IP asks ARP to create an ARP request message, filling in the sender physical auidess, the sender IP address, and the target IP addres. The target pysial adress eld is Ele with 3. The message is passed tothe data ink layer where i is encapsulated ia fame sing the physical address ofthe sender asthe source address andthe physical ‘brondcast address asthe destination adress. 4, Brery host or router receives the Fame. Bocase the feame contains broadcast Aestnation addtess, all stations remove the message and pass it to ARP. Al ‘machines except the one targeted drop the pack. The target machiae recognises the Padres, 5. The target machine replies with an ARP reply message that contains its physica saree. Tho message is unicast (6. The sender receives te reply message. It now knows the physical address ofthe target machine, 7. The IP datagram, which caves data forthe argt machine, s now encapsulated in frame and is unicast the destination. our Different Cases ‘Te fllowing are four different cases in which the services of ARP can be sod (ce Figure 7.5), 1. The sender iss host and wants to sead paket to another ost on the same nee ‘wor, In his case, te logical ates that must he mapped to physieladdsess the destination I des inthe datagram header, 2. The senders a hostand wants to send a packet to another host on anor network. In his case the host looks at is routing table ad finds the IP aes ofthe next hop router for this destination. If it does not havea outing table, it looks fo he [P adres of the default router The IP adress ofthe router becomes the logic dss tht must be mapped to «physic des. 3. The senders router that has received s datagram destined for host on another ‘etwori I checks its routing able and nds the IP adress ofthe next rer The [P ares ofthe next router becomes the logical adress that must be mapped oa Dliysial adres SECTION? ARP ns Figure 7.6. Fourcoss wing ARP Deion es a wale | Seer soar | Smbtitmpmanes> outanermnseanetome eS ae 44 The senders router that has received a datagram destined fora host nthe ame network. The destination IP adress ofthe datagram becomes the logical aldess ‘hat must be mappe toa physical adres. AN ARP request i toad an ARP epics Example 1 |Abost wth Paes 10.25 43.20 sn psi adress OxB23455102210 aa packet send "sth bor wih I dss [30.23.4525 and pial adres DRAGCEFSSSSSAB, The two bossa on he une there network: bow te ARP eqoest nd epypukets coups te in Bern: mes Solution igre 7-7 shows the ARP reqs and reply pucks. Noth be ARP dt el in seas 28 tyes, an hat he Invi aden he S-yteDoedy. Tat wy we CO ot show the regular yt boundaries fr thse aeses. Alto mote tte TP ares we ‘Shown in head Far infomation onary or boxadecinl wtation ee Append B v6 (CHAPTER? ARP AND RARP Figure 7.7 Example | TEDss10210 sscerusssi agri ssn ‘9 FR a [me oae i005 Pe [osraesio2 cate] Dvn owe ‘ARP py om BISA ARP Over ATM. |ARP i also used when an IP packet wants to pass over an ATM network We wil all thou his aspet of ARP when we discus IP over ATM in Chapter 26. Proxy ARP ‘A technique called proxy (promiscuous) ARP is used to create a sbneting eect. A ‘roxy ARP san ARP that ats on behalf of ae of oss. Whenever aroater running 3 [roxy ARP receives an ARP rquest locking forthe TP adress of one of these ost, the outer sends an ARP reply announcing its own hardware (physical) address. After the route receives the ata IP pect, it sends the packet othe appopriat host o router. TLetur give an example In Figure 7.8 the ARP installed onthe right-hand hos will snawer ony to an ARP request with a target IP adress of 14128.56.23. We cal this ‘etavior honest. The other hosts o routers onthe network ely on ts honesty. "However, the administrator may need to create sobnet without changing the ‘whole system wo recognize subneted addresses. One solution is toad router umning ‘proxy ARP. In this eat, the route sts on Bchalf fall ofthe hos installed on the sslct. When it receives an ARP request with a target IP address that mates the SECTION?2 ARP PACKAGE TT Figure78_PosyakP [Reg armie dress of one its protégé (141.28$6.21, 141.23.56.22 nd 141.2356.23), it sends an AARP reply and announces its hardware address athe target hardware adress. When ‘he oer receives te IP packet, it sends the packet tthe appropriate hos. 7.2 ARP PACKAGE ln this section, we ive an example of a simplified ARP software package, The pupose istoshow the components ofa hypothetical ARP package an the relationship between the components ‘We can sy that this ARP package involves ive components: cache table, queues, an output module, as input module, and x cache-coatfol module Figure 7.9 shows ‘ese five components and thei interactions. The package receives an TP datagram that needs to be encapsulated ina frame that needs the destination physical (hardware) dress. Ifthe ARP package inthis addes, it delivers the IP packet an the physical dress to the data link ler for transmission. Cache Table [A sender usually has more than one IP datagram to sent the same destination Tis ineficint to use the ARP protocol for each datagram destined for the same host ot routes Te solution isthe cache table. When a hos or outer reeves the corresponding Physical address for an IP datagram, the adres can be saved inthe cache table. This adress can be sed forthe datagrams destined forthe sae receiver within the next ew minutes. However, as space i the cache table is very Limited, mappings te the ‘acho are not retained for an ulate tine ‘The cache table i implemented as an ary of entries, In our package, each etry contin the fllowing fel ‘8 State. Tis column shows the state ofthe entry. Ie can have one of thee vals FFREE, PENDING, o: RESOLVED. The FREE state means thatthe tim-to-lve foe {his entry has expired. Te space can bo Used for anew entry. The PENDING state ‘means a request for this entey has been sent, but the reply has not yet been 178 CHAPTER 7 ARPAND RARP igure7.9. ARP components ARPyociet ARPpuletARPPake Ppt roms cena) ep) sabre arrest ata tink eer received The RESOLVED state means thatthe enty is complete. The entry now has the physical (harware) des of the destination. The packets waiting wo be sett this destination ean we information in hie entry. Hardware type. This li the smo asthe comesponng led in the ARP pocket, Protocol type. Tis eld is the same asthe corresponding fc inthe ARP packet. “lardware length. This Hed she same asthe conespondig fl inthe ARP packet. ‘Protocol length. Thi elds the same asthe corresponding eld in the ARP packet. Interface number. A router (ora rmutbomed host canbe connects to different actworks, each wih a dtferent interface somber Each network can have dffer- cat hardware and peotocol types ‘= Queue number. ARP uses numbered queues 19 enqueue the packess waiting for adress resolsion, Packets for the same destination are wuelly enguoued ip the same gueve ‘5 Attempts, This colama shows the numberof imes an ARP requests Sent ot for this entry 12 Time-out. This column shows the lifetime ofan eatry in seconds SECTION 7.2 ARP PACKAGE 179 fm Hardware address. This column shows the destination hardware address. Ik remains epty unt resolved by an ARP reply. f= Protocol address. This column shows te destination TP address Queues ‘Our ARP package muinttins a set of quowes, one foreach destination, co hold the IP Dckets wile ARP tries to vesolve the hardware address. The ouput module sends {fnresolved packets into the coresponding queue. Te input module moves pcket {fon queue and sends it, withthe eslved physical adress, tote dts nk aye for ‘Output Module “The output modale waits for an IP packet from th IP sofware. The output male ‘hocks the cache table to find an enty corespondng to the destination LP aires of ths packet. The destination IP ares ofthe BP packet must match the protocol adress of the ent. the cnty is found andthe state ofthe entry is RESOLVED, the packet along withthe destination haar adress is passed tothe data ink layer for ansmisson. ifthe ety is found and the stat of the ene is PENDING, the packet waits util the destination hardware adress is found, Because the sate is PENDING, there is {tebe already created fortis destination, The medal sends the packs his queue. “i no ent is foun, the module creates a queve and enqucues the pocket. A new entry withthe sate of PENDING is created fortis destination abd the value ofthe ‘ATTEMPTS fel is sto 1, An ARP request packet is then broaast up Module 1 Tipaia piacere | go} {ect tray oon tite ir at Ee [3 go . “3 a 1 (he tues SOLVED) sa Ge XQE 1 Bu he lr of Os hae aes fom he = 252, Sent the packet andthe hanware address ndatainklaer. Nove] 2 2. Rere ag, 2 ties DN) ee SNS ES Sh, aque he pskatto the conesponding oe < 4, Weer fans ne ace xy que eto PENDING anf PTERES 222 | 2. Createa quenet BRST CQO Co Pen ws 5, Rewn, 10 COPTER? ARP AND RARP Input Module Tela sodas an ARP pct rg oc aie hap Sc deceit fa oncay coneending tt ARP pce prose a mu he poe sary if eny nnd nth or ety PENDING te mote pas be oxy cay begets en pc ae cr a fe yin cgi he et RESOLVED. Thc ame ah oe eo SRTIMEOUT fr fs ny es doje pce om th coresonding Gr ny enna gt ses tS ak evtreminlsie ith ey ad hese RESOLVED, he ole lpn cays rome he ups wae we ol ne age eae sie Th out fag sos Wey ot a tlc ew ey te ke, ‘era oie at ty oman reed doe wee ‘Reta ies W RESOLVED snd HME OUT st ove ale sh el aed AP ack areas i nme ct AR vey ena dat er Te ARP ‘Sab ceded ty npn ee ero fe ow ec ‘vs ign tr de ans ipa | Tae ARR TT 2 Gmatecenut nt ny carn th AR pet fren 1p ey. | 2 ne NEI) 1 eee og | Deer | 2 Seapine oetadean stones | 4 wot | enemy, 2. Adie entry toe te 5. Me petetisaregien) 1. Sandan ARP ply 6 Rew —__] Cache-Control Module ‘The eache-control module i sponsible fr maining the cache abe. Kt peiod- cally for example, every 5) checks the cache table, entry by eat. “festa ofthe en is FRE it continue tothe next ent the sates PENDING, {th module neem the value of te temps ld by 1. Kethen checks he value of he tints led If this value is prester than the maxizoum numberof ater allowed, he SECTION72 ARP PACKAGE 181 state is changed to FREE andthe comespnding queues destroyed, However if the number of auempts is es than he maximum, te module creates and sends anober ARP request. If the state ofthe entry is RESOLVED. the module decrements the value ofthe time-out feld by the amount of tne elapsed since the last check. I this value is ess ‘han or egal to 2, the state is changed to FREE and the quveis destroyed. Cocke Cnt Moe 1 Ses a pi ner mares 2. Forever entry inthe ace ale 1 (ie statis FREE) 1. Comin. 2. Wests PENDING) 1, Taree he vale fap by 1 2. iauengseeser ba maxi) 1, Change he stat FREE 2. Des the cesponding gue ~ 3. Bie 1, Sena ARPreoes 4. Comins 2. be ses RESOLVED) 1. Desreeathe ae otine-oatby he lucas ie 2: inet an oc gual 0 20) 1, Change sate to FREE 2. Dest he coespondiag qe. 3. Ream, More Examples In this seston we show some examples ofthe ARP operation sod the changes inthe cache table, Table 7.1 shows some ofthe cache table ida the start of ou examples. ‘Table 7.1 Original cache ble ead for examples [ic [he [aS [Tw | Pol Alle | Hao Ali eesdved [ik “o)_[ issi~ | camara eos [EPR iaaas es aoiaisey_| x * 40 | WaSTaeY | as7sezacansa ep to 205857 sree LAE | | Srey @_ [aie — aan wpe ps eis PY ee foe 23 we omrrens aspera Pe 24 sample? AEE a tm exes Ht Oa ee with esintin ss The ARE ee star Tara uc resin whe 1 ae kine bl), ext the bara est which 457MOACAES RESOLVED i lhe ares oe data ik per fr wana. The coche ale ean the sae Example3 “Feet code ate ARP ott ole sees nT aga (fo I woe i Treaty sem ten 1161722 check cs ul ancl dos ot is desman en cen cay to ble wise ste PENDING athe Ate vae te ale The oi ident nd eoaces the packs. Irten ed an ARP eet © Se apr fori destintin. Te ew coche ables sown a Tale 72 ‘Table 72 Updated cach tale for example 3 Tra | aber | e135 Soa | 1s0361 | ACABENTI pat? T3448 ee 201367 eis eases [rnc rn [ansss7 1 o [sized ~| 7 Swim — | SREIENCA ie iiguaTt —I Examples o Frese sseas at, ie ARP np md reeves os ARP packet wih ret pots (P) Fe i Te mle cect te ew ids ie kes, tangs: ie ta of he a SOLVED andes tneout vue 9 Te nota hn as Be he ra baci thc. Now #scses ee and eds alte pk hs ZAR iy oe toe dati jer, Te ne ache bl tw TE 79 ‘Table 73 Updued cacheable for example 4 [Siam [ Quewe [ Attempt | Time-ous | Protocol Addr ianbware Addr | ets Sar | anos [CAST paps Ta EO ‘aust a3 Hiss | aan eto 25837 pap Teun a ani mama =D sare esac | “ sy y SECTION?.3 KARP X88 Examples “Twente seconds ater, th bo ooo] module pas very ey. Theme as {Bein he eslvoenties x deceoed y 6 The wou ale forth a saved iy ‘Screened by 25. The sn oh et tobe lat ny i caged o FREE bees he ime ‘Gotta Torah ofthe the ets, he il of be tet sincere by one. fer ‘Sieanemig. the suewpts a fer oe ey (He one 9h Protea! aes 21.11.67) ‘we hun be xm th st changed O FREE, he ace det a at ICMP esas ‘Sect to the cng desination (ee Cope 9). See Tae Table 74 Upoted cacheable for example S (ae Dae [Rena | ee | a rts Wa iwner [ACA exe Hort Hiss Aaa CHD aw | aaa era 05557 bE Tan F_ oP cee aay [asi _| BASTRIEAEA 73 RARP 5 “ _ ARP finds the logical adres foe a machine that ooly knows its physleal adres, Each host or router is assigned one or more logical (IP) adresses, which are nique and independent ofthe physical (hacvar) adie ofthe machine To teat an IP datagram, a host ora router needs to know its owa IP address or adresses, The IP tures ofa machine i usually ead fom is configuration file stored ona disk ‘However, a dskless machine is urally booted from ROM, which has min:mom ‘booting infomation, The ROM i iste by the manufacturer. It cannot ince te IP ‘ales because the IP adeses ona network are assigned by the network ainistate, "The machioe can gets physical adress (by reading its NIC, fr example, nhc ia ungue locally. Ttean then use the pysieal adress to get the logical adress using the RARP protocol. A RARP request is created and broadcast onthe Leal network. "Another marie on te Teal network hat knows al the P adresses wil respond with | RARP reply. The requesting machine must be running a RARP client progran the responding machine mistbe running @ RARP sever program (ee Figure 7.10), “The RARP eqns aces oe Brod he RARP ely packs are nist 1m Figure 7.10a, the dskless ost onthe left is booted. To get is IP aes, it broadcasts n RARP request ol systems onthe network, “This packet is received by every bos (oc outer) onthe physical network, but only ‘the RARP server onthe right will answer ic as shown in Figure 7.10b The serve sends A RARP reply packet that itedes the IP address of the requestor. 184 CHAPTER7 ARPAND RARP Figure 7.10. RARP operon vam i paar etn ar ye Packet Format ‘The format ofthe RARP puck is exacly the sume asthe ARP packet excep thatthe ‘operation eld is either thee (RARP requestor four (RARP reply. See Figure 7.11 igure 7.11 RARE pater ; = Harsnee one Presale Heteae | Prat maton te et age ey rece Se rte) “get cea ras (Gert 6 pes Ber) a fn Tags so a woreang dese) (sa hed erga SECTION? SUMMARY 185 Encapsulation ARARP packets encapsulated directly nt a data ink frame, For example ign 7.12 ‘shows a RARP pocket encapsulated in an Ethomet frame, Noe tat the type feld shows ‘hat the data cried by the Trane is « RARP pack, Figure 7.2_Bcoprlation of ARP pacer | “ype es esate [Daseasn | Some ‘Shy Sixes Stns Alternative Solutions to RARP When a diskless compote is boted, it needs more information in adtion tits IP adress. I needs ro know its ube mas, the IP arece of outer, andthe IP address ‘of «nameserver, RARP cannot provide tis extra information. New protocols have ‘been developed to provide this information. In Chapter 17 we discuss two protools, [BOOTP and DHCP. tha: canbe used instead of RARE. 74 KEY TERMS ress resolution petocl (ARP) physical adress cache table proxy (promiscuous) ARP dynamic mapping queve encapsulation eve adress resoation Wadess ene) logical address sti mapping 7.3 SUMMARY 1m Delivery of packet oa hos or router equires two levels of adresses: logic and physical 1M A ogical adres identifies a host or router atthe netwov level TCPAP calls his logical adress an IP ads. 12 A physical addes identifies «host or router atthe physical evel 186 (CHAPTER? ARP AND RARP ‘8 Mapping of logical address oa physical address canbe sate or dynamic. ‘a Sutic mapping involves alist of logical and physical address corespondences; ‘maintenance of thelist requies high ovebead 1m The address resolution protocol (ARP) isa ysamie mapping method that finds a pysial address vena logical dares. ‘5 AnARP request is beoudesst to all devices onthe network 1 AnARP reply is unicast the host requesting the mapping, '=nproxy ARP (promiscuous ARP) a our represents ast of hoes. When an ARP request seeks the physical addres of any hos inthis set, the outer sends its own physical address, Tis crests a subnetng effect. '2 The ARP software package consists of five components cache table, ques, an output module, a put module, and cache-conol module s=)The cache table as an aray of entries used and upsted by ARP messages. ‘8 A queue contains packets going tothe same destination, 1m The output module takes a packet fom the IP layer and sends it ether tothe data Fink layer or toa queve. ‘= The input module uses an ARP packet o update the cache table. The inp module can alo send an ARP reply, 1m The cache-conrol module maintains the cache table by updating entry Hes 12 Reverse dress resolution protocol (RARE) is a form of éymamie rapping in Which even physial address is esociated with a logical addres 7.6 PRACTICE SET ‘Multiple-Choice Questions tin protocol associates logical addres with physial adress. 2. Satis mapping ‘dynamic mapping © plysial mapping 4 asad 2s a table associating a logical addess with a physical address is ma tained onal devices on a network 2 static mapping 1 dymunic mapping ©. phyricl mapping 4 amd SECTION76 PeAcnceser 487 {is a dymanic mapping protocol in which a logical adres is found for a ven pica adress. 1 ARP be RARP © ICMP 4. none of the sbove isa dynamic mapping protocol in which a physical adres i found fora ‘vee logical aes. ARP wh RARP ICMP 4. none of the above A roaterseads the adress on packet to determine the next hop. 1 logical physical a. ARP ‘The target hardware adress on an Ethernet is in an ARP request, 'xo00000000000 » 0000 variable A ease dependent ‘An ARP reply is 2 broadeast all Boss bs, mulias; one host, unicast ll hosts 1 unicast one host AnARP requests broadcast al hose by, mulicast; one host unicast ll hosts nica one host ‘What does a route runing proxy ARP and representing 10 hosts retum inthe target hardware ses field im an ARP reply? {any of 10 different hardware adresses 1. any of 1 differeat hardware adresses 6. juste roater hardware adress A juste rower IP adress (CHAPTER? ARPAND RARP 10, The ARP component that seads an ARP reply to the dat link ayer isthe a. cache controler input module output mode 4. aaa 1. The ARP component hat sends an TP packet toa qusve isthe cache controler input module © output module a aandb 12, ARP packets are sea to the dat ink ayer by the 1. cathe control module >, input module «,urput mode 4. allof the sbove 13, An ARP packet fom the dita link yer goes tothe «.ciche-conrat module input edule «output module 4 aande 14, Am IP packet oes dircty from the the entry is RESOLVED. &. eache-control module 1. inpot module output modele 4. aande to the data Tink layer if the stat of Exercises 15. Is the size of the ARP packs fined? Explain, 16. Ist size of the RARP packet fixed? Explain, 17, What is the size of an ARP packet when the protocal is IP and the hardware is Btberet? 18, What isthe size of RARP packet when the profoet is IP and the hardware is Berne? 19, Whats the ize of an Ethernet frase carying an ARP packs? 20, What isthe size of an Ethermet frame caring & RARP packet? 21, Whats the broadcast adres for Ethers? SECTION PRACTICESET 189 22. A router with TP address 1255.25.12 and Beet physical ads ‘54SABARSTCD has received a packet fora ost destination with IP address 1251.78.10 and Ethernet pysical address AABBA24FS7CD. Show the entries in ‘the ARP request pcket sent by the router. Assume no sbmeting 23, Show the entre inthe ARP packet set in response to Exercise 22 2A, Eneapsolate the result of Exercise 22 «data ink fame. Flin al the is. 25, Encapsulate the result of Exercise 23 in data ink frame. Flin ll te feds 126. A rose wilh P adress 195 52.12 and Ethernet physical adress AA2SABIFGTCD {hs eceve ape! fora destination with IP addes 185.11.73.10 Whee he roncr ‘heck its routing tbl, finds ont the packet shoud be delivered to a outer with IP fares 195 52.6 and Ebert pysical adds ADSSDAPOICD. Show the enies inthe ARP request packet set bythe router, Assume no subaeting. ‘Show the entries inthe ARP packet seatin response to Exercise 26, “Encapaulste the result of Beri 26 in dat nk frame, Flin al thefts, Encapsulate the result of Exercise 27 ina daa lnk frame. Fl inal he fel 30. A diskless host with an Ethernet physical adress 9845234R67CD has teen ‘ooted. Show te ents in the RARP packet seat by this hos. 31 Show the entries inthe RARP packet sen in response to Exercise 20. Assumethat {he IP aes of the requesting ste 200.67.89.33, Choose appropriate physical tnd logial addresses forthe serve, Assume the server i on te sme network 38 the requesting Host 32, Bneaprlate the result of Exercise 30 ina data ink frame. Fil in the elds, 33, Byeapslate the resul of Exerise 31 in data ink rame. Flin al the lds BBR Programming Exercises $4, Create «header filet ineade al constants that you think ate teed to implement the ARP modale in C. Use the #efinediectives, 3. Complete te following struct declaration. Its a declaration forthe ARP pace struct ARP { Unsigned short HardwareType : i 36. Wit the decaraton for the cate able entry 37. Wiite the dsclartion or he cache table 38, Write a function in Ct sim the eache-contol module, 39, Wat a function in C to simolte the input mode 40. Write function in C to simolte the ouput mode [APTER 8 Internet Protocol (IP) “The Ineret Prowocal(P) ithe ansmisson mechanism wsed by the TCPAP prsools. Figure 8.1 shows the position of Pi he suite. Figure 81 Position of Pin TCPAP protocol ute iis an unreliable and connections datagram protoco!—a best-tfor dlivery serve. Te tern best-effort mens that IP provides no eer checking or tacking. TP fssunes the unelability ofthe underlying layers ad does is best get ransssion ‘rough wits destination, bat with no guarantees. ro 192 CHAPTERS. INTERNET PROTOCOL(IP) ‘1 retiabitiy is important, 1P must be paired with a reliable potacl such as TCP. ‘An example of « more commonly understood bes-etfort delivery sevice isthe post fice. The post office does ts best to deliver the mail bt doesnot always scceed IE sn uregistered eters los, itis up the sender or would-be recipient to discover the loss and rectify the problem. The post office itself doesnot keep track of every leer and canot notify a sender of loss o damage, — TP is also a connectoness protocol packaged for a packet switching nebwork thet wes the datgram approach (see Chapter 6). This means that each datagram is handed Independently, and each datagram can follow a diferent rote tothe destination, This Smplis tht datagrams sent by the same source to the same destination could arve oat of order. Also, some could be lost or corrupted daring transition. Again IP relies om & higher level protocol to take care ofall these problems. 8.1 DATAGRAM Packets in the IP layer are called datagrams, Figure 82 shows the IP datagram format. ‘A datagram i a variable-length pocket consisting of two pars: Reader and dats, The header is 20 to 60 bytes in length and contains information essential to routing and elivery tis customary in TCPAP to show the header in 4-byte sections. A brief escription of each Red i inorder Figure82_ 1 gener SECTION! DATAGRAM 189 ‘a Version (VER). This 4-it ld defines the version of the TP protncol Carel Meretian is 4 Howeve, version 6 (or Pag) my replace version 4 in afew yar. ‘Tas he tells dhe IP stare running tthe processing machine that the dspam reformat of version 4 All elds mst be interpreted as specified in the fut aaa tte protocol the mache s using some oer version of I the dats [ram is diseatded rather than interpreted incorety, ta Header length (HEN). This it eld defines the total length of the dategsam Tater in tbyte words. This led 6 eded because the length ofthe header is Nebable (between 20 and 60 bytes). When there are no options, the header ath a0 byes and the vale ofthis fl is 5 (5x 4= 20). When te option cis at its maximo size, the vloo ofthis elds 15 (15 x 4= 60) sa Dierentated Services formery Service Type). IETF nas een chang vrapretton ad rare ofthis 8-8 fd Tis eld previously called Service 3S, reread Dafecntited Services, We show bot nerprettions in Figure 83. Figure 83 Serice Type or Diflereaed Semices 1, Service Type errimerpetaton, the first 3 bits ae called precedence bits, The nest bits fe ealed TOS bits aa the lst bit snot used a precedence is «3-it subd ranging from 0 (000 in binary) v0 7 111 ia pina) The precedence defines the proiy ofthe datagram in ssuessch as eonmeaon, Ha routers congested and needs to discard some datugrams, those datagrams wit lowest proveence are discarded ist Some dasramns pete Interstar more important than oer. For example, a datagram ued ‘Renetwodk managements much ore urgent and imports than dram) a Tuning optional information, fr a group. At present, the precedence sub- ell however bot ased I's expected tobe funciona in frre versions “Ts romance wel aot sedi von 196 CHAPTERS TERVET PROTOCOL (IP) ', TOS bites bit subfield with each bit having a special meaning. Although 2 bican be either O or 1, one and only one ofthe its can have te ale of Lin cach datagram. Te bic pate and ter interpreations ar even in Table 8.1 ‘With only one bit set ara ime, we can have five dere types of services Table SA Mpes ef soice Tosti |__Deseripion (000 | ermal eta 001 | Minis ost ‘n10 0100 100 Application programs can request specific type of service. The defaults for ‘some pplication are sown in Table 82. ‘Table 82 Deel perf sence [Pret | ras ber (ce 000 [poor [oon NNTP oi cP [eoi0 ‘SNMP T_ 10 [raxet [100 | FIP Gata) 0100 FIP (wom) | 1000 Te = SHIP Goma) | _T000| SMP a) | 0100 DS (UDP ay) [to DNS gen) | OM DNS Gone) | O10 Wis clear frm the above table hat interactive activites, activites requiring Jmmediateawenton, and scvites requiing mediate response need mini ‘mum delay. Those activites that Sond bulk data rogire miximem trough pat Management activities need maximum reli. Background activities eed minimum cost SecTION ss DATAGRAM 18S 2, Difereniated Services Inti mrpretation, the first 6 bits make up che codepoint subfield and the st to sae not wed. The codepoing subi an be wed in wo diferent ways 4 When the 3 rightmost bits are Os, the 3 leftsnost bits are interpreted the Same asthe precedence bit in the Service Type interpretation. In oher ‘words iis compatible with the old interpretation ‘When te rght most bits are ntl Os, the 6 is define 64 services bse on the prion assigament bythe Inteet or local autboites according to Tle 18.5, The fist eaegory contains 32 servic types the second and the hid each ‘ontain 16, The ist category (numbers 0,2, 4... 62) i assigned bythe {item auborites (ETF. The second catgory (3,7, 11,15... 68) em be ‘heb Toca torte (organizations) Te thir category (1, 5.9,» 68) 18 temporary and can be used for experimental purposes. Note that he umbers tse nt contiguous. IF tey were, he fist category would range from Ow 31, the second 32 to 47, an the third 48 to 63. This would be incompatible with the TOS interpretation beeause XXXODD (which includes O, 8,16, 24,32 40, {35 and Se) would fll ino all the categories. Instead, ia this assignment ‘otha all these services belong fo category 1. Note hit these asignients ave not yer bea finale “Table 83. toes for codons angry [Capit [Aig tory 1 [300000 [Inert 2 [0OKKHT [Leal 3 [xx | Temporary or epeimenal sm Total length This is a 16-bit eld hat defines the rot length Chesser pus a) of {he IP daagram in bytes, To find the length of the data coming ftom the wpper Iayer, subact the eader length fom the toa length, The header length can be four by multiplying the vale i the HLEN fed by four length of dats = tal length—header length Since the field length is 16 bt, he total length ofthe IP datagram is limied to 165535 (2!) bytes of which 20 to 60 bytes ae the header andthe rest is date fiom the upper aye. “Fos ttle Geld dctnos he otal eng of he datagram including be beer, “Though a sizeof 65,535 bytes might seem larg, the size ofthe TP datagram nay inrease inte nea futore as th underlying technologies allow even more ‘throghpot (ore bandit), "Wen we discuss fragmentation in the next section, we wil see that some pial networks are notable fo encapsulate a datagram of 65,535 byes i their frames. The datagram most be fragmented to be able to pass through those networks 6 CHAPTERS INTERNET PROTOCOL (IP) ‘One may ask why we need this ed anyway, Whes a machine outer cr host) receives a frame, it drops the header and the rier leaving the datagram. Why, include an extra eld that is not needed? The answer is tht in many cases We really do nt need the value in ths fel However, there ae occasions in which he Aatgram is nthe only thing enczpsolatd ins fame it may be tat pang has been added. For example, the Ethernet proocol has a minimam and maxima resrietion on the siz of dat that canbe eacapslted in frame (46 to 1SUD byes. 1 the size ofan IP datagram is less than 46 bytes, some padding will be aed to ‘ect his requirement In this cas, when a machine decapulses the datagram, it needs to check he ttl length eld to determine bow much i really dta and how ‘much is padding (se Figure £4), Figure 84 Breapsulto of small datagram nan Esher free Leng Miia 46305 cae a ‘2 Tdenteation. This eis used in fragmentation discussed inthe next setion). ‘Flags This ied is usd in fragmentation (cussed inthe next section). = Fragmentation offset. This field is used in feagmentation (discussed inthe next section), ‘8 Time tove. A datagram has a United ese ints travel trough an interne. ‘Tis ld was originally designed to old a timestamp, which was decremented by tach visited router. The datagram was discarded when the value became 20, However, for this scheme, ll te machines must have synchronized clocks aod ‘must know how long it takes for a datagram to 0 fom one machine to athe. ‘Today, tis fel is mostly use conta the maximum number of hops (outer) visited by the datagram. When a source bost ens the datagram, it stores number in his Sel. This value is approximately two times the maximum numer of oates| ‘between any two hosts. Each router that processes the datagram decrements this ‘number by one. I this value after being decremented, is er, the route discards the datagram, ‘This fed is needed Because routing tables in the Internet cin become cor roped. A datagram may travel between two o more routers fr along ine witout ‘ver geing delivered to the destination hot Resources may become tied up. This Sed its the lift for datagram and prevent olddata rom popping Ot ofthe network and perhaps confusing higher level protools especially TCP). Another us of his eld is wo intentionally limit he journey ofthe packet For example, ifthe soure wants to confine the packet wo the lca network, team tne 1 in thst When the packet ries a he fst rt, tis value i decremented 10 andthe datagram is discarded, seeriow8s DaTaGRAM 197 ‘m Protocol This fit eld defines the higher evel protocol that uses the servces of the IP lay, An IP datagram can encapsulate data from several higher level prosc- ‘ols sich as TCR, UDP, ICMP, and IGMP. Tis field specifies the final destination protocol to which the IP datagram shoald be delivered. In other words, site the IP protocol mulipleres and demultplexes data from diferent higher-level prto- col the vale ofthis fel helps the deruliplexing process when the data arrives ts fil dastination (se Figure 8.5). Figure 85. Matipesng Tang ne | os ‘= Checksum, The checksum coacept and its calculation are discussed ltr in this hap 1m Source address. This 52-bit ld defines the IP address ofthe source. THs fed rust emain unchanged during the time the TP datagram travels from the source host he destination host ‘= Destination address, This 32-bit Held defines the IP adress ofthe destination “This eld most remain unchanged during the tne the TP datagram raves Fom the saurve ost tothe destination bos. 1 OD “i IP packet as rv with the it 8 Wis show: gue, ut ze “Te cerca th pce, Why? 198 CHAPTERS. IvrERNET PROTOCOL (LP) Solution ‘Ther an enorin his packet. The # ets ts 0100) show the version which comet. The next its (0010) show tbe ease ergs wach means (248) wht wong The mini ube fy ia th adr mst be 20. The oct sean cape in tasmision Example 2 [nan IP packet wae oF LEN ls 1050 inary How many byes of opin te being ca Solution ‘The HLEN vale 8, whch means dhe total mimeo bytes int Rete i 8340 32 bytes. ‘Theft 20 bytes ar ihe maa Baader, he et 1 ys ae he pons ‘Example 3 In a IP pak, the value of HLEN is gad the ale of th otal gt el i 025, How ‘many byte of aa are being cio by tsp? Solution ‘The LEN value 5 which means the mabe of byt in th ee iS 4 20 by (oo sions) The engi i 40 byes, whch mens th paket caying 20 yn of "2, / Baales ‘An TP packers mse with he et few exact shown below == “sovorzso0100000103. How mary bop an his packet vel before bela ope? The dt blan o whi upper ayer proton Solution “To adie time ove Bed, we Should kip 8 tes (16 hexadeinal dg) Te time ve el he sinh bt. which sO. This means te packet an tae! oly on op, The rte Als the ete (2), wich means ht the wpe per proto IGMP (ele 8). 8.2 FRAGMENTATION A datagram can rave through different networks, Bach router decapslates the IP date _ram from the fame it receives, proceses it and thea encapsulates iin another fame, ‘The format and size ofthe recused frame depend onthe protocol sed by the physical setwork though which the frame has jst eavled. The frmat and sizeof the sent frame epead on the protocol used bythe physical meswork trough which he Fame is poing to ‘eavel For example if router conects an Beret network to a Ten Ring networ, it receives fam in he Ethernet format and sends frame inthe Token Ring forma. ‘Maximum Transfer Unit (MTU) ach data link layer protocol has its own frame format. One of the feds defined in ‘he format is te maximum size of the data eld In other words, when a datagram is SECTIONS? FRAGMENTATION 199 cocapsulatd in frame, the ttl sizeof the datagram must be less than this maximum ‘zz, which is defined by the estcton imposed by the adware and software wed in the network see Figure 8.6). Figure 8.6 actu ‘The value ofthe MTU differs from one physical network protocol to another. “Tle 8.5 shows the values for diferent protocols. Table 8S _MTULfor dire: nrwors Praecol WO ggoanna cy “Ten Ring (SR) | HSU “Ten Ring Mp) | AAG Fob 5 ert 1500) a5 516 cm 36 Inondec to make the TP prone independent ofthe physical network, se packagers decided to make the maximm length ofthe IP datagram equal tho largest raainum transfer uit (MTU) defined so for (6,535 byte). This makes transmission more ef- ‘lent if we use a protocol with am MTU ofthis sie. However, for alee psi net ‘works, we mus vide the datagram o make it possible to passthrough these networks. This called fragmentation. ‘When a datagram is fragmented, cach fragment as its own header with ost of the fields nepeated, but some changed. A fragmented datagram may itself be frag- ‘mented if i encounters a network with an even smaller MTU. In othce words, data- ‘gram canbe Iragnened several ies before it reaches the fina destination. “A datagram can be fragmented by the source host or any route in the pats. The reassembly of the datagram, however, is dane only by the destination host because ech {agment becomes an independent datagram. Whereas the fragmented datagram can tevel though diferent routes, and we ean never contol or guarantee which mute & fragmented datagram may take allo the fragments belonging to the same Sangram 200 CHAPTERS INTERNET PROTOCOLAIP) shoul finaly ative atthe destination host. So its logical to do the reassembly tthe final destination. "When a datagram is fagmented, squire pats ofthe header must be copied by all fraginsts The opin eld may or may not be copied as we wil 6 in tenet section, ‘Toe how or router tht fragments 4 datagram must change the valves of three fields: fhoge, fragmentation offset, and toa length. The rest ofthe les mast be copied OF carte the vals of the checksum most be recalculated regardless of fragmentation Fields Related to Fragmentation “The folds that are related to fragmentation and reassembly of an IP datagram are the ‘entiation fags, and fragmentation off fields fa Identification, This 16-bit fd identifies a datagram originating fom the source fost The combivation of the idenication and source IP address must wiguely “efne 4 datagram as it eaves the source host. To guarantee uniqueness the IP pro- fhool ures a counert label the datagrams. The counter i inkialized to a positive numer When the IP protocol sends datagram, it copies the current vale of the ‘ovnte the ienticaon field and increments the counter by one. As Jong a the ‘Sune is kepe in the main temony aniquenes is guranteed, When a datagram i emented, the value in the ientietion field is copied into all fragments. In ‘Ser words al apments hive the same identification number, which is also the sane asthe riginal datagram. The identification amber helps the destination in Feassembling the datagram. 1 knows that al fragments having the same identifica tion vale shouldbe assembled into one datagram, Flags. Tiss thre bt fel. The first itis reserved. The secon its called the donot fragment bt fits vale 2 the machine mast not fragment the datagram. fit cannot pass the datagram through any avalable physical network, c discards the datagram and sends an ICMP eror message to the source host (se Chapter 9). ‘ht vale is te datagram ca be fragmented if necessary. The hid biti called the more fragment it Its valve is} means the datagram i nt te last fag {neat hee are more fragments after this ome. I its value i 0, mean his is he Testor only fragment (se Figure 8.7 Figure 87 Flags fld ‘a Fragmentation offset This 13-bit eld shows te relative position ofthis fas nent with respect fo the whole datagram. Itis the offset ofthe data i the crginl Catagram measured in units of 8 bytes. Figure 88 shows = datagram witha da ‘Sze of dO00 bytes fegmente ito tre fragments. The bytes inthe original ta fra ace numbered 0 to 399. The rs agent cartes byes Oto 1599, The fst SpcmON 82 FRAGMENTATION 2 for this datagram is O18 = 0, Ta sand fragment casos bytes 1400 to 2799 the coffe valve fr this fragment is 1400/8 = 17S. Finally, the third fragment caries bytes 2800 co 3999. The offic vale for this fragment is 28008 = 350. ‘Remember thatthe vale ofthe offsets measured in wits of 8 bytes. This is done because the length of th offset field is only 13 bits long and cannot reqre- Senta sequence of byes greater than $191, This forces hosts or routers tht fag- ‘ment datagrams to choose the size of each fragment so thatthe fst byte muber isaivisibeby 8 Figure 88. Fragmentaon example ae | » = Fem 89 stows an exit vo he gmat inte rovou S voce it ean Ss he nena age Nee SE PAats oatmeal non th m. ute rt si rt apm or Tne cht ees shapes ng is pment ee carts Hwee sie a vy ae gl oui ot Sate nlp ts won fupt act Ego oe seared bot hws ate pon Mees eign Tan en cch agen ns espa an wet oi ea as np ap a ight ate hw oy be flog ae 1 eit gett ice ae © Drie beg of a ot tape Te eo ages aft ‘are ¢. Diet leg fe anon agen y 8. The i get panties uae 4. Cote Tela apt a nr me 0 am CHAPTERS INTERNET PROTOCOL (IP) Figure 89. Desai apmenation example r Fister fritid rein dean ages 21 it ene Examples {packet said ith an M bi wb fis te ft eget Tas gen, 3 ‘nae fngen? Do we know the pocket was fagmcte? Solation the AP 61s 0c meas that here re oe fagments the ape ithe ast ne. Hower, ‘we cane ifthe rg packet was raged ont. Anonfgmened packet is cos edhe at agent Example 6 ‘A packet as aed wth an Mit ale of Te his he ret agen, he at fragment, 8 ‘mille ngment Do we ow if te paket ws fragment? Solution te bis, teas thatthe east one more rape. This apnea canbe te fst one 3 il oe bu 0 east one. We don ow st tbe ft oe ora mid one we aed more nfomatio he ae of he gems oe). However, cae daily he (rig packet is een eagmested becuse he Mb Yale Example7 ‘Ack has avd with nA ital oft and afagmestation oft vale of zo. hs the ‘iat agmen te os fragment ore mle agen? SECTION®3 OPTIONS 208 Solution Because he Mite, bere fit pment x amie one. Betas thos ales 0, ‘tate it gen, Example 8 ‘A yucket as anivedin wich he ft ae is 100, What the aunbe ofthe fist yt Do we no the mbar of he ast ye? Solution “Ton the mune of tet yt, we mil he oft value by 8. Tis means at fest ‘yr mamers 40, We cama nee the pero at yt ues we Know thelength hte dat, Example 9 A pchs as aie in which fet vale 10, he be of LEN 3 and he val of he ‘a length eid 10, What te mame of the iste andthe ast ye Solution “The st bye univer is 1008 = 0, The wot engin is 10 bytes ante eades gt abbots (54, which mean hat ete ae HD byar ads daagrm If the Gest byte mer 1380, the tye ber mas 879. 8.3 OPTIONS “The header ofthe IP datagram is mado of pars fixe part and avaiable pat. The ‘ined par s 20 byes long and as diseussed inthe previous section. The variate pat ‘comprises the options tht can be a mazimum of 40 bytes. ‘Options, asthe name implies, a no equied for every datagram. They ae wed for network testing and debugging. hough options are nota required pat ofthe IP Feader, option processing i required ofthe IP software, This means tha all standards ‘st be tbe handle options if they are preseat inthe header Format Figure 8.10 shows the format of an option Its composed of a L-byle code il, @ ‘byte leagth Bel, and 2 varabe-sized data Geld Code “The eve el is 8 bits long and contains three subfields: copy, lass, and nuke ‘= Copy. This I-it subfield controls the presence of the option in frgmexaton ‘Wien it vale sO, means that the option must be copied nly to the ist Fag meat If its vae i, means the option must be coped to ll ragments. 1m Class This 2-bit suid defines the general purpose of the option. When is value 13 00, it means thatthe option used fr datagram como, When its values 10, i ‘meats thatthe option is sed for debugging a management. The ther tvo possi ‘ble values (OL and 11) have not yo been defined. 206 CHAPTER INTERNET PROTOCOL (IP) Figure 810 Opin frmar |& Number. This Sit subild defines the type ofthe option. Although Sits can o1pmr61 coon Seem oxeren Example 13 {at doe sue example in headin Fach ow hs far exadecimal gis, We cane the su fst. Now th fan aiton rests in are than one esac digit he it mest Aig beeomes te coreaccolumn digit andthe rest ee car to ote colin. Prem Sm, ‘we rb he checksum by conpiemeatng the Sum. Howeves, oe tht we subateach digit ‘om 1S inhotdesnal apneic Gusta we sat fom Ii ary arithmetic) Tha mane ‘he complement of E14) 1 adhe complement of 88 (1), Figure 825 ews the lel tion, Noe hat he rea (SBI) xsl the sume ao xa igure 825 Exanple of check caleultion x hexadecinat 530 — au ‘CHAPTER 8 INTERNET PROTOCOL (1) “Check Append C fora dead description of checksum calculation ad he badng ef 8.5 IP PACKAGE In this section, we presenta simplified example ofa hypothetical IP package. Our ‘purpose isto show the relationships between the different concepts discussed in ths hapter Fig 8.26 shows these eight components and tei interactions. Figure 8.261 components Foner er rote Topper inert | iP ma [ SECTIONSS IP PACKAGE 215 Although IP supports several options, we have omited option processing in our package to make it easier to understand a this level In addition, we ave sacrificed ‘cen fo the sake of simplicity. ‘We can say thatthe IP package involves eight components a headeraading mod- ‘le, a processing modal, 2 routing module, a fragmentation module, a reasembly ‘module, routing abe, an MTU tbl, anda reassembly table In adition, the package includes inpat and output ques "The package recelves 2 packet, either fom the data link layer or fom a sigher- ‘evel protocal. If the packet comes fom an upper layer protocol itis delivered to the data Unk ayer for txnsmission (ones thas loopback addres of 127.X¥.Z), Ifthe packet comes from the data ink layer, iis eter delivered othe data ink ayer fr for- ‘warding (ina outer) ort is delivered to higher-Laer protocol if the destination TP Mess ofthe packet isthe same asthe sation adress. Header-Adding Module ‘The headeradding module receives dats fom an upperayerprotceo along withthe estnaion IP address. I encapsulates the data ina IP datagram by adding the TP bead Header ag ie ‘Resse di entation ass 1, Baca the a a8 IP tara, 2. Cala the check od insert tin the cee 5. Send the dats othe conesponiing inp ue Processing Module “The processing module is the heart ofthe IP package. Ta our package, te precessing module receives datagram fom an interface or from the eade-edding meddle. It teats both eases the sate, A datagram must be processed and routed regarless of ‘where it comes from. “The processing module fis checks wo see ifthe datagram is a loopback packet “vith the destination address of IZ7.X.YZ) ora packt that bas reached it final dest- tio, In either case, the packets seat to he reassembly module. Ifthe node i a route, it decrements the time-to-live (TTL) field by on. I this ‘vale ese than egal 620, the datagram is discarded and an ICMP message (see (Chapter 9) i sent othe exgial sender. Ifthe value of TTL i greater than zero afer ‘decrement, the processing module scads the datagram tothe outing modal (see Chapter 8), 216 CHAPDERS. INTERNET PROTOCOL) Proeaing Mode [Reco oe dag mone of apa quae 2. I Gesinaon adosis 127 XY Zor matches one fhe a ade) 1. Send the datagram othe essely moe 2, Ret, 3. achive s aro) 1, Desenen TL, 4 TTL estan roa 260) 1, card he datagram, 2. Send an ICMP ere messes 3 Res, 5. Send he dag othe owing mot, 6. Ret Queues Our package uses two types of queues: input quoues and output queues. The input ‘queues sve the datagrams coming fom the dat ink layer cn the uppe-ajer poco ‘The output queues store the datagrams going to the data link Layer or the uppe ayes ‘rotcols The processing module dequeue (removes) the datagrams from the input ‘ques. The fragmentation snd reassembly modules engueue (add) the datagrams into the onput queues, Routing Table We disesse the routing cable in Chapter 6. The routing table is used by the outing ‘module to determine the next hp adress ofthe packet. Routing Module We discussed the routing module in Chapter 6, The routing module receives an IP pocket from the processing module If the packet is tobe forwarded, itis passed to this ‘module. The module fads the TP address ofthe next station along withthe iterface ‘umber to which te packet should be se I then sends the packet with his informa ion the fragmentation module. ‘MTU Table ‘The MTU table is used by the fragmentation module to ad the maximum transfer unit ofa particular interface. Figue 8.27 show the format of em MTU table SECTIONS IPPACKAGE 247 Figure 8.27 Merve Fragmentation Module ‘in our package, the fragmentation module receives an IP datagram from the rosting ‘module The outing module gives the IP datagram, the IP address ofthe next tion (either the fina destination in direct delivery orth next outer in an inet deli xy), and the interface number through which the datagram is sent cat ‘The fagmentation module consults the MTU tablet find the MTU forthe spec interface number. I the length ofthe datagram is large hun the MTU, the fragmenta tion modale fragments the datagram, asx heart each fragment, ad sends them ‘he ARP package (oe Chapter 7) for address resolution and delivery ‘Fragment Madde Resco a packs fom ong mole 1 Bente se ofthe tga, | 2 tte» nv oe conesponsing nner) 1. TD Go no fragman bits) 1. Discard te daca, 2, Sendan FOMP ewer estage (se Caper 9) 3. Rear 1, Calculate the masimam sie. Divide te dtp ato agen. Aik header each rent, ‘Aa required options eae apm Send te datgrams Rear, 3 1. Sed the dtagram, 4, Ren ab CHAPTERS INTERNET PROTOCOL(IP) Reassembly Table ‘The reassembly table is used by the reassembly module In oar package, te ressean- ‘bly table has five felds: sate, source TP addres, datagram ID, time-out, and fragments (soe Figure 828 Figure 828 Reasembiy ale SAsSoweaddes 10: Towa SE epan Eagan ae ae eo] t i ‘The value ofthe sate fed ean be either FREE or IN-USE. The IP address eld defines the source IP addres ofthe datagram. The datagram ID is a number that ‘uniquely defies a datagram and all ofthe fragments belonging to that datagram. The time-out isa predetermined amount of tne in which ll fragments mux arive Finally, the fragments felis» pointer to inked ist of rages. Reassembly Module ‘The reasembly module receives, fom the processing module, those daragram fag- reat that have arived at thee final destinations. Tn our package, the reasembly mod- tle rent an unagmented datagram asa fragment belonging ta dstgram with only one fragment ‘Because the IP protocol sa connectionless protocol, thre no guarante thatthe Fragments ave inorder. Besides, te fragments from one datagram canbe intermined With fragments from anotber datagram. To keep track of tes situations, the module ‘ses reassembly table with associated inked ists, as we descbed cari. "The jab of the reassembly module is to nd the datagram 19 which 2 fragment belongs, to order the fragments belonging to the same datagram, and reassemble all fragments of «datagram when all hae arived. If he established time-out bas expired and any fragment is missing the module discards the fragments Resse Modale "Resi an TP dain om the processing mode | 1 uronic vale snr and tet 0) 1. Sead ihe datagram othe spore gue | 2 Search he reasembly able forthe eorespooiag eo. | 3 mottoand) 1. Greate anew ety. SECTIONS KEY TERMS 119 z rier Tose ke gett appropri pce athe aka. ‘(al rgmees hve eed) 1. Reasenble the figment | 2, Dever the datagram oth coresponlng upper ae re | 3. Rew, | 2 me | 1. Che the tne ot, 2 Aime expired) | 1, Discard al agment 2. Seo an ICMP coor message (ee Chater 9). | Re 8.6 KEY TERMS Destoffor delivery option hocksum pointer eld ‘ode fil precedence datagram reciver estination adress ‘cord route option end of option option oer fragmentation sender fagmentation offset service pe beader source adress bade length stit source route option Tnveret Protoeo IP) time to lve toose source rout option timestamp ‘maximum transfer unit (TU) type of service (TOS) ‘no operation option version 220 CHAPTERS INTERNET PROTOCOL.) 8.7. SUMMARY 8.8 PRACTICE SET [P is an unrlible connectonless protocol responsible for soure-to-destnstion deivery, Packets inthe IP layer ae called datagrams ‘A datagram consists of header (20 60 bytes) and dats ‘The TP header contains the following information: version munber, header length, _O1O1001T GHOi0100, Sim > (OOK o.oo cei > oe4000 OTOT08 264 CHAPTERS INTERNET CONTROL MESSAGE PROTOCOL ICMP) 9.6 ICMP PACKAGE ‘To give an idea of how ICMP can handle the sending and receiving of ICMP messages, ‘we present our version ofan ICMP package made of two modules: an input module and sm output modal. Figure 920 shows these two modules Figure 9.20 ICMP pactage Resta enor Reply owas tt Regie Rass eines pecs ha (femsgpicion) Gomer TCP) seotoptcds —Sopend hem ‘Sugar ad erermesgts Input Module ‘The input module handles ll oceived ICMP messages. It invoked when an ICMP. pack is delivered tit from the IP layer. Ifthe received packet is 2 request solicit: tion, the module creates a reply or an adverisement and sends tout. the received packer is a redirection message, the mode ses the information to update he routing table Ifthe received packet san ero message, the module informs the protocol about the station that caused the eror. The pecudocode ie shown below: ana ae DEERipee ees 1 he ty i me “ae it 1 Goo arr sven _ 2 Send the advenisespem, 3 Meigpe icon oft eer Seeger svete) 1, Barna te ic of uke 4 Delete fone te on ht eed SECTIONS ICMP PACKAGE 14S Output Module ‘The output module is responsible for eeating request, solicitation, or error messages ‘equested by a higher level o the IP protocol Tae module receives a demand from TP. UDP, of TCP to send one ofthe ICMP error messages. If the demand is from I, the ‘output module most fst cheek thatthe request is allowed. Remember, an ICMP mes- sage cannot be crested for four situations: an IP packet carrying an ICMP error mes- sage, a fragmented IP packet, muakicat IP packer, or an IP packet having IP acess 0000 oF 127X¥.2, ‘The output module may also receive a demand from aa application program to fend one ofthe ICMP requestor solicitation message, The prendacode is chown bow Crip Wade esis Sema 1. Fhe demand defines a emo menage) 1. he demands fom IP) tbe dem frien) 1. Ret, 2. hetype defines a eecion mesage) 1 fe stone at re) 1. Ream 3. Create enormesage wing they, th code tthe IP yet, 2. Whe demand defines requestor ian) | 1 Cree eestor slictaton megs 5 Send the esas | Rem, 6 CIAPTER 9 INTERNET CONTROL MESSAGE PROTOCOL (ICMP) 9.7 KEY TERMS dress mask message query message checkson, redirection estintion-onreachable message round-trip ime ccho-roquest and reply message outer tlicitation and esroreporing message Sa Invern Conta! Message Protocol source quench mesa aca) time-excooded message porter problem message timestamp message 9.8 SUMMARY 1m The Ineret Control Message Protocol (ICMP) sends five types of eror reporting messages and four pars of gusty messages io support the uneiale sod connec tions Internet Protect (TP) ‘ICMP messages sre encapsulate in IP datagrans ‘The dexiation-unreashableeror message is seat to the source host when ada gram is undeliverable 18 The source quench err messages set in an effort alleviate congestion. i The time-cxceeded message notifies a sorce hos ht (1) the ime-o-ve fl has reachod ner, or ©) fragment of a mestage have ot avd ina set amount of ine (© The parameter problem message notifies # host that thre is a problem inthe header field of datagram. ‘= The redirection message is sent to make the roting table of «host more efficient. 1B The echo-roquest and echo-eply messages test the connectivity Between {0 systems 1 The timestamp-requst and timestrmp-eply messages can detexmine the round trp time betwecn two systems or be difference in time between two Sytem. 1m Tre adress maskerequest and adrese-mas reply messapes are used to obtain he suboet mask 1§ The routersoictation and router advertisement messages llow host to update bei routing ales 1= The checksum for ICMP is calculated using both the header andthe data feds of she ICMP message. ‘Packet ImerNet Gropec (pig) isan application program that uses the services of TEMP to teat the reachability ofa host ‘= A simple ICMP design can consist of an input module thet handles incoming TEMP packets and en ouput module that hanes demands for ICMP serves. SEcrioN99 pRAcTiceser 247 9.9 PRACTICE SET Multiple-Choice Questions 1. Ifa host needs to synchronize its clock with anther host, it sends message a timestamp rouest bb source quench | Tooter adverisoment 4 timeexceadet 2. Which ofthe following types of CMP messages needs to be encapsulated ito an IP daagran? time exceeded ‘, mulicasting «. echoreply 1. aloft above 43, The purpose of echo request and echo reply ist0__. 4. reporters fh cheek node-to-node communication . eheok packet fetime (find TP adresses 4, Inertor epoting the encapsulated ICMP packet goes to _. the sender 1 the receiver any of the above 5, Which el is always present in an ICMP pack? ape code fe ehecksum 1. ll ofthe above 6, What field uniquely idenifes the Kind of CMP message (for example, ec reply vers echo request)? ape bb code opti 1D 4, none ofthe above 8 (CHAPTER WTERNET CONTROL MESSAGE PROTOCOL (ICMP) 7. When the hop-count field reaches zero and the destination has not been reached, error message is sent | destination uareacable 1 time-exceeded © parameterproblem 4. redirection ‘When al fragments of » message have not ben recived within the designated ‘mount of ime, a ertor message is ent source quench 1 time-exooded © parameter problem 4 timestamp request 9. ors i the header or option Belds of an IP datagram require & ror message. 4 parameter problem '. source-quench router solicitation 4. redirection 10. A__cam lea about network pocket, bs rower, hosts host, hosts 4. ost, routers 1. TEMP fonctions include detection of all unreachable datagrams ©. reporting of some types of erors -allof he above 12, Who can send ICMP eroe-eporting messages? 1, destination hors source host 6 sand 13, One method to alert a source host of congestion isthe message 1 redirection bs echo-request ©. souree-quench 4. destination unreachable by sending out a router slctation SECTIONS PRACTICE Ser 9 14 A time-. What isthe checksum? Whatis the group?” 41. The contents ofan IGMP message in hexadecimal notation are: 16009 COEI 2413 Answer the following questions | Whatis he po? ‘a Whatisthe checksum? «What isthe groupid? 42, te there an enor he following hexadecimal presentation of sn IGMP message? 11.090 12813 14 hore an erin the following hexadecimal representation af an IGMP mesg? 17040 11 00¢00000, 44, How many mulicat addresses can be supped fr the IP protoclin Ethernet? 45, How many multicast addresses canbe suppor by the TP prxocol? 372 CHAPTER 10. INTERNET GROUP MANAGEMENT PROTOCOL (IGMP) 45. What she sizeof adress space lost when we transform a multicast IP adres to ‘an Etheret nities address? 7. Change te folowing IP multicast addresses to Ethernet multicast adresses. How ‘many of them specity the same Ethernet address? a MaRS b msia728 © 2718688 a. 2248.28 48, Modify the IGMP package nthe text 1 be also applicable oa router 49, Do some esearch on IGMPv1. Whats the size of the type fed? Ts there any fed Jn he fst version that i notin tho second? Are version and 2 compatible? I router supporting version 2 receives a message in Version I, what can the router ‘do? router supporting version 1 reeves a meseage in versio 2 what can the rovter do? Programming Exercises 50. Waite aC function to determine if given I address inthe form x3:78) sa mul- sicast adres. 51. Wite a fonction to determine fa given IP adress inthe fer of along integet) fs muliast adres. 52. Write u C function to determine i given Ether addess (in hexadecimal for- ‘mali an Etberet moliast aes. 53. Wate aC function that changes a given TP mulias adres (in long integer) oan Ethernet multicast adres (n hexadecin), [54 Waite a C function that changes a given Ethernet mulkiast addres (in exadeci- ‘mal to an IP micas adress (in long integer APTER 11 User Datagram Protocol (UDP) “The TCPAP protocol ate specifies two protocols forse transport layer: UDP and TCP. ‘We ist focus on UDP the simpler ofthe two, before discussing TCP in Chapter 12 igure 11-1 shows the lationship of UDP tothe oer protocols and layers fhe “TCPAP protacol site: UDP is between the application layer ante IP yer and, ike ‘TCP, serves asthe intermediary betwoen the application programs and the n-work operations Figure 1. Povion of UDP ne CPAP prosoolsate | tre cy 274 CHAPTER11 USER DATAGRAM PROTOCOL (UDF) A transport layer protocol usually has several responsibilities, One isto create & proceso races (a process running application program) communication; UDP ties port numbers 10 accomplish this. Another responsibility isto provide control ‘mechanisms tthe transport level. UDP does this task at very minimal level. Thee is ‘no flow contol mechani and thee i no acknowledgment for received packets. UDP, however. docs provide error contra to some extent If UDP detects an ero inthe received packet, it slely drops it ‘The tanspt layer alo provides a conection mechanism forthe processes, The sroceses must be able to sed streams of dal othe transport ler Is the response bility ofthe transpor layer atthe sending station to make the connection with the receiver chop the steam into transportable units, number them, and sen them one by ‘one Its the responsibility ofthe transport layer at the receving ent Wait unt ll he ferent units belonging tothe same process have rived, check an pass hose tha re ‘ero fe, and deliver them tothe receving process aa sea, Alle the eire stream hus boon sent, the transport layer elses the connection. UDP does not do any ofthe above Itcan onl receive a data unit fom the processes and deliver unrelibly, othe resciver Te ta unit must be smal enough tof a UDP packet UDPis called a connecionles, unreliable wansport protocol. Kt doesnot ald any- thing tothe services of IP except for providing rocessto-process communication instead ofhose-to-host communication. Also, it performs very limited eer checking IF UDP is so poweress, why would a process want to use i? With the disadvan tages come sme advantages. UDP isa very simple protocol using a minimum of over head. If process wants to send a small message and does not care much about reliability, itean use UDP. Sending a small message using UDP takes much less inter section between the sender and receiver than using TCP 11.1 PROCESS-T0-PROCESS COMMUNICATION Before we examine UDP, we must fist undorstand host t-host communication and process-to process communication and he difeence between them. ‘The IP is responsible for communication at the computer level (host “ost com munication). As & network layer protcel P can deliver the message only to the dest- ation compute. However this is an incomplete deliver. The message sil needs to be handed tothe corect process. This is where a wansport yer protocol sach as UDP takes over. UDP is responsible for dalivery ofthe message to he appropri proces Figur 112 shows the domains of P and UDP. Port Numbers Although there are afew ways to achieve proess-t process communicaton, the most ‘ommon oe strough the een-server paradigm. A process on the localhost called ‘clon noeds services fom a process uslly onthe emote hot, clled a server Both processes (lien and server) have the same nae, For example, 0 get the day and time from a remote machine, we need a Daytime client process running on the local hos and a Daytime server proces running on a emote machine. SECTION Ih PROCESS-TO-PROCESS COMMUNICATION 8 However operating systems today support oth mubiser and multiprogrmming cavironmens_ A remote computer an run several server grograns at the sane timo, just ax sever Joa! computers ean run one ome lint program atthe sare time. For communication, we must define the Local host, Local process = Remote host sm Remere process ‘The local host and the remote host are defined using IP adresses. To define the p> esses, we need seco idetifers called port numbers. Inthe TCPAP protocol suite, the por numbers are integers between O and 65.535, "The client program defines self with a port aumber, chase randomly by te UDP software running onthe client host. This is the ephemeral port number "The server process must also define itself with a port number. This port amber. however, cannot be chosen randomly. I the compute atthe server site run server proces and asin a random number ate port number, the process atthe cent ste "that was to access that server and seis services will not know the pot aun. OF ‘course, one soliton would be to send special pcket snd request the pot mune of 3 specific server, but his requires more overhead. TCP has decided to use univers ort numbers for servers: these ae called well-known port numbers. Ther ae some {exocptons otis rule: fr example, there are cients that are asigned wellknown port ‘numbers We wil ak about this ate when we explore the een server paradigm in ‘Chapter 15. Every client process knows te well-nown port number ofthe conespond fing server process, For example, while the Dayle cient proces, escussed above, ‘ean use an ephemeral (temporary) port number 52,00 wo identify itself, the Daytime Server process must use the well-known (permanent) port number 13. Figure 113, Shows this concept. should be cleat by now thatthe IP adresses and port numbers play different roles in electing the inal destination of data. The destination IP address dees the 276 CHAPTER 11 USER DATAGRAM PROTOCOL UDP) host among the diferent hosts inthe world, Aer the host hasbeen seoctd, the port number defines one ofthe processes on this parcular host (see Figure 11.4). Sas TANA Ranges ‘The JANA has divided the port aumbers into thee ranges: well-know, registred, and dynamic (o eve) as swe ia Figure 11.5, SECTION 11.1. PROCESS"T0-PROCESS COMMUNICATION 377 Figure WS 1A ranges S| ‘= Wellrknown ports. The pors ranging from 010 1,023 ae assigned and contlled byIANA, These ae te well-known pors. ‘5 Registered ports. The ports ranging from 1,024 049,151 are not assigneorcon- twlled by IANA. Taey can onl be registred with IANA to prevent duplieation. ‘# Dynamic ports. The ports ranging from 4,152 10 65,535 are neither contol nor registered. They can be Used By any proces. Those are the ephemeral ors Ranges Used by Other Systems [Note that other operating systems may use ranges ther than LANA'S for the well known and ephemeral ports. For example, BSD Unix has three ranges: reserved, ‘ephemeral, and nonpiviepe. ‘Well-Known Port for UDP. “Table 11.1 shows some well-known port numbers used by UDB. Some port aunbers can be ured by both UDP and TCP. We wll discuss them when we talk bout TCP in ‘Chapter 12. “Table Wn port ed ith UDP Pr Desion Tho | Bess ace gr bck ea | 7 [ac] Dicer ony dupa arise’ | [Gifts [asia 13 Dryine | Res hdc wl eine T7 | Gee | Returns apt othe 19 | Chargen | Retras aig of charac “3. | Namesener | Domaia Name Service G7 | Bosips | Serverporto dowland bostap infomation | Booine | Chet pore dowsiod Boas information | TeTP | evil ie Taser Procol TH [RPC | Remo Procedure Call | 1s [NTP | Network Tine Protocol [ior | SNM | Simple Newone Managemen Frosl | 162 | SNMP Simple Newark Magen Presa a) a (CHAPTER 11 USER DATAGRAM PROTOCOL (UDP) Socket Addresses ‘As we have seen, UDP necds two idenifes, the IP adress and the port number, at ‘ich endo make «connection, The combination of an IP address anda port umber s led a socket address. Te clint socket adiess defies the client process uiely Jost the server socket address defines the server process uniquely (see Figure 11.6). Figure 1.6 Soc airess rs | ‘Toruse the services of UDP, we ned a pair of socket adresses: the client socket ures and the server socket adress. These four pices of information are par of the IP header and the UDP header, The IP header contains the TP addresses: the UDP ‘adr contin the por numbers 112 USER DATAGRAM UDP pockets, called user datagrams, have @ixed-size header of 8 bytes. Figure 11.7 shows the font of a user datagram Figure 11.7 User dategram format “The fields area follows ‘8 Source port number This isthe prt number used by the process running onthe Source best Kis 16 is lou, which means thatthe por number can range fom © 065335 the source host isthe client (a client sending a request), the port, umber, inst cases isan epemeral port number requested bythe process and SecTiON 113 CHECKSUM 29 chosen by the UDP softvare running on the source host. f the source hosts the server (a server sending 4 response), tbe poet number, in most cases, isa vel: Snow port numb. ‘8 Destination port mumber. This isthe por number used by the peocess unig on ‘he destination host Is also 16 bits long. If the destination hos isthe sere (2 client sending a request) the port number, in most cases, isu wellknown port umber If the destination host isthe client (a server sedi 2 response), the port, umber, in most cates, san ephemeral por umber. In this case the server enpies the epaemeral prt aumberit has received in the request packet, ‘Length. This is 16-bit field that defines the total length of the user datagram, header pus data, The 16 bits can define a total length of Oto 65,53 bytes, How ‘ve, the minimum length is 8 bytes, which indicates a user datagram with only tear and no dts. Therefore the length ofthe data canbe between O and 6,507 (65535 ~20-~8) bytes (20 bytes for IP header and 8 byes for UDP hea. “The length eld in a UDP weer datagram is actualy not mecessay. A ser data ‘ram is encapsulated in an IP datagram. Tere is afield inthe TP datagrats that ‘Sefnes the toallngth, There is another fed inthe TP datagram that dies the length ofthe header Sof we subuact the vale ofthe second field fom the ir, We can dece the length of the UDP datagram thas encapsuted in an TP datagr, ‘UDP length = Peng IP ears nak However, the designers ofthe UDP protocol felt ha it was more eficient fr the fas eer] ie mae —— Sree igi omen —> endo paie) oo] Optional Use of the Checksum ‘The calculation ofthe checksum and iscsi in a user datagram is optional the chocksum is not calculate, the Bld i led With OS. Ono might ask, when the UDP Software on te destination computer receives user dara with a checksum value (Of ze, how ean determine ifthe checks wa not wed or I Wak Sed ad te ‘result happened to be all 05? The answer is very simple If the source does eaeate ‘he checksum and the result happens tobe al Os it must be complemented So wha is Seat isnot ll 0, but all Ts, which is considered negative reo in one's complement arithmetic By (CHAPTER 11 USER DATAGRAM PROTOCOL (UDP) 114 UDP OPERATION ‘UDP uses concepts common tothe transport layer. These concepts wil be discussed ‘ete briefly and then expanded inthe next chapter onthe TCP prosocl Connectiontess Services ‘As mentioned previously, UDP provides a connections service. This means that ech ser datagram sent by UDP is an independent datagram. There is no relationship between the diferent user datagrams even if they ae coming from these source pro es and going tothe same destination program. The wer datagrams ate not numbered. ‘Also, theres no connection establishment and no coaecton erination a the ease for TCP. This means that each user datagram can travel on afferent path, One ofthe raifctions of being connections stat the proces that uses UDP cannot senda stream of data to UDP and expect UDP to chop them into different ‘elated user datagrams. Instead each request most be stall enough of into one weet datagram. Only those processes Senin shor messages should use UDP. Flow and Error Control LUDPis avery simple, unreliable transport protocol. Thee is no low cote and ence 10 window mechanism. The receiver may overflow with incoming messages ‘Tere is no error control mechanism in UDP excep forthe checksum This meens thatthe sender doesnot know if a message hasbeen lost or duplicated. Whe' the receiver detects an error though the checksum, the user datagram i slemly discarded, ‘The lack of fow contol and error coteol means tat the process using UDP. should provide fr thee mechaniss Encapsulation and Decapsulation ‘To send » message from one process to another, the UDP protocol encapsulates and ecapsultes messages (ee Figure 11.10). Encapsulation ‘When 3 process has a message fo send through UDR, it pases the message to UDP slong with a pir of socket adresses and the length of data. UDP receives the data nd sds the UDP header. UDP then passes the user datagram tothe IP withthe socket sarees Pais own head, using the value 17 inthe protocol eld indicating ‘hatte data has come fom the UDP protocol. The IP diagram is then passe to the ‘ata ink layer. The data ink layer receives the IP datagram, add ts own headed possibly a waller), and pases it to the physical layer, The physical layer encodes the bits into cestriel or optical signals and seads it to the remote machine SECTION 114 UDPOPERATION m8 Figure 11.10 Bnsptltion ond decspaation [eee teu EE| moo natn a Despain Decapstation ‘When the message aves atthe destination hos, the physica layer decodes the signals into its and passes 1 the daa Tink layer. The data ink ayer uses the header (andthe tril to chock the data I there is no ere, the header an trailer ae dropped andthe dazagram is passed tothe IP, The IP software des ts own checking, Iter sno enor, the header is dropped andthe user datagram is passed tthe UDP with the sender and receiver IP address, UDP uses the checksum 1o check the entire user datagram, If there so ero, the Header i dropped and the application data along with the sender socket ares Is passed to the roots. The sender socket adres is pase to the ro- ‘ces in casei needs to eespond to te message reesved Queuing ‘We have talked about pots withou discussing the actual implementation of them In [UDP queues are associated with ports (see Figure 11.1) ‘Atthe cient site, when a process stars it requests a port umber from the opes- ing system Some implementations create both an incoming and an outgoing queue ‘sssociated with each process. Other implementations create only an incoming queue _sssocited with each process. ‘Note that even if «process wants to communicate with maltple processes, it ‘bians only one port number and eveatally ene outgoing and oa incoming qo. “The quotes opened ty the cle wre, in ost cass, identified by ephemeral po nutes. “The queves funtion as long asthe proces i running. When the prooess terminates, the queues are destroyed am (CHAPTER 11 USER DATAGRAM PROTOCOL (UDP) igure 1.11 Quewes in UDP ‘The client process can send messages to the outgoing quewe by using the source or number specified in the request. UDP removes the messages one by one and. afer ‘ang the UDP header, delivers them to I. An outgoing qucve can vero. I this happens, the operating system can ask he client process to wait before sending ny more messages, ‘When a message arrives fora clint, UDP chocks to see if an incoming eu has been created forthe port number speci inthe destination port numer Bel ofthe ‘ser datagram, If here is such queve, UDP sends the received user datagram tothe «nd ofthe queue. If there is no such queue, UDP discards the wer diagram and asks the ICMP protocol to send a porr unreachable message tothe serve. Allo the incom. {ing messages for one particular cliem program, whether coming trom the same or & ilferen server are sen othe same queue. Am incoming queue can overflow, I thie happens, UDP drops the user datagram and aks fora por unreachable mesage to be Sent to the server At the server site, the mechanism of creating queues is lifeent. We will ee in ‘acre chapters tht there are different types of serves, However, nits simplest form, & sever ass for incoming and outgoing queues using is wo-known por when it tars ‘unming. The queues remain open slag es the servers rang, ‘When a message uivs fora sere, UDP checks tose ian incoming queue bas besa crested forthe post number specified in the destination port numbed of the user datgram. there is sach a queue, UDP sends the recive se datagram ot end ‘ofthe queve. I there is wo such quewe, UDP discards the wer datagram and asks the ICMP prowcol wo send a port unreachable message tothe cient All ofthe incoming ‘messages for one particule serve, whether coming fom he same or ifferet clint are sent tothe same queue, An incoming que ean overflow I this happens UDP drops ‘he user datagram and ass for «pre ureachable messige to be sent ate cen. ‘When a server wants to respond to a cient, it sends messages to the outgoing 4ueve using the source por number specifi in the request UDP removes the mx. sige one by one, and, afer adding the UDP header, delivers them to IP. An outgoing ‘queue can ovefiow: I tis happens, the operating system ass the serve a wat Before Sending any more messages SECTION ILS USEOF UDP 285, ‘Multiplexing and Demultiplexing {host ruming a TCPAP protocol sut, thee sony one UDP but possibly several pro- ses that may wa ows the services of UDP. To handle this situation, UD? mic Petes and demokplexes ee Figure 1.12) Figure 11.12 Mutiplsing and demux Maltipteving -Aithe sender ste, there may be several process that edt send user dtagran, How: er there is only one UDP. This is a many-1o-one relationship and equites multiplexing. UDP accepts messages from diferent processes, differentiated by ther assigned port ‘wumbers. After ang the header, UDP passes the user dataga othe TP Demultplesing Atte reesver site, there sony one UDP. However, we may have many process hat ‘an receive user datagrams. This i @one-o-many relationship and requires dem Plexing. UDP receives wer datagrams from IP. After ero checking and dropping of the header, UDP delivers each message to the appropriate process based on the port mbes. 1.5 USEOF UDP ‘The following lists some wes ofthe UDP protooa: {8 UDPis suitable fora proces that requires simple request sponse commaication with litle concer for fow and emor conto Iti not usually sed fora ocess ‘tat needs to send bulk da, such as FTP (see Chapter 20), 286 CHAPTER 1. USER DATAGRAM PROTOCOL (UDP) fa UDPisaitble fora process with items Bow and eror-contol mechanisms. For ‘example, the Trivial ile Transfer Protocol (TFTP) (see Chapter 21) proces inclodes flow and ero contro. Kean easily use UDP f& UDP isa suitable transport protocol for multicasting and broadcasting. Multicast ing and broadeasting capabilities ae embeded inthe UDP software but notin the TCP sofware ‘a UDPis used for management processes such as SNMP (se Chapter 23) 1B UDPis sed for some rote updating protocols sch as Routing Information Proto- ol (RIP) (See Chap 13). 11.6 UDP PACKAGE ‘To show how UDP handles the sending and receiving of UDP packets, we present a simple version of the UDP package, "We can say that the UDP package invalves five components: a conto-bock tale, input queues. aconol bck dle, an apa module, and an utp mode. Figure 11.13 shows these Bive components and thei teractions. Figure 113 _ UDP design eee Control-Block Table In our package, UDP has conto block table to keep track of the open pons. Esch ‘entry inthis table has a minim of four fel the tat, which canbe FREE or IN-USE, the proces ID, the pt number, nd the coresponding eve number: SECTION 146 UDP PACKAGE 187 Input Queues ‘Our UDP package uss st of inp queues, one for each process. In this design, We ‘donot use output quewes. Control-Block Module "The conro-bock module i responsible forthe management ofthe control-block ule [When a process tarts, it asks fora port number from the operating system, The opeat= ing system assigns well Anown port aumbers to serves aod ephetneal port numbers to ‘lens, The process passes the process ID andthe pect number 1 the contro-baek ‘nodale to eeate an entry inthe table forthe process. The module des nt create the (queves. The field for queve number value of 20. Note that we have not inclued ‘strategy to deal wih a table hat is full hiss et ban exercise. Cone oe oe Rese ross ID aa pot rab 1. Seach te com! Back bl fora FREE en, 1. (oat foved) 1. Deletan ety sings predefined sty 2. Create se ea With este IN-USE. 2 Ber th process ID an he pon mabe, 2 Ren Input Module The input module receives a wsor datagram from the IP. It searches the conto-b ack table to find an entry having the sate port number a his user datagram, I the en is fours the module uses he information in the entry to enqueue the dat IF he ens ‘ot found, generates an ICMP message Tiare "Reese a aga fom | 1. Lok forte cmesponing entry in tb cont ock table 1. foun) 1. Check the queue eld to se fa quasi alloca 1 If) 1, Alles aque 2, Enquue the dt inthe corespondig gee 2 (oof) 1, Asie CMP mode seo sn “urescable por” mesg. 2, Dice the use datagram. 2. Renn 28 CHAPTER 11 USER DATAGRAM PROTOCOL (DP) Output Module ‘The output module is responsible for ereating and Sending user datagrams. pat Mode ‘Receive da apd ifarmaton from a process 1. Crete a UDP ser datagram, 2, Sen he war stare, 5. Ream, Examples In this section we sbow some examples of how ou package responds to inp a utp ‘The consol: block table atthe stat of our example is shown i Tale 112. Table 1.2 Te cont boc ble a the Being fears “Sate” | Procer ID | Port Member | Queue Number INUsE | 2348 S210 3 TUE | saa [soon rE INUSE | 4a8e =i w wuss { Example 1 ‘Theft ctv she al ofa sr datagram With destaton por our 52.012. The ngt ‘module sere for his pombe a ds 3 Que nomber 3 ha ben esgned os ort, which means tat be por has boa previuay aed, The put ale ends the dato {ues 38. The con lock bl oes at change Example 2 [ier afew seconds, proces sans. Tass the opecting sytem fora port number ad is med pot number 32114 Now te proces ted it ID (4,978) andthe pon ume the ‘omrol-bock module o crete an ent th abe The rodeos the ft FRE ety and inser te infrmation civ. The mole des at alcte a guee this moment eee o> er datagrams ve sive for th destino (ee Table 113), Table 1.3 Couto ie ger cope? [Site [Peer | Fier | One Naor NUS] 245 | s200 = muse [342 | seo TN-use | _4g7s | oie ieuse | _asse_ | 02. = FREE SECTION 117 KEYTERMS 299 Example3 ‘Ae daugram no aves for prt 52.011. The inp mode cecks the bea fins 99 ‘ee a en lated othe ice th she fet ne ae dag as avd fortis destination, The medl reales a quo and vests nner (43) See Table 1. Table 1.4 Con ck afer eumple3 (Sie Pree 1D | Pir Ninbor | Que bor So INURE | 3A | s0TT s Tis | ams] Soe IUSE | “4082S a FREE Examples After fo ssonde, ae datagram anise fo por 52.22. Te ist modal check the table ‘as cnnce ithe cy er this dentin. The wer datagram eopped and request sme {ICMP send an unrachble or menage oe sure Examples Mer fe asonds, «proves needs fo send a wer agra Idler the tt the pat ‘module which a he UDP hear nd send 11.7 KEY TERMS spiction program por number checksum process tient proces 0 process ee ‘sommuniation connectonles, unreliable transport, seudotender riocol gueue ecapslation| registered port dynamic pore server encapsulation socke adeoss ephemeral por ‘wansport ayer erurcontot ser dation Aw con User Datagram Protocol nae (wor) vw knowa port moliplexing ‘CHAPTER 11 USER DATAGRAM PROTOCOL (UDP) 118 SUMMARY UDP sa transport protocol that creates a process toprocess communication UDP is (mostly unreliable and connecionlesspotocl tha requires litle over- nad ad offers fast delivery ln the client-server paradigm, an aplication program on the Local hos, called the ‘lien, needs services from an appicaon program oa the remote hos, called a Each aplicstion program has a unig port number that distinguishes it from ober programs rnning atthe same ie on te same machine ‘The client program is assigned a random port number called the ephemeral port somber, “The server program is sssgned universal port number called a well-known post umber. "TheIANA has specified ranges forthe difercat types of port numbers. The combination ofthe IP address andthe por number, called the socket address, unigbely defines a process anda host UDP requires prof socket adresses: the client socket address and the Server socket adress. The UDP packet is called a user datagram. UDP’ only atemp ater contol isthe checksum. Inclusion of a pseudoheader in chocksum calculations allows source and destina on IP address eros tobe detected UDP has no fow- contol mechanism, ‘A user datagram is encapsulated inthe data eld of an IP datagram. Incoming and outgoing queues hold messages going to and from UDP, UDP uses mulplexng to handle outgoing user datagrams from mulile processes ‘on one hes UDP uses demultiplexing o bundle incoming vser datagrams that go to diferent processes onthe same ost ‘A UDP package can involve five components: a control-block table, a contol block module, input queues an input module, and an outpat movie “Te input queues hold incoming wer datagrams, ‘The contro! block module is responsible fr maintenance of enies in the conta block abe ‘The input module crostes input ques. “The output module sends out user datagrams SECTION 119 PRACTICESET 394 11,9 PRACTICE SET ‘Multiple-Choice Questions 1, UDPis an acronym for_. 8, User Delivery Protocol by, User Datapeam Procedre . User Datagram Protec! 4. Unrciabe Datagsam Protocol 2 Inthe sending computer, UDP receives data unit fom the __ layer. aplication '. ansport oP 4 data ink 3. Inthe sending computer, UDP sends a data nit to he 2 application by transport a data 4. UDP and TCP ae bth _layer poco «physical data ink «network 4. tansport ‘Which of the following Functions does UDP perfor? 9, process-to-process communication 1 host tosost communication end-to-end reliable data detivery 1. allof the shove 6, When the Player ofa receiving hos receives a datagram, 4 delivery is complete 1 aranspot layer protocol takes over aheader is added 4. bande UDP neods the nites to deliver the user datagram to the core pic «ation program. 8 poet ‘application 4. physical ayer cuapreR 11 USER DATAGRAM PROTOCOL LDP) ‘Which is lepal por aes? 20 bss ©, 65.535 allo the above The definition of reliable delivery includes __. enone delivery by receipt ofthe complete mesage «inorder delivery 4. allofthe above ‘Which of the fotiowing does UDP guarantee? 4, onsupticatin of data bs in-onter delivery « emorfiee delivery 4 aang ‘Which ofthe following does UDP guarantee? ‘Sequence numbers on cach wer datagram acknowledgments othe sender «, low cont 1. none of the above Because therein 4. ackrowledgment vial cca elablty 4. data Bow contol The source or adress onthe UDP user datagram head defines 4 the sending computer by the receiving computer «the aplication program ofthe sending computer 4. the aplication program ofthe receiving computer Which of the following isnot part of the UDP user datagram header? length oFheadee source port adress «checksum 4 estiaton port adress ‘UDP s considered 2 connections transport proto 1s. 2». a Secriow 119 PRACTICESeT 38 “The ___ defines the cient program. ‘ephemeral por number 1 IPadaess wellknown port number 4. physical address “The ___defines the server progam. 2 eplemenl port number bb WPadess wellknown por number 4. physical adress the outgoing que of « UDP client overfows, 4. the user datagrams are discarded and por unreachable message is sent, the operating system ass the server o wait before any more messages are sent mow guenes are initited 4 the operating system aks the sien process to wait before any more messages he incoming quoue ofa UDP client overflows, 1 the weer datagram is scared and w port unreachable message is Sent by the operating system ass the server to wait before ay mote messages are sent © mew queves ar intated 4. the operating sytem ask the client 1 wait before any more messuges aes he incoming queue of a UDP sever overfiows, 4 the user datagram is discarded and port unreachable message is seat, bythe operating system asks the server to wait before any more messages are snt now queues ar inited 4. the operating sytem asks he client wo wai before any more messages a sent ‘Which compovent in eur UDP package allocses the ques? 4 contr block module conrl-bock tle © input module output module ‘Which component in oor UDP package communicates with the ICMP software package? 4 cor block module 1 conto block table © input module 44 output module om (CHAPTER 11 USER DATAGRAM PROTOCOL (LDP) 22. Which component in our UDP package sends user dtagrans tthe IP ayer? «.contot-block module ' contol-blck able «input mule 4. output module 23. Which column in the conto-block table contsins information from the UDP header? by proces ID «port number 4. queve number Exercises 24, In cases where reliability i nt of primary importance, UDP would make a good ltansport protocol. Give examples of speci cases. 25, Are both UDP and IP unreliable tothe same degree? Why or why not? 26, Do por adresses nce tobe unique? Why or why not? Why are port adress shorter than IP addresses? 27, What ste dictionary definition ofthe Word ephemeral? How dos it apply tothe concept ofthe ephemeral por number? 28, Show the entries for the header of « UDP user datagram that cates a message ftom a TFTP client oa TFTP server. Fill th checks fel with Os Choose ‘ppropriate ephemeral por number and the coect well-known port nme. The length of datas 40 bytes. Show the UDP packet using the format in Figure 11.7 28, Show the entes for the header of « UDP user datagram that amis a message ‘om an FTP server to an FTP client, Fill the checksum fc with Os. Chose an ppeopiate ephemeral port number and the corect wel port amber, The Jeng of datas 20 byes, Show the UDP packet sing the format in Figure 11.7. 30. Calvlate the checksum for the following binary numbers. Give the rest in binary Use the 16bt format. 0001: 1100001 Yoo00t tt 001001 0010! 0100011 Huimin mantit 31, Caleulate the checksum for the following decimal numbers. Give the eeslt in decimal, Use the 16 format, asstez3 4 32. Calulate the checksum fr the folowing hexadecimal numbers. Give the result in hexadecimal. Use thol6-t format. 7k 9253 12348976 SECTION 119 PRACTICESET 298 433. An SNMP cleat esiding ona host with IP address 122.45.12.7 sends message to tn SNMP server esding ona host wth IPadess 200.112.45.90, What sth pair ‘of sockets used inthis communication? 34, A TETP server residing on a ost with IP address 130.4512.7 sends a message to {TET client residing na host with IP adress 14.90°90.38. What is the pur of| Sockets used i his communication? 35, Whats the minimum size ofa UDP datagram? 36. What isthe maximum size ofa UDP datagram? 37, Whats the minimum sae of the process data that canbe encapsulated in a UDP. datagram? 38. What i the maximum size ofthe process data that can be encapsulated in a UDP agra? 238. A client has a packet of 68,000 bytes, Show how this packet can be transered ‘sing only one UDP ser datagram. 40, A cient uses UDP to send data a serve The datas 16 bytes. Calculate the ft Clency ofthis transmission atthe UDP lve (ati of usefl bytes o total by) 41, Redo the previous exercise calculating the effleieney of transmission att TP level Aste no options forthe IP beader. 42, Redo the previous exercise calculating the ftcency of transmission atthe dat Tink layer. Assume no options forte IP header and use Ethernet a the dat link aye 43. The following i dump of a UDP header in hexadecimal frat (9632000000 1C 2 17 4. What isthe source por number? by Whats the destination pox number? ©. Whats te tal length of the ser datagram’? 4. Whats the length ofthe data? Ie the packet directed from a client to server or vce vert? Whats thecliem process? Programming Exercises 14, Create bead inca l constants tt ou hin we needed io imps {te UDP motes nC. Us theft cece 45. Complete the floning tr elation fr the UDP ese. Sows UDP Header Ensign shor SPonAdie iv 296 CHAPTER 1) USER DATAGRAM PROTOCOL (UDP) 46, Complete fling sn elation for te UDP ser datagram, rnc UDP Packt ‘ ‘struct UDP_Header udpHeader ; . vupDana hs 47. Wit the declaration forthe contro-blosk ent. 48, White the declaration forthe conel-block ible 49, Wht a fneton that accepts a pointe oa UDP packet and a pointer tothe core- sponding IP header The function should calculate and return the vale ofthe checksum for UDP usig the pseudobeader 50. Writ function in Co simulate the eto block modal 51. Write function in Co sim the inp maul 52. Writ function in Cto simulate the output module. PTER 12 Transmission Control Protocol (TCP) ‘The TCPAP protocol suite specifies two protocols forthe transport layer: UDP and ‘TCP. We studi UDP in Chapter 1; we will sty TCP inthis chapter. Figure 12.1 shows the elatioaship of TCP to the other protocols in the TCPIP ‘protocol site, TCP lies betwen the application layer andthe network layer and series "the intermediary between the aplication programs and the network operation. Figure 2A rep prea ate | src) [ [A transport aye protocol usually has several responses. Onc isto cree @ proces-to-process (pro gramto-program) communication; TCP uses port numbers to CUNPTER 12 TRANSMISSION CONTROL PROTOCOL(TCP) accomplish this. Another responsibilty of a transport layer protocol so erate a flow: tnd ertorconte! mechanism a he tanspor level TCP uses a sliding window protocol to achive flow contol. uses the acknowledgment packet time-out and retransmission to achieve err control The transport layer is also responsible for providing connection mechanism for the application progr. The application program sends steams of ata othe transport layer. ts the responibiliyof the wanspat layer ate sending station to make a con- ‘ection with the feceiver, chop the sven) ino uansporable uit, aumiber them, and ‘Sed them one by one. It is he responsibility of the tanspot layer atte receiving end {to wait wn all the different units belonging tothe same application program have sarived, check and pass those that re eer fee, and deliver them tothe receiving appli- ‘ation program as steam. After te ene steam has been Set the transport layer ‘loses the connection, TCP peforns al these ass "TCP is called a convection oriented, reliable ranspot protocol. I sds connection rene and eeliabiiy Features tothe services of I 12.1 PROCESS-T0-PROCESS COMMUNICATION Before we examine TCP, we must frst understand hostfo-host communication and proceso process communication and the diferenoe between them “The IP is responsible for communication st the computer lve (host-o‘hst com munication, As network layer protocol, P can deliver te message only to the dest tation computer However, this san incomplete delivery. The message til needs tobe >and tothe comet aplication program. This is where atanspct ayer protocol such 48 TCP takes over. TCP is responsible for delivery ofthe message to the appropriate {pplication program, Figure 122 shows the scope of duis for IP and TCP. Figure 12.2 TeP eras IP [mee = on = SECTION 12.1, PROCESS-T0-PROCESS COMMUNICATION 29 Port Addresses |As we suid i the previous chapter, proces-o-process communication is achieved ‘rough the cienserver paradigm. "A remote computer may Be running several server programs atthe same ime, A local compute may leo be running one or more cient prograns tte same tine. For ‘communication, we must define the 1m Lecal host ‘= Local clint program ‘a Remote host, wm Remote server program “The localhost and the remote host are defined using IP addresses. To define the cet and server programs, we nee second identifi called port numbers. nthe TCP/IP provocil ut, the pore umber are integers between 0 and 65535, “As mentioned inthe UDP chapter, lent program rennin onthe lea compe fines itself with por nub, chosen randomly by the TCP software running on te localhost. Thies called the ephemeral port number "The server program, ning on he rernode compte. must also define itself witha pot number. Ax lzo mentioned in the UDP chapter, the server uses well-nown pert yumbers Foe example, in Figure 12.3 the TELNET clicot program uses an ephemera (Cemporary) por number of 64,295 to ident itself, wheeas the TELNET server pro ramalways uses the well-known (permanent ort number 23 Figure 123 Port munbers a ‘Tle 12.1 lists some well-known port numbers used by TCP ‘Table 12.1 Wet tnown por ase by TCP [for [Pret Dao 7 [Bas | er arecod dpa ak i [Diesel | Dis ay dap dated T [tes [Aeneas [Dayne [Rese ail ie TT ese [Reus ame ote 30 CHAPTER 12 TRANSMISSION CONTROL PROTOCOL (TCP) ‘Table 121 wil Anown ports sed by TCP (continue) [Per] Description Rewms sing of chances Fie Tanife Procol ats azn) ie Taner Protocol (comolconeti Terminal Nework ‘Simple Mai Trier Potee Domain Name Serer ot | BooTe | Bowsuap Pemea! 79 | Finger | Finger 30 | HTP | Hypereat Taser Prot it [ere Remote Prosar Cll, Socket Addresses Similar UDR, TCP also needs two identifiers, the TP address and port number, for each end to make a connection. The combination of an IP address end port number is called a socket address. To use the services of TCP (or UDP), we need a palr of Socket addresses: client socket addres and server socket ares. Te elie sosket address defines the client application program uniquely. The server socket sess defines the server aplication program tniguely. These four pices of information sre Partof the IP header and the TCP header. The IP header contains the IP aesses the TTCP header contains the por numbers 12.2. TCP SERVICES Before discussing the operation of TCP, let us explain the services offered by TCP to ‘the processes atthe application ayer, Stream Delivery Service TR, unlike UDP is a steam oriented protocol. In UDP, «process (a aplication pro- ram) sends achank of bytes othe UDP for delivery. UDP ad ison header to this ‘shank of data, whichis pow called a datagram, and delivers it othe IP for transmis sion. Ta process may deliver several chunks of dats to the UDR, but UDP treats ach ‘hunk independently without ecing any connoction between ther TCP, on the other hand, allows the sending proces to deliver ta as wsraun of bytes and the receiving process to obain data as stream of bytes. TCP crests an «environment in which the two processes seem to be connected bya imaginary “tube” ‘that caries their data across the Internet. This imaginary envionment is depicted ia SECTION 122 TePSERVICES 301 Figure 124, The sending proces produces the stream of bytes and the receiving pro igure 124 Sream diners Sending and Receiving Busters Because the sending and the reciving processes may not produce and consume data at the same speed, TEP ness bufers for storage, There are two bulfers, the sexding butler andthe receiving bute, fr each diection. (We wll see later that these baer fe also used info and err-ontol mechanisms used by TCP) One way to imple- ‘ment ble isto sea citclar aay of -byle locations a show in Figure 125. For ‘Smplcty, we have shown two buffers of 20 bytes each; normally the bers are hun- {reds or thousands of bytes, depending onthe implementation, We aso show the but- ters asthe same sie, whichis not always he eas. Figure 125. Sending and eens bors ean wobenes a Tiere Reng The figure sows the movement ofthe data in one dreton. At the sending ste the buf as three types of locations. The white section contains empty oration th am (CHAPTER 12 TRANSMISSION CONTROL PROTOCOL (TCP) ‘can be filled by the sending process (producer). The gray area holds byes that have been sent but not yet acknowledged. TCP keeps these bytes in the buffer until it receives an acknowledgment. The colored area are bytes tbe sent by the ending TCP. However, as we wll se ltr in his chapter, TCP maybe able wo send ony par of tis colored section. This ould be duo to the slowness ofthe receiving process or perhaps to congestion inthe network. Also note that after the bytes inthe gray locations are acknowledge the location is recycled and available for use by the sending process. “This why we show aceular buller ‘The operation ofthe buffer at the receiver site is simpler, The circular buffer i pessstence © keepaive 4 timo-waited 25. The timer is used inthe termination phase, persistence © keepalive 4. time-waitd 26, The __ timer keeps track ofthe time between the sending ofa scgmen: and ‘he receipt ofan acknowledgment, 1 persistence © keepalive 4. time-waitd 27, Aserver issues, 4 an active: passive > apussive:an ative © an ephemeral wsl-nown, 4. awellknown: an ephemeral 28. Connection establishment involves & involvesa_—_—_handshaks, & one-way; wo.way two-way; threesway three-way; three-way 4. three-way: four-way 29. Inthe tae the serve is waiting forthe application to close 2. CLOSED ». ESTABLISHED © CLOSE. WAIT 4. LASTACK 30. tn the __ state, the server is inthe dst transfer state an ean recive and send dita 4. ESTABLISHED LISTEN © TRANSFER. 4 OPEN ‘open while a clent issues —_ open, handshake; connection termination a8 (CHAPTER 12. TRANSMISSION CONTROL PROTOCOL (TCP) S31. After the server TCP receives a passive open request from the sever application progr it goes othe sate a CLOSED 1 LISTEN ©, SYN-RCVD 4. ESTABLISHED 32. After the client TCP receives an active open request from the client aplication rogram. it goes tothe state, CLOSED ». FINWATT © SYNSENT. 4. ESTABLISHED 33. Inthe state the client TCP has closed is connetion wo the serve 2. CLOSED b FIN-WAITH «, FIN.WAIT2 4. ESTABLISHED 34. Inthe _sate, the lent TCP wats for an ACK segment a. CLOSED 1b FINWAIEL ¢ FINWAIT2 4 ESTABLISHED 35, A special segment called a probe i set by sending TCP when the simer goes of persistence & keepatve 4. time-waited Exercises 436, TCP sends segment at $:3%20, Ke recive the seknowledpment at 53025. What [ste new value for RTT ifthe previous RTT was 4 seconds? 37. TCP sends a segment at 4:30:20, It does not receive an acknowledgment. At 443025, it reeansmits the previous segment. It receives an acknowledgment at 1430227. Whats the new value for RTT according to Kar’ algcithm ifthe previ us RTT was 4 saconds? 38. What isthe maximum size ofthe TCP header? 538. Whacis the minimum size ofthe TCP header? 40. IF the value of HLEN is O111, how many bytes of option are included in the segment? 4h 45, “6 48 . si 32 SECTION 1218 PRICTICESET 9 ‘What can you say about the TCP sepment in which the valu of the conto es fe ofthe following 000000 oon01 , 010001 4, 000100 000010 #010010 ‘The contro eld ina TCP segment i 6 bits We can have 64 diferent combine sions of its, How many of hese combinations do you think are valid?” TCP opens connection wing a inital soqueace number (ISN) of 145%. The “other party opens the connection with an ISN of 21,732, Show the tree TC? seg ‘ments daring the connection establishment, Following he previous exercise, show the contents of he segments during the data transmission ifthe intator sends a segment continng the message "ele Dest CCastomer” snd the other party answers wih a segment containing "Hi There Seller” Following the previous vo exercises. show the contents ofthe semen uring the connection feminaton. ‘TCP is serine data at 1 megabyte pee seond (8 Mbps. Ihe sequence namber stent with 7,000, how lon does it ake before the sequence number goes fuck to 'ATTCP connetion is sing a window size of 10,000 bytes and the previo acto ‘dgment umber was 22,001. Te eceves a sepment with acknowledge number 224001, Draw a digram to show te station of he window before and ate. Redo exeiie 47 if the receiver has change the window size to 11,0, Reso excise 7 ifthe roceiver has changed the window size to 90.000, In exercise 47, how Tow can the receiver decrease the window size? [A'TCP connection inthe ESTABLISHED slate The following events occur ne ser another 2. AFIN sepment is received ‘The application sends “close” message. What is the state ofthe connection after each event? What sth action afer each 'A'TCP connection i inthe ESTABLISHED state. The following events coeur one ster another: 2 The aplication tends a “lose” message. bs. An ACK segment is receive ‘What is the sate ofthe connoction afer each event? What isthe ation ater each 2 carrer 12 53 5s, 5, sr 58 59. ‘TRANSMISSION CONTROL PROTOCO:.:FCP) ‘A TCP connection is in the SYN-RCVD state, The following events occur one iter another: 4. The aplication sends a “close” message. 1b AFIN sepmentisrcived. ‘What the state ofthe connection after each event? What isthe ation after cach A TCP connection i inthe SYN.SENT state The folowing events occur one after soother: a. ASYNSACK segments received A ele” message is eesived. ‘What ste stat of the connection after each event? What isthe action after each A TCP connection is in the FIN-WATT state, The following evens occur one after another: 2. ANACK sepment is rosie bb ABFINsepmeat is rseved. «Timeout occu, ‘What isthe state ofthe connection afer each event? What i the action after cach Show the entries forthe header of TCP segment that cries a message fom a FTP client toa FTP server Fill th checksum field with Os. Choose an appropiate «phemeral por number and the coreet well-known port number. The length of data is 20 byes, A cient ses TCP o send data oa server. The data 6 byes Calculate the ef ‘ency ofthis transmission athe TCP evel (rai of useful bytes to ol bytes Redo the previous exercise calculating the efficiency of transmission at the IP level. Assume o opis forthe IP heuer. Redo the previous exercise calulting the efficiency of transmission a the data link layer Assume no options fr the IP hesder and use Everett the data ink layer ‘The following sa dump ofa TCP header in hexadecimal format (05220017 aooo001oteo0000 so on90000) 4 Whats he soure port mune? 'b What the destination port umber? «What he sequence number? 4. Wht the acknowledgment number? Whats the length of the header? 1 Whats the typeof the segment? 1. Whats the window size? SECTION 12.18 PRACTICESET 354 Programming Exercises 61, Create ahead filet inch al constants that you think ae needed o implement the TCP modules in C. Use the eine dicts. £62, Complete the following struct declaration forthe TCP header. struct TCP Header t Unsigned short SPonAddr ; i 63. Complete the following struct declaration for he TCP segment struct TCP Segment t struct TCP_Header tepHeader ‘epDuta 1 64, White the declaration forthe TCBs (65, Write function i Ct sme the mai node o ER 13 Routing Protocols (RIP, OSPF, and BGP) ‘An interes combination of networks connected by routers, When a datagram oes from a noure wo a destination, will probably pass through many routers ani it reaches the router attached tothe destiaton nework 'A router receives a paskot from 4 network and passes it to another network. A router is sualy attached to several neworks, Whea it receives a packet, 0 whith net ‘work should i pass the packet? The decision is based on opinlzaion: Which of the ‘alll pathvay’ ste opiroom pathway”? vA metric is 4 cost asigne for passing through nctwork, The toa metric of @ panculr rote is equal fo the sum ofthe meres of networks that comprise the owe, "Router chooses the route with the shortest (sles) mete. "The merc asigned to each network depends o the typeof protocol. Some simple proocols ike te Routing Information Protocol (RIP) teat each network as «ata ‘The com of passing through each network is the sims it sone hop count. So if & psket posses throigh 10 networks to reach th destination, the total cost is 10 hop ‘Oier protocols. such as Open Shortest Path Fist (OSPF), allow the administrator to assign a cst foe psig trough a network hised on the type of service requ. A ‘eat through a network can fave different costs (ets). For example, if maximum tlroasiput ste desired type of sevice, sete ink has a lower metre han Ber ‘optic line. On theater hand, if minim delay is he ested type of serie. ber ‘ple line has a lower etre than a satellite ine. OSPF allows each router have sev= tral outing tables based on he required type of service Diter protocols define te metic totally dlferemy Inthe border gateway rotaeol (BGP), ih erierion is the policy, which canbe set by the administrator. Te policy ‘defines what pats shouldbe chose, "Whatever te metic, a outer should have outing table to cons when packet is seats forwarded, The outing table species the opium path for the packet. However the lable an be either static oF aie. A state able is one ti is not changed frequen. A dynamic table, onthe the band, sone ta is updated antomat- Eup wen tere isu shorge somewhere Lathe Sgernet Thy, an internet needs a (CHAPTER 12. ROUTING PROTOCOLS (RIP, OSPF. AND BGP) tyne routing tables. Te tables need o be updated as sk 2 thre 2 change in the mre. For instance, hey need to be updated when a route is down, and they need to be updated whenever a beter ross been created "Routing protocols have been created i respons tothe demand! for dynamic out= ing tables. A routing pracol combination of rules and procedures that ets rates in the internet inform each ther of changes. I allows routers to share whatever they [know bout the intemet or ther neighborhood. The sharing of information allows a router in San Francia to know about the failure ofa network in Texas. The routing protocols also include procedures for combining information received from other rovers Tn this chapter we discus unicast routing protocols. Multicast routing protocols wll be ciscussed inthe next chaps. 13.1 INTERIOR AND EXTERIOR ROUTING. “Tsay, an internet can be 30 large that one routing protocol cannot handle the task of “apdating toting ables of al routers. For his reason, an internets vided into auton ‘mous systems. An Antonomous System (AS) sa group of networks and routers under {he authority of single administation. Routing inside an autonomous system is Iefered toa interior routing, Roting between autonomous systems is efered to as fxerior rowing. Each satonomous sytem can choose an interior rooting protocol 19 handle routing Inside te autonomous sytem, However, oly one exterior outing pro- tocol ie usally chosen to handle outing between aionimons systems. ‘Sever iatrior an exterior routing protocols are in we. In his chapter, we cover ‘only the moet pop ones, We discus two itrioe rating protocols, RIP and OSPF, tnd one exterior routing protecol, BOP (se Figure 13.1), Figure 131 Ppa rowing proentr em | Tree Eee IP and OSPF can be asd to update routing tables inside an autonomous se [ROP can be used update routing ables for rout th oan the auzonorons stems > spenoy 132 RiP 368 In Figure 13.2, outers RI, R2,R3, and R¢ use an interceand an exerio renting proaco, The oer votes use ony ier routing poocols. The sch nes sbow the communication between routers tha se ever routing protocols, The broken thick lines show the communication between te routers that Use an extedor rating ‘prvocol Figure 132. Adonomos systems 13.2. RIP ‘The routing information protocol isn interior outing protocol used inside an aono- rnows syste Tris very simple protocol based on distance vector mourn, which ses the Befiman Ford algortnn for alelating the toting tables. In this section, we fist dy the principle of distance vector eouting as its applied vo RIP, and then cscs {he RIP protocol sl Distance Vector Routing In distance vector routing, each outer periodically shares its knowledge shi he ‘ute fnemnet with ts neighbor. The deze kos 29 uadertnding By this agit ‘works are a olows |. Sharing knewtdg> about the ctre autonomous system, Each router share its knowledge shot ths sre autonomous system wih its neighbors. At he onset a rontu'sEnoaedge may be sparse, How inuch i knows, however, is unimportant isan whatever has. 2, Shaving only wth ighburs. Bac: router sends its Tesends whatever Fnowledge ts tzough al ofits interfaces, 3. Shaving at regular intervals, Esch outer Sends its knowledge tis fixed interval, for example, every 05 386 CHAPTER13. ROUTINi PROTOCOLS IF OSPR AND AGP) Routing Tadic Every router keeps a routing table that has one entry for ea destination network of Which the router is aware. The entry consist ofthe destination nctwork adres, the shores distance o reach the destination in hop coun, and the next hop (Ae rou) to wi the packet should he delivered to reach its fal destination The hop counts the numberof networks a packet encounters o reach sina destnation, “The table my conta ote information sacha the subnet mask (or pref) othe ‘ime this entry was lst updated. Table 13.1 shows ab example of a outing table Tble 131 A isance vein rating ble ((Birtanon | Hop Come | Wr ep | Oe nation | Taso | 7 [radasa | [issiso Ps resi [iewasoo [4 [ons (iisooo [6 stars [RIP Updating Algorithm ‘The outing table i updated upon receipe of RIP response message. The following shows the updating algorithm usod by RIP. Bg Tie Tae TS {UA ep oe eiton 2 Rate lw por eed enon 1 sino tne ing te) {Adtran 2 me 1 (tt fils be ae 1 Repl ny ne a i te aid one 2 Ble 1 Washed soma oae Regen in we Lum In Figure 133 a router receives a RIP message from router C. "The messi iss sims areca nao TE Nake perme SECTION 133 OSPF 377 ‘Types of Packets ‘OSPF uses five diferent types of packets: the hello packet, database description packet link state request pack, link state update packet, and link state acknowledgment Packet (se Figure 13.33 Figure 1333, Types of OSPF pokes = cree_| |_‘Rs animes Packet Format Al OSPF packets share the supe common heade (See Figure 13.3). Before tying the diferent ypes of packets, lt ws talk about this common hex. ‘& Version. This bt fi defines the version ofthe OSPF protocol. Ii comely version ‘= Type. This S-bit ltd desnes the type ofthe packet. AS we sid before, we have fie ype, with values [oS defining the pes. ‘= Message length. This 16-bit eld doins the length ofthe toa message inclucing the eader 18 Source router IP address. This 32-i eld defines the IP ads of the roster ‘hat sends the packet, Figure 1334 OSPF pacts healer ™ (CHAPTER 13, ROUTING PROTOCOLS (RIP OSPE AND BOP) 1 Area identiation, This 32-bi fel defines the area within which the rowing takes place. ‘8 Checksum, This lds usd fr ero detection on the entire packet excluding the sutheatcation type abd sutbenteaion data Held 1% Authentication type. This 16-bit eld defines the autentcation method wed in this are, Athi time, two types of autbeascation are defined 0 for nove and I for password '= Authentication. This 64-bit fie the acta valu of the authentication data. In the future, when more authentication types are defined, tis Held wil contain the result of the authentication calculation. For now, ifthe suhentcaton type is, his ‘elds ld with 0s. Ihe type i 1, his eld aries ao elt character password Hello Message (OSPF uses the hello message to create neighborhood relationships and to test the ‘reachability of nighbors. This isthe is step in ink state routing. Before a router can ood al ofthe eer outers with information abouts neighbors, it mas ist greets seighbors. I-mst know if they are alive, and it must know if they are reachable see Figure 13.35) 1k Network mask, This 32-bit fold defines the network mask ofthe network over which dhe belo message is sen. ‘2 Hello interval. This 16it fell defies the umber of seconds between hello messages ‘© E flag This isa F-bit ag. When it is se, it means that the area stu area. f=) Tila. This isa I-bit ag. When tis st it means thatthe router suppsts multiple ‘= Priority. This fd defines the priory of the router. The proity is wed forthe selection ofthe designated router After all neighbors declare ther priorities, ‘he router with the highest roti chosen a the designated roster. The oe with the second highest pry is chosen the backup designated rvter I the vale ike gate eae ss | Been st SECTION 123 asrr 39 ofthis felis, it means thatthe router never Want 10 bea designated or backup dssignated rower. ‘= Dead interval. This 32-bit Geld defines the umber of seconds before roster assumes tha a neighbor i dead. {© Designated router BP addres. This 32-bit elds the IP address ofthe designate rove forthe network over which the message sent. 1 Backup designated router IP address. This 32-it Feld is the IP addres ofthe backup designated rota forthe network over which the message eset 18 Nelghbor IP addres. This is» repeated 32-bit Held that defines the routes tt have agred tobe the neighbors ofthe sending router. In the Words, is acurent ist ofall he neighbors from which the sending router has received the halo message Database Description Message ‘When a outer is comected tothe system forthe ist ime aftr afl it eed the complete link st daubave immediatly [cana wat for al Tink sate update pactets ‘@ come fom every other router before making sown dbase a eleuaing is me ing able. Therefore fer 2 router is eomectd othe nyt, i sens ello packes to ret its eigbors If hie the ist time tht the neighbors er fom the route, ey Senda database description pucket. The databse description packet does not consin complete database information; only gives an ouine, he ide of each lin inthe is ‘ase. The wy canocted outer examines the tie ad finds ot which ies of for ‘mation it doesnot have. I then sends oe or more link ate request packets to gt all information about that paula ink. When two routers want fo exchange database escrption packets, one of them takes the role of master andthe che he rl of sve. [Becanse the message ca be very lig the contrs ofthe database canbe divide into scveral messages. Te forma ofthe database desertion paces shown a Fg 1336. ‘The Bes ses follows 1©E flag This Ibi gis set to 1 if the advertising router i an atonomas born ary router (E stands for extra. Wty This it gist to ifthe advertising routers amare border rout, Figure 13.36, Dasaaze descrnion poster (CHAPTER 13. ROUTING PROTOCOLS (RI, OSPR AND HGP) 1m Tilag, This 1-bit eld, the iializavion fog, i set © 1 ifthe message is the fst message. ‘5 Miing This bit eld the more ag, is Seto 1 ifthis isnot the last message {MAS flag This Lit eld, the masterslave bil indicates the erg of the packet: raster (WS = 1 orslave MUS =), |= Message sequence number. Mis 32-bit eld contin the sequence numberof te message. tis used to match request with he respons. 1m LSA header. This 20-bye fed is use in each LSA. The format ofthis header i dlscussed inthe Kink state update message section. Ths header gives the outline of cach ink, without deals is repeated foreach ink in the ink state database. Link State Request Packet ‘The format of the lnk state request packet is shown in Figur 13.37, This is packet that i sent by a router that eds information abot specific route or routes, es answered witha ink state update packet Tt can be used by a newly connected route 9 ‘equest more informition about some routes afer receiving the database description picket. The the elds here ace prt ofthe LSA header which we will se shor Each St ofthe thee feds sa request fr one single LSA. The set is repeated if more than cone advertisement is desired igure 1337 List sare guest packs ‘The ink state update pocket isthe her ofthe OSPF operation, It is wed by a route to avenise the states of it lnks. The general format of the link state update packet is Shown in Figure 13.38, Each update packet may contain several different LSAs. Far Figure 13.38 Link stewed pacer SECTION 33. OSPF 364 ‘exanple, lnk state update packet can contin 14 LSAs, fur of which are rater ink ‘advertisements, three of which are network ink advisement, wo of whch are m= mary ink to network advertisements, two of which are summary link to AS bury outer advertisements, and three of which are external link advertisements, Te lds saws follows: "= Number of advertieiments. This 32-bit fed defines the umber of sdvesse- ‘ments. One packet can adverts the snes of several inks, 12 Link tte advertisement. There are ive diferent LSA, we discussed before all having the same header fora, bt diferent bodies, We St dca the gencal ear common alo thm. The format ofthe SA hers shown in igure 13.39. Figure 13.39 184 header et eae az ‘5 Link state age. This il indicates the numberof sconds elapsed since tis mes ‘sage was first generated. Recall tha this ype of messge goes fom outer oruter (looding) When a route ereues the message, the vale of thie fields 0. Ween ‘ach successive rote forwards this message, eximates the ans time and as ‘tothe cumplaive vale ofthis eld 1& Eig, 1s bit ag is sto 1, treans thatthe are isa sub area, A stub aes {san aea hats connected to the backbone area by only one path, (mT flag. 1 tis L-bic Magis Seto 1, means that he couter can handle wltpe lypes of service, ‘= Link state type. This field defies the LSA type. As we discussed before, there ae five diferent advisement types: outer ink (1), network ink (2), summary Unk ‘to network (3), summary link to AS Boundary route (4, and exter link (5). ‘8 Link state 1D. The value of this field depends on the typ of lnk. For type (over Tink, isthe TP address of the rater, Fr type 2aetwork link), its theP adress ofthe designated router. For type 3 (summary link to network), is the aes ofthe network. Foc ype 4 (summary link to AS boundary router), it is the IP address of de AS boundary router For type 5 (externa ink) it isthe adres ofthe exteraa nework. (a Advertising router Thic ic the IP arse of the router orcing thie mesg = Link state sequence number. This isa sequence number assign t eich lnk state update message. ‘381 CHAPTER 1 ROUTING PROTOCOLS RP OSPF AND BGP) ‘a Linkstate checksum. Thisis not the usual checksum fei. fuses a special check ‘um calalation called Flescher's checksum, which is based on the whole packet except forthe age fd. ‘8 Length. This defines the length ofthe whole packet n byes. Router Link LSA. ‘The roster link LSA advertises all ofthe links of «router (rue rote) The fem ofthe outer ink packets shown in Figure 1340, The feds of he roster fink LSA areas fllows fb Link ID. The valu of this fed depends on the typeof link Table 133 shows the ferent ik entifcacions based on link type 18 Link data Thiel gives alitonl information about the nk. Again, the valve L ‘= Option parameter length. The open message may also contain some option parameters Ifo, this -bye field defines the lng ofthe total option params. ‘there ae no option parameter, the valve ofthis fields zero ‘© Option parameters. Ifthe value of the option parameter length isnot eo, it means that thee are vor option parameters. Fach opion parameter ise has 10 ‘ubfields the length ofthe parameter and the parameter value. The only option parameter defined so fr is authentication, Update Message “The up message isthe heat of the BGP protocol. Its use by outer to witha esinations tat have been advertised previously, announce a route 0 new destia- tion or bth. Note that BGP can withde several destinations that were adveried ‘foe, butt can only advertise ope new destination i format ofthe update message is shown in Figure 13.54. Figure 13584 Updaemesrage “The update message fl ner Hite elon ‘= Unfeasble routes length, This 2-bye Geld defines the lent of te next ik {Withdrawn routes. This ld ists all the routes tht shoud he deleted from the previously advertised is. 1m Path attributes length, This 2-byte Sed defines the length ofthe nest eld. 22 CIIAPTERI3 ROUTING PROTOCOLS uP OSPR AND BGP) ‘= Path atributes, This fel defines the abats ofthe path (rout) to the network ‘whose reachability being soenced in this message 1m Network layer reachability information (NLR. This el defines the network ‘hats setually advertised by ths message. I as a length feld and an IP adress ‘refi. The length defines the number of bits inthe pei, The prefix defines the common par ofthe network adress For example if the network i 153.18.7.02. ‘The length of the prefix i 24 and the prefix i 1538.7. This means tat BGP apport classless addressing and CIDR ‘HGP appr lates aren a CDR. ‘Keepalive Message ‘The routers (called peers in BGP parance), msing the BGP prsocos, exchange keep alive messages replay (before thee had ime expzes) to tell each other hat they ae ‘ive. The Kepalive message consists of oly the common header shown in Figure 13.5, Figure 1355. Kecalnemesiase Notification Mesage ‘A notification message is sot by a route whenever an ero condition is detected or 2 router wane o clase the coanecton, The ort ofthe messages shown in Figure 1336. SECTION 134 BGP 39 ‘Te fells comprising the noifcaton message fallow: 1& Error code This [byte field defines the category ofthe ero, See Table 13.5 ‘8 Error subcode. This -be field further defines the type of erin eat etegr: ‘8 Error data. This le can be used to give more diagnostic information about the Table IBS Forces Tew tole wie Deron Daron 7] agen nar Ts dic et laa Tree pero | Shas ng Gant map| a al rer eeqped mani | pens @veenaPuente a. | Spore epsonlpenmens), | senda eh entemcrie | tot ne ees 7] Uilarasmagona | Ee die basa Gl ori feel peter lor ata | Staci wale lime aig | siti wt Oh ree tr oer Gyatentlngh eee (crise ‘tae AS\ rong ln ial et Reanim ata ee | (ya ster (1 aed | ssanita. 7 Water pst | Nosh ei "5 Fn se macne | Tis eine ie procedural eroe Nowabonse oe ead. " © [eee ‘Nobo Stnd Encapsulation [BGP messages ar enepsated in TCP segment wing the we-Anown pot 179. This means that ther tno noe for er coat and Mow contol When a TCP connection fs opened, the exchange of update, haepulie, and nication messages is comted ‘ntl a notification message of tye ease sent, 3M CHAPTER13. ROUTING PROTOCOLS HUF OSPR AND BGP) 13.5 KEY TERMS area border outer sa identification autheacation aulosomous system (AS) autonomoes system boundary router Ickbone router Bellman Ford slgritim border gateway protocol (BGP) atbase description message ead imerval eld Dips slgoritm Aisxance vector multicast routing rotcol (DVMRP) Aistance vector routing cocapsulation| expiration timer exterior outing cexteral in extemal link LSA ‘ooding sage collection Hiner elo inter hello message hop count Jimte autonomous routing protocol simeroe routing ‘cepalive message link sate acknowledgment packet link state advertisement (LSA) tink state database ink state request packer link state rousing Tink state update packet MBONE rmulicasting network ink LSA neswork mink nexthop adress otifaton message ‘pea message ‘open shortest path it (OSPF) tional atsitate packet path vector rousing peso imer| poine-o-point ransmission poison reverse policy rating RIP? ute ink LSA, ting information protocol (RIP) routing ble sow convergence solicited response split horizon stati outing table SECTION 146 SUMMARY 95 stu nk triggered update process suet mask nsoiited response ‘summary ak to AS boundary spate message ‘ster LSA aaa summary ink to network LSA well-known atibute transient ik 136 SUMMARY 1B Americ isthe cost assigned for pasage of a packet throughs network ‘8A router consults its routing table wo determine the best path for packet. '= An autooomous system (AS) is group of networks and routers under the author iy of single administration, '© RIP and OSPF ae poplar interior outing protocols sed to update outing tables inan AS, ‘5 RIP is based om distance vector routing, in which each rouer share, at regula Irv, knowledge about the entire AS with is aeghbors. 18 ARUP routing able entry consis of «destination network ads, the hop count ‘o hat dostinaton, and the IP adress of the next route. ‘= RIP uses thee timers: the periodic timer contos the adverising of the update message, the expzaion tines govems the validity ofa roe, and the garbage col lection mer advertises te far of route ‘= Two shoncomings associated with the RIP protocol are slow convergence and inatabilig, 12 Procedures to cemedy RIP insabily inlodewiggered upéat, split horizons, an poison reverse 1m The RIP version 2 pocket format contains fei carrying AS iaformation and suthencation information 1 OSPF alvides an AS into areas, tied as collections of networks, hos, and |= OSPF is based on ink stat outing in which each router sends the state eis neighborhood to every eter router nthe area. pk is sent only i there is ‘change in the neighbebood '= OSPF defines four ypes of tnks (networks) point-to-point, transla, sub, and vi 1m Five types of link state advertisements (LSAS) disperse information in OSPF: router nk etork ak. summary Tink to network, summary link to AS boundary ‘outer, and externa Kink fA router compiles all the information from she LSAS it receives ino a ink tate ‘duabase, This database is common to al outers in anaes. ‘8 OSPF rowing tables are calculated using Dijsu's agora, (CHAPTER 13. ROUTING PROTOCOLS (RIF, OSPR AND BGP) 1= There are five types of OSPF packets: hello, database description, link state request link tate update and lnk sate acknowledgment. fm ABLSA isa mali etry ina ink state update packet. {5 BGP is an inter autonomous system routing protocol used to update outing tables ‘& BGP is based on a routing method calld pth vector routing, In this method, the Ss through which a packet must pats are explicilylitd. 18 Pat vector outing des not have the instability noe looping problems of distance ‘estorroutng. 18 There are four types of BGP messages: open, update, keepalive, and notieation, 13.7 PRACTICE SET Maltipte-Choice Questions 1, RIPis based on 1 lnk tate routing 1 distance vector outing , Dikst’s algorithm 4. path vector outing 2, Instance vector routing each router receives information diet from 4. every router on the network every router ss han wo units away able stored by he network host ts eighbors only 3. Indlstance vector routing a outer sends ut information. 4. atregualy schedleitervais 1 only when thee change in its able «only when anew hosts added 4. only when anew network is aded 4 A routing table cotains 1 the destination network ID ‘the hop coun to each the network the router ID ofthe next hop 4 allof he above 5, Router B receives an update from router A that indicates Net is two hops away, ‘The nest update from A says Nets five hope sway. Wha vale is ened in B's roating tale for Not? Assome the basic RIP is being wed, 22 b3 6 a7 SECTION 137 PRACTICE SET 399 ube roating table contains four new entries, how many update messages mas the roster sent is ane neighbor ater? a be a3 a4 ‘Thehop count eld ofa router's ist able aways has 2 value of 20 bt «infty 4. some positive integer ‘Which eine RIP message contains the message type? . command » vesion «network address 4. distance ‘Which etd in the RIP message comesponds to the cos field of the ruting tbe? 2, command version 5 notwork adress 4. distance ‘Which eld in the RIP mescape correspond to the network ID field of he routing table? 4 command version .atwork adress 4, distance Which mer scbedles the sending ot of regular update messages? a. periodic 1s expiration «garbage collection 4 bande Which imer can set the distance eld 16? a. perogie 1 expication garbage collection 396 CHAPTER IS 3 15 1. 18 18, ROUTING PROTOCOLS RIP, OSPF AND BG) ‘A periodic update message goes out time =37 5. A twiggeed update follows at 7s Assuming period of 30. when des th next regular periodic update message g0 out? A. at some random tine ater 575 ‘Which ofthe follwing amps to alleviate the slow convergence problea? {4 op count iit '.wiggered update loping 4 aandb Which of the following features the immediate seading of an update when & change occurs? 2 bop count init a. wiggered update «split horzons poison reverse ‘Which ofthe folowing set an ouigoing distance field to 16 fr networks which previously sen incoming information dough the sare interface? | op count iit 1 tggered updite «. splithorzens 4. poison reverse “Which of te following does nt allow the sending of information about the same oswork through he sae interface? {hop coun iit , tggered update « splithorizens poison reverse Discs lgoithm is used to f. create LSAS ', flood an internet with information «calculate the outing tables (crete a ink sate database ‘Anareais__ prt ofan AS ‘composed of atleast wo ASS another erm for an ntemet 4. acalleson of sub areas Ey n. 26. SecTiow 137 PRACTICE SET 38 nan autonomous sytem with maress, how many areas ae connected othe Back tone? at bane are An ate border router canbe connected 0 2 only anotber router by another route or another network only anotber newark 4. only sncter are border ute ‘Which ofthe flloring sll has the least numberof connections to other ares? an autonomous systern transient Link 4 asub ink Which type of network using the OSPF protocol ahvays consists of just 19 oo nected outers? 1 point-o-point bs tmsient, ©. sb 4. viral ‘Which typeof network using the OSPF protocol i the result ofa break ina ink between oo rote? 2 point-o-pint tnsiont ab 4. viral “Which spe of network using the OSPF protocol cun have five routes ataced to wv | pointto-point teaasient, ©. 9b 4. allofthe above 'A WAN sing the OSPF protocol tat connects wo routers isan example of 3 bp of OSPF network: ‘point-to-point transient «stub vial 0 CHAPTER 13 2. 28 vs. 20. a, 33 ROUTING PROTOCOLS (Ri, OSPR AND BGP) An Biheret LAN nsing the OSPF protocol wih five ached routers canbe called 4 network. ‘2. pointio-pint , uansient stub vial Which ayer produces he OSPF messige? dam ink network «transport 4. apotication ‘Which OSPF pocket foods the Internet wit information to pst the database? a link state reyuest message by ink state upare message « link state acknowledgment message 4. duabase description message ‘Which typeof OSPF message must beset peor the others? hello message by link ste acknowledgment message «link state request message 4, database deserpton message ‘Which IP addres is ncded inthe ello message? 1 designated routes ‘backup designate router «, peighbor outer 4 all ofthe above ‘Whit of the following i an exterior routing protocol? 2 RP b. OSPF ©. BOP 4. aandb ‘Which ofthe followings an intrioe routing prota! o RP b OSPF ©. BOP 4 aandb 3 x6. 2. a. 38 ». 4h SECTION 17 PRACTICESET 401 ‘The Difksea aor seated wo 4. distance vee outing 1 fink state routing «path veto outing 4 aad OSPF is based on a distance vetor outing by link state routing «path vector outing 4. and [BOP based oa _ a. disace vetorontng 1 ink sate rousing «path vector routing 4 sand ‘Which mers eset when a nw update message or a rout is eceived? «rhage collection timer 1 expiration ier ¢. petodi timer 4. convergence timer ‘Which imer cons he aversing of regular update messages? garbage collection timer by expiration timer «peso ier 4. comergence tier ‘Which ime is invoivedin purging an valid routs fom able? 4. rhage coleeon timer 1s expiration timer periodic timer 4 convergence timer ‘Which typeof BGP message creates a elatonship between two rote? 1 open update Keopalive 4. poticaton Which ype of BGP message announces a route ta new destination? ‘update , eepalive 4. otitcaion 4m CHAPTER 13. ROUTING PROTOCOLS (RIP OSPR AND BGP) 42, Which type of BGP message is sent by a system to notify another router of the Sender's existenes? 4 open update keepalve 4. notation 48, Which type of BGP message i sent by arouer to close a connection? open update Keepalive 4 notiiation Exercises 44, Whatis the purpose of RIP? 45, Whatare the function ofa RIP message? 446. Why isthe expzatio timer value sx times that ofthe perio tmer vlue? 47, How does the hp count limit alleviate IP's problems? 48, List RIP shortcomings and ther coesponing tes 49. Compare spit horizons ad poison ceverse, When would one be used in reference tothe cher? 50. Whats the bass of lassiication forthe four types of links defined by OSPF? 51. Whats he porposeof the authentication type and authentication dat es? 52. Contrast and compare distance vector rating wih nk state routing 53, Draw a flowchart of the steps involved when a router rceves a distance vector message from a neighbor ‘4, Why do OSPF messages propagate faster han RIP messages? '5. Whats the size ofa RIP message hat advertises only one network? Wha isthe size of RIP message that averse W packets? Devise a fom that shows the ela ‘Sonsip between te numberof networks advertised and the six of «RIP message 56, A router running RIP as a outing tle with 20 entries. How many pei tn- ersare ceded io handle this teble? 57. router runing RIP has a routing table with 20 entries, How many expiration timers are noeded to Randle this abe? 58. router running RIP ha a rooting table with 20 ents. How many guage cl lection timers are needed handle this table if ve routes are invalid? 59. Arouer has the following RIP rong abe Neal 4B Neo 2 ¢ Neo oF Nuts G 63 6s SECTION 137 PRACTICESET 449 ‘What would be the contents ofthe table if the router recives the following RIP message from router C: Net 2 Neo 1 Nes 3 New 7 How many byes ae empty in a RIP message that averse W networks? A route asthe following RIP routing table Nal 4B Ne 2 ¢ Neo oF Ned 5G Show the response message sent by tis outer, Using Figure 1324, show the ink state updtfoute link adveement fo oer Using Figure 13.25, how dhe ik state updateoste link advertisement fr roe Using igre 13.26, show dink tat uptown advertisement fo roter E Show te ink ste updatenewvk ink aerisemeat for network N2 ia Figure 13.24 ‘Show the link tte patecwork nk aherisement for network Nn Figure 13.24, ‘Shon the tink state upde/network ink advertisement fr network NS in Figure 13.24 68, In Figue 1324 assume that he designated router for network NI is rower A, Show he tink state upstelnrwork link advertisement for this network. 69. In Figure 13.24 assume that the designated router for network N3 is eure D. Show the link state updae/getwork link advertisement or his network 70, Assign IP adresses to networks an outers in Figure 13.24, 1 n. 1 on ‘Using the rest of exercise 70, show the OSPF hello messige sat by rater. ‘Using the result of exeris 7, show the OSPF databse description messag: sen by omer sing the result of exercise 7, show the OSPF lnk state request message sent by router ‘Sow the autonomous sytem with the following specieations “There are cightneworks (NI 10 NS) ‘Ther ar eight waters (RI 10 RS) 1NI,N2,N3, NA, and NS are Ethernet networks ois a Token Ring 1N7 and NB ae point-o-pint neworks Rl conneets NI tad N2 2 connects NI and 7 RS connects N2 and NB R& connects N7.and NS RS connects Nand NB 4M) CHAPTER 13. ROUTING PROTOCOLS(RIR OSPR, AND AGP) 1, R6 connects N6 and N4 1. 7 comets N6 and NS ‘mL RS connects NS and NS 175. Draw the graphical representation ofthe autonomous system of exercise 744s sen by OSPR 76, Which ofthe news exercise 74 transient nctwork? Which asl network? 77. Show the BGP open message fr rote RI in Figue 13.50 7B. Show the BGP update message fr roter RI in Figue 13.50. 79. Show the BGP Keeplive message for router RI in Figure 13.50. 80, Show the BGP noicaion message for router RI in Figure 13.50. Programming Exercises 81. Write declarations forall RIP messages in C. 182, Write declarations fo all OSPF messages in C. 83, Write declarations forall BGP messages in C 84, WeteC code to plement the routing algorithm for REP 5, Modify the cove in exercise 8 wo include rigged update, 86, Modify the cove in exercise 8 onl split orzo, S87. Medify the code in exercise 8 onclude poison reverse. 88, Waite Ccode to implement Dikstas algorithm, APTER 14 Multicasting and Multicast Routing Protocols In this chapter we discuss muicastng and multicast routing protocols. We fist define the term multicasting and compare ito unicasting and broadcasting. We aso riety ‘sci the applications of molesting. We then move oto mulicast outing and the ‘general ideas and goal elated tit. Finally. we sess five common multicast eating roocols used in the Internet ony. 14.1 INTRODUCTION [Lets first introduce mutcstng and its applications inthis section. Unicast, Multicast, and Broadcast |A message canbe unicast, multicast, or broadcast, Let us clarify these terms they relate tothe Inte Unicasting Tscast communication there sone source an one destination. The relation betwen the source ad the destination is ane to-one, In this type of communication, bath the ‘sources destintion adese, nthe IP datagram arth unicast adresses signed 10 the host (r host iterfce wo be mee exac). In Figure 141, a cast paket stars from ‘he source SI al pses ough routs to reach the destination DI We hae shown the ecwors asa ink beeen the routers simply the gure. ‘Note tht in unicast outing, when a outer roves a packet, it forwards the racket ‘trough ely one ofits interfaces (the one belonging wo the opium path) defied in the routing table, The router may diacard the packet if t cannot ad the desation ses in ts outing table Multicasting I mutcast outing thre sone soure ad a group of destinations The reatonstip ‘one-to-many In this typeof communication, We susce address sa unicast addres, but 40s 406 CHAPTER 11 MULTICASTING AND MULTICAST ROUTING PROTOCOLS Figure M44 _Usicasing Te wrist outing te fer Forward he ese packet Brough nly one fs imeranes| the destination adres is group address (class D). The group address defines the rmembers of the group, Figure 14.2 shows the idea behind maliesting. A multicast ck stats from the source Stand goes wal destinations that belong to group Gi. Figure 14.2 atalicaie {In mniticast outing, when a router receives packet, tay foreard i though sever ofits intecaces, The outer may discard he packet itis notin the multicast path To mulicest routing he rover may forward the recived packet hrovgh several of o SECTION 41 nermoDUCTON 407 Broadcasting In broadcast routing, the communication isonet. Thetis ony oe source, a al ‘ofthe other hosts are the destination. The Internet doesnot explicitly support toad ‘casting because ofthe huge amount of trafic it would create and because ofthe band With it would need. Imagine the trafic generated inthe Internet if 1,000 people \wantod o send a message to everyone else connected tthe Init. However, 8 We will se shomly, browdcastng i used implicitly a a rete o multicasting. Multicasting Versus Multiple Unieasting Before we finish this section we need to distinguish between mulcasting and multiple nicasting Figure 14.3 lusvates bath concep Figure 143 Mabining ver mip nicating sien | 48 CHAPTER 11 MULTICASTING AND MULTICAST ROUTING PROTOCOLS Multicasting ‘Malicstng ars with one single pack frm he source tha i duplicated by the out. cen The destination adress in cach packer ithe same forall upicts. Note hat nly ‘one sigle copy ofthe packet waves between any Wo routes ‘Maile Uncasting| ‘In multiple unicasting, several packets start from the source If there are fve destin tion, fr example, the source sods five packets, each with dtfereat unicast destin tion adress, Nt that there may be maliple copies traveling betweon two raters. For ‘example, when a person sends an email message to a group of peopl, this is multiple tmicesting. The email softe eeates replicas ofthe message, each with diferent testnation ads and sens them one by one. This snot multicasting; i is maliple niasting Emulation of Multicasting with Unicasting, "You might wonder why we hve a separate mechanism for mulissing, whe it ean be molt with unicating. There are several reason fr his; wo ae obvious: 1. Malicasting is more efficie than mulkipleuniasing. In Figure 14.3, we can see how multicasting reguieslse bandwidth than muliple unicasting. In multiple tunicasting, some ofthe inks must hand several opis 2. Inmnlipleuncasting, the packets are created bythe source with a dla eative 10 cich othe. If here ae 1,000 destinations, the delay betwecn the firs and he lst packet may be unaceptale In mubicastng, theres ile delay boca of mat le packet cretion, Trulaion of mlcsting through male wicasing i wot fen ad may crate ong sys, pill with age 0. Flooding longi elated to both multicasting and browlcastng. Tn ooding, aout forwans packet oat of ll ofits interfaces except te one from which te packet came. Flood ‘ng provides broadcasting, bt i also creates loops. A router will recsve the same pocket over and over from different interfaces. Several copies ofthe same packet are ‘Srelated, rating wali jams. Applications Muiticstng has many appications today suchas acess to distributed databases, infor. ‘mation dissemination, teleconferencing, and distance learning. SECTION 142 MULTICASTROUTING 4 Acces to Distributed Databases ‘Most ofthe large datas today’ re dsteibuted. That ste information is soe in ‘more than one location, usally a the time of production. The user who needs to aes {he database doesnot Loo the location of the information. A user's request is mal ‘east all the database locations, and the locaton that has the information respon Information Dissemination Businesses ofen nocd to send information their customers. Ihe nature ofthe infor ‘maton isthe same foreach customer, it can be mucus. In this way abosnes: can fend oe message that can reach many customers. For example, solware update can besen tal purchasers ofa particular softwar package Dissemination of News ‘a similar manner the news can be csily disseminated through multicasting. Oe sn ‘ale message canbe set to those interested in a paula topic. For example, the satis tics ofthe championship high schoo! basketball tournament needs tobe sett the sports eters of many newspapers “Teleconferencing ‘Teleconferencing involves mulicasting. The individuals atending a teleconference all, need to receive these information a the same ime. Temporary of petnanet soups an be ford for his purpoe, For exampe, an engincering group that bois mesg very Monday tmoming cold have a permanent group wile the group tht ply the bolay party could form 2 txmporaey Broup Distance Learning ‘One growing ea inthe we of muleasting i distance leaning. Lessons ang by one ‘single profesor canbe received by aspect roup of students. Tiss especially con ‘enieat fr those stents who ind ities attend clases camps. 14.2 MULTICAST ROUTING [Now that we know what multicasting send how itis used we ned to know bow aml- ‘cast packet can move efficiently fom a source 2 destination. The objectives of ma sieasing are a follows: 1m Bvery member ofthe group should receive one, and only one, copy ofthe muicas packet, Reovipt of malile copes is not allowed. 1k Nonmembers must not receive acops. ‘= There mat be mo loops i routings 7 is packet must not vst 8 router more ‘= The path veled fom the source to ech destination must be optimal the shortest pat, a0 CHAPTER 16 MULTICASTING AND MULTICAST ROUTING PROTOCOLS ‘Tree Versus Graph ‘Two common data structures used in computer sence are the graph nd the re, Roth sae defined as a collection of nodes and edges (ine) A graph hs no hierarchical suc ture, bata tree does. Each node on reas one single parent nd zero or more ci Are, The root of he te, te ancestor ofall nodes, has to pares. A lea of a tee hes ‘no child. A node ofa graph, on the otber hand, can have several predecessors and sev eal sugcessors.Inunicasting, te Item, o part of i is represented by a grep in ‘kissing, the Intent, o prt of itis represented by a wee. A knowledge of wees and graphs enhances the understanding of the concept ofthis chapter. ‘Spanning Tree Forefficient mulcasting, we nec tre with the source asthe oct an group members as leaves. Suche Ue scaled a spanning tesa ve tat connect al ofthe nodes, Shortest Path Spanning Tree Forefcient multicasting. we nee a spanting tee in which each pth from he rot to leafs the shortest according Lo some metric) possible. This optimum tei eae & shortest path spanning tree. 14.3 MULTICAST TREES ‘Two types of trees are used for mtcasting by multicasting protocols: soure-baked ‘wes and group shared tres. Source-Based Tree Inthe source ‘ase tee metho, single toe is made foreach combination of sousce and group. In other words, the formation ofthe trees bcd on bo the source and on the group. If there are diferent groupe and M diferent sources inthe system tere can bea maximum of Wx M different tees, one for each Souee-proup combination, For example if at this moment, a source nds to send a mulcast packet oa group wit Chass D adress of 2289.28.40, a coresponding eis mae for this purpose If ‘0 minutes Iter, te same source wants o send multicast packet o group 230642 (a diferent group) tbe tree changes Inthe source tnsed approach, che combination of source and group determines thee. ‘na soatce sed ee apps te combinion of te dopo he Oe Although the idea of the soure-based te is simple, the implementation is 0 ow can we create a tee fr each soure/groap combination? In ation how can we ‘sure tha each ee is optimal (he most ficient)? To havea te for each combina tion, each router mast have information abou esch particular tre. Tn other words, SECTION 1.4 MULTICAST ROUTING PROTOCOLS 41L when a router receives a multicast packet, it must know the interface or interfaces thyough which the packet must beset ‘Two approaches have been used to create optimal source-based muliest tes, ‘Te ist approach, used in DVMRE, san extension of unicast distance vector ting (cuch as RIP). The second approach, vsed in MOSPF, sam extension of unica ink state routing (uch as OSPF), Another protocol, PIM-DM uses either RIP or OSPF, depending on aed, All hse approaches are discussed later in the chapter. Group-Shared Tree Inthe group-shared tre method, ach roup i he syste shares the same re ere are groups inthe whole sytem, thor isa maximm of tees, one for each stoop. For example, if tis moment source needs to send a muicast packet © soup witha Class D addess of 2267.18.10, coresponding wee made for this purpose It few seconds later, anor source needs to send another packet othe sme pox the ‘comesponding tee would be the same. But if he previous source any oer sure, needs to send a packet to group 2295.80.10, x now tee is made. In other wer, the twee changes when the group changes; tbe ue remains the same forthe group regan les ofthe source. In the group shared tee method the group detemines the tes. ao the source, Tn the srapataro we appro te op de mins he we ‘This method also has two approsches to find the multicast nee: the Stine es and renderyous point tre. Steiner Tree In this approach, the optimal tei the one in which the sum ofthe css he inks is ‘minimum. Note hat this i diferent from Dijkstra gorithm in which optimization is ‘based on ech single source Inthe Steiner wee, we want o optimize the cost no Fier what the soure. There are good argument for using the Steiner tee, but because fhe cat ee rai Cin oo pte Default Lifetime All tbe DVMRP prune messages have field defining the pruning lieime. Ino vale is entered, te deta is 2 hours, Pruning takes place only fo the lifetime ofthe packet; afer that. rac wil avtomatialy be restore. ln tbe word, i rote semis prane message to the upstream outer an indiatsaifetime of 1 Bout, itmeans tat he router doesnot want 9 roseive muliast messages fom tht patil _roup for | hour, After the hour is up the messages mst resume if there i mo second Prone message. This implies that oc router has pruning time or cach active prox. "RPM als ung and grag © RP wo rene alc sores phere at mappa juan member chang, 146 MOSPF ‘The Malices¢ Open Shortest Path First (MOSPF) i an extension of the OSPF protocol ‘hat uses multicast lnk state routing to create source based tees. MOSPF uses an spproach diferent from DVMRP. Fst, the tre i a leas-cost tre (using mete) instead ofa shortest path te. Second, the te is made all a once instead f gradally (he res said wo be pre-made, pe-proned, and ready to be wed, Least-Cost Trees ‘This approach ass the fact that in unicast ink state routing thee isa common ik state database and, sed on this database, each router knows the topology a he eaie network. fn edition, each router ean use Dijk’ lgoritim to teat least cost tee that hus the router asthe root and te est ofthe roues ae nodes ofthe tee However the last-cost tees generated by Dijkstra’ algorithm ae different for each roster, unlike the database andthe topology, which are the sae foreach route, SECTION 146 Moser 47 ‘The te we need in muleastng routing is slighty differen from the one use in Jeast-cost unicast routing. We ned one tre foreach sourcelgroup pai and thet ust be the source. The solution isnot dificul, case the dtabase sche ses we can ask each router to use Dijksta's algorithm to eee a tre with the sour a he oot In this cas, cach rote eeaesexaly the same tree, with the router ef 8 node inthe te. Figure 14.9 shows the difeence between te igure 149° Unica ree ond maitre Ass [strates teeth tates Although a tree made this way looks ke perfect soltion, there ae sil some probens. ‘4 The tre based on Distr’ algorithm uses wicasakesss (whic are unig for ech host the tice we nee requires group addresses which arent enigne (wore than one host can belong toa group and host may belong to several romp The membership may change fequently. A host may belong fo a group stone moment ut notin the nest and vice vers «¢, Dijkstra’ algorithm is very comple. Using the algorithm for each must packets very expensive tme-wise. ‘To solve the ist problem, we canada new link tate update packet to asocate he ‘micas aes of «host withthe roup address adresses the hosts sponsoring. It 's called a group-membership LSA. In this way, we can include in the tee only the hosts (asng their unicast adresses) that belo w a partcular group. In other wore, we make ree that contains al the hosts Belonging @ Ero, but we Use te unicast dress othe host in he calculation, ‘The new lnk state packets can aso solve the second problem if they are seat ‘whenever ther isa change in the membership. ‘To solve the tid problem, we can nuke Ue treet the eas-c0s res on demand (when it receives the fst multicast packed. Tn ation, the tee canbe saved in the eche memory fr fur ue bythe sume source/roup pe. MOSPF is daa driven protocol; the ist time a MOSPF route sees a datagram with a given source ed roup adress, the outer calculates the Dijkstra shortest path tre calculation CHAPTER 14 MULTICASTING AND MULTICAST ROUTING PROTOCOLS 14.7 CBT “The Cove Based Tice (CBT) protocol isa sroup-shared protocol that wes one a the root of the Wee. The autonomous system is divided into region and a core (center routes) is chosen foreach region. Formation of the Tree ‘Aller the rendezvous point isslecte, every router is informed of the unicast adress ofthe sleted router. Each router then sends unicast join message (similar wa graft lng message) to show that t wants join the group. This message passes though all outers that ae located between the sender and the rendezvous route ach interme ‘ate outer extracts the necessary information from the message, suchas the unicast dress ofthe sender andthe iaterfacethuph which the packet has ave, an fr trans the message tothe next router inthe past, When the rendezvous router has Tootved all join messages from every member ofthe group, the tee is formed. Now ‘very oer knows te ptram oar (the router that leas othe ro) aa the dow Stream outer he ower that leads to he Ia). Wa router watt leave the group, tsonds a eave message to is upstream out, ‘The wpsteam router, removes the link to that router from the tee and forwards the reste tothe upsteam over, abd soon, Figue 14.10 shows the ashared-aroup wee swith rendezvous router Figure 14.10 Sharer oe wit endecnus er ‘The reader may have noticed two diferences betweea DVMRP and MOSPF, oo cone hand, bd CBT, onthe her. First, the te forthe fst wo is made from the oot ‘the woofer CBT is farmed fom the leaves. Second in DVMR, the woo fist made ‘broadessing) and then pruned: in CBT, there is no wee at he begining: the joining (grafting gradually makes the tee secnow 47 car 49 Sending Maticst Packets ‘Ate formation ofthe tes, any source (belonging othe group ont) can send a mal ‘cast packet pall members ofthe group. I spl sends the packet othe rendezseus oe, sing the unicast address of the enezvous rote, the rendezvous router ited wes the packet to all members of the group Figur 1.11 shows how a host cam sen a rmalicat packet to all members of the group. Note thatthe source host canbe any of the hosts inside the shared te or any host outside the shared tee In the figure we ‘show one locsted ouside the shared te. igure 14.11 Sending act packet therendecoms ror — Selecting the Rendezvous Router This approach is spl except for one point How do we select a rendezvous route to optimize the process and mlticastng as well? Several methods have been imple mented. However, this tpi is beyond the spe of this book and we leave itt more rence books In summary, the Core-Based Tree (CBT) isa shared-group tre, center based po tocol using one te pr group. One ofthe outer inthe tre ical the core. A paeset, {set fom the source to members ofthe group fllowing this proce: 1. The source, which may or may not be par ofthe tre, encapslates the mui chet inside a unicast packet withthe anicat destination adress ofthe core sd ene ito the ere This part of delivery is done using unicast adres: the oaly recipient isthe core router 2 The core decapsulates the unicast packet and forwards it to all “interested” ine faces (we defn interested nerfs ltr. 53, Each router that receives the mulicast packet, in tr, forward ito al interested imeraces. 2 (CLUPTER 16 MULTICASTING AND MULTICAST ROUTING PROTOCOLS 1 CBT, he sure sends he malic pack (nepal na ua pk be coe rover. Te core eter decepsstes the fake nd ora al intr bot 14.8 PIM Protocol Independent Maticast (PIM) isthe name gvea to two independent micas outing protocols: Protocol independent Mulcast, Dense Mode (PIM-DM) and Protocol Independent Multicast, Sparse Mode PIM-SM), Both protocols are unicast protocol muliase © broadcast 4 asnad 4, Wecanuse_____toemlate multicasting, bs its nef and could eesuitin snaccepabie delays unicasing 1 eulpieucasting «broadcasting 4. mile brandcasting, 5, A router has fur interfaces: A,B,C, and D. Ie receives a packet fom intrfce [A To flood the network with this packet, che rouer sends the packet through imeraces) aa B,CandD © AB,CandD 4AB.CorD a isa mlicastng application. 2 Teleconferencing > Distance learning «.lnformation dissemination 4. Allof the above 1 SECTION 1412 PRACTICE SET 28 ‘A___is adam suctre wit noes and edges a hieearchical stare, > empt © leat 4 r00t in uniasting, the Ineret, or part of can be represented by a graph leat root In multicasting th Internet, or part oft, can be represented by a graph © leat 4 rot A system osessource-based tees for mulicsting. Wf there are 100 sours and 5 groups, ter isa maximum of erent aos, as b 2 © 100 4 500 Ina ‘te apprsch 1 multicasting, the combination of source and group eters the tee 1 spanning source shonest group © soute-tased 4, group-shared ‘na___tre approoch to muitcasting, the group determines the tree. ‘spooning source >. shortest group © souree-based 4. group-shared ‘A system uses groop-shared tees for multicasting. K there ae 100 sourees and 5 groups, there isa maximum of diferent ees aS h20 © 100 4 500 26 ‘CHAPTER 16 4, 15, 1, _MULTICASTING AND MULTICAST ROVING PROTOCOLS {sa multicast routing protocol using Source based wes. = DVRMP b. MOSPr CRT aad sa multicast rooting protocol using group shared tees. & DVRMP: 1 MOSPE . PIMC-SM;PIM-DM PIM; PIM-DM PIM; PIM-SM 23, When « mutcast rower isnot dteey connected to anther mast route, & canbe formed to connect thet, 4 physical cnnel ' ogcal uel © Topical core spanning tree Exercises 24. A router using DVMRP recsives packot with source adress 10.14.172 fiom interface 2 I the router forwards the packet, what ae the contents ofthe eary ‘ete to this adress inthe unicast routing table? 25, Router A sends a unicast RIP update packet o rue B that says 134.23 00016 hops away. Nework B seads an update pucks o router A thal says 13.25.0086 Js hops avay. I these tw routes are connate to these netvork, hich ene isthe designated parent router? 26, Does RPF actually create a spanning ee? Expain. 27, Does RPB sctutly create a spansing tee? Explain, What ae the leaves of he te? 28, Does RPM actully crete «spaning re? Expin, What re the leaves ofthe te? Projects 29. Do some esearch om the Internet on DVMRP. What isthe font ofthe prune ms sage? What isthe format ofthe pra message? 30, Do sume researc om the Inte on MOSPE. What i the format of the gro ‘membership LSA packet that associate network with 8 group? 1. CBT uses nine types of packets. Use the Interne o Sin the purpose and format of each packs 32, Use the Internet to find how CBT messages are encapsulates 533. Use the Interet to find information regarding the scalability of each multicast, routing protocol we discussed. Make a ale an compare them $4. Use the Internet oid information about he inter astonomeous multicast otc, ° HAPTER 15 Application Layer and Client-Server Model Because the TCPAP protocol suite was designed before the OSI mode, the layers in “TCPMP do not correspond exactly tothe OS ayers. The application layer in TCPAP 5 equivalent tothe combined session, presentation, and application layers of the OSH ‘wove. This mean tha al ofthe funtionaliies sociated with those thee layers se handled in one single ayer, the aplication layer (se Figure 15.1). Figure 18.1 Comparison beeen OS! nd TCPAP. Coxrer vor ——— | Es SS eS In other words, every application program must incl all asks asigned toe session, presentation, and application layers ofthe OST move. This has some adv tages and some disadvantages. One advantage is that each application progra is ind ‘endent requires ony those functions needed forthe jo for which the sppliation ie designed. This saves needless cll services ha jst pass parameters. One disadvan tage is thatthe same tasks appear in afferent application programs, making tem more comple, Ia ado, tills the whole ida of modu and ered arhitectureot {he OST mode 1 490 CHAPTER 15. APPLICATION LAYER AND CLIENT SERVER MODEL 15.1 CLIENT-SERVER MODEL ‘The purpose ofa network, or an iternctwor, 10 provide services to wes. A user at «Toa site wants o recive a service from a computer ata remote sit. Thetis nly ‘one way fora computer todo the jb: i must run a program, A computer rns a pro ‘ram fo request a service from another peogram ads to provide a servic oanoer ‘compote. This means that wo computers, connected by a intere, must each ran & ‘rogram, onc to provide a serves and ne to rogues a sevice Te shouldbe ler ow that if we want to ose the services avilable onan inter, pplication programs, runing a 0 end computers and communicating with each other, ate needed. Gee wor, nan inne, the sppiction programs ae the enti es that communist with ach ther, act he computers ores. ATs glance it looks simple wo enable communication between two appletion programs, one runing atthe local ste, the ober roning atthe emote site Bu my ‘uesios ase when We want implement the approach. Some ofthe questions that swe may ak ar: 1. Should both application programs be able to request services and provide services or sould the pplication programs ast do one othe other? One sliion so have an application program, called th clin runing on the local machine, request 3 service from another aplication program called te server, runing on the remote machine. In other words, the sks of requesting a service and providing 8 service sre separate from eachother. An aplication program is either a requester (ac fen, ora provider (a server). Ifa machine neds to request a sevice ad provide & service, two application programs must be installed. In oter words, aplieation| programs come in pars, client and server, both having the sae name Figure 152g, states is, 7 Figure 5.2 Ctentserer model 2 2. Should an application program provide services only to one specific application ‘rogram installed somewhere ina iteret or shoud it provide sevies for any application program that requests this service? The most common solution is a server providing a service for an cient, nota particular client. In other words the SECTION 15.1 CUIENTSERVERMODEL 431 ‘ema ot r | | | | J | = 488 CHAPTER 1S. APPLICATION LAYER AND CLIENT SERVER MODE. fist fork is called by the parent proces and creates child the second fork, however, iscalled by two processes: the paren and te child, When fk sealed bythe parent roest, it creates new cil (second child). When fork is alled by the fist hil it eats another child a grande). After the fist fork, only two processes ae running (he parent and th fist child) after the second fork, Tour processes are running the tent theft chill, the second cil, andthe randeild (the chil ofthe fist chil), Figure 15.13 shows the result ofthe previous program. The fist ie i printed only once, the second line twice, and he thi line four Ges. igure 1513 The onput ofthe rogram in Figure 1512 ‘A very interesting pat about fork i that when is alle, i returns fv values. The renmed value alae to the parent process ith proves of the created chil. ‘The retuned vale available othe child process is simply 0, These dual retard values allow the programmer to write a proprara wo separate the parent process fom the eid ress. The program in Figre 15.1 prin the processide of the parent and cil. The rogram separates these vo poceses by txting the return vle ofthe Fork Faeton. Figure 15.14 program ra prins the procs of he parent andthe child Se t i pt fa weak: Ripa>b) asf ae prs SA np algae) [Eat Ceti pei BH erty SpeTiow 154 KEYTeRMS 39 ‘The separation ofthe parent and the child i the key othe design of concument servers A parent server can run infinitely and wait for client to make a connection. As Soom as aclen request the connection, the paca can crete acl server toserve tient while it continues o lok fr oter cients. For every clint anew eld servers seated and assigned to serve that client Fgute 15.15 shows the idea, We will she ‘more deals in Chapter 16 when we discus the socket interface Figure 15.18, Example ofa sever program wth paren and cid process = a = keris — — 154 KEY TERMS setive cose code active open concurent client pplication yer concurrent sener child ener connection oriented concurent server eat finite program tiem server mode fork 480 CHAPTER 1S. APPLICATION LAYER AND CLIENT SERVER MODEL infite program passive open iterative lent pres iterative server process identification (proces) (051 model rogram paret server sever 15.5 SUMMARY 1 The TCPAP application layer comesponds othe combine session, presentation, and application ayers ofthe OSI model 1a Inthe client-server model the lent rns 2 program t request sevice andthe server run a program fo provide the service, These 0 programs communicate sith each thee. 15 One server program can provide evies for many lent programs f= Services need frequently and by many users have speciiclint-server programs ‘= Actient sa nite program running on the local machine requesting sevice from a ‘= Asner is a infirite program uaning onthe remote machine providing sevice to the cient, 1 liens can be uniter teraively one aa ie) or concareily (anya tne) 1m Servers can handle clio either iteratively (oe at time) or concureily (ray statime}. 1m Aconnectonies iterative server uses UDP a ts transpst layer protocol and can serve one cient at atime. ‘mA connection-orented concurrent server uses TCP as its anspor layer protocol and ca serve many clients at the same time. 18 When the operating sytem excetes «program, an instance ofthe program, called apocess, iced. ‘= Esch program in UNIX is unigely identities by an integer called the process iden ‘leat number (process) ‘a The fork function enables the creation of «child proces from a parent process ‘m The fork function returns two vals that enable the separation ofthe patent rom the cil SECTION 158 PRACTICESET at 15.6 PRACTICE SET ‘Multiple-Choice Questions 1, ____canequesta sevice. a Asche ieee hb Aport ©, Actieat 4. Aseever 2 can provide servic. 4. Aniteratve server 'b A concurrent seer «&. Adlient 4 nandd 8, The tient program is 1 passive ite because it terminates afterit has ben served 4 infinite 4. The server program s__ because its always aval, wating for lien request passive «fie 4 ifiite 5, Aconnecton oriented concurrent Sens Uses pots a ephemeral bs wolLknown 4 aandb 6, A conectonks iternive server ses 4 ephenenl by wellknown «. ative 4 gand 7. The TCPAP aplicstion layer comesponds tothe OSI model's «physica, data ink, and network 1 eansport and network, «. session and wansport A session, presentation, and application poms, layer, ae ccnarren is 2, APPLICATION LAYER AND CLIENT-SERVER MODEL Machine A requests service X from machine B. Machine B requests service Y ‘hom machine A. What ithe otal numer of application programs required?” al b2 3 a4 Actin issues __ wen t needs service froma server 2 an active open 1 apusive open © anactve request 4. ante open A server program, one itissies 2. an active open be apusive open an active request, 4 aii open pees equess one a tine | Aniteratie cient An tert server ©. A concurent client 4. Acneurent seer processes many request imultaneoosy. 1 Anitestive client 'b Aniteativ server ©. A concureot cient 6, Aconcureat server In a conection-vieated concurrent server, the __ is used for connection only. 2 init poet ephemeral pre «, wellknown port a bande A isan instanceof 1 process rogram program; process «press sevice A streture; process waits for cients to request its service, SECTION 156 PRICTICESED $43 15, Four processes trom one program are created: ane parent two child, and ane ‘grandchild How many processids are tere? at be 4. some number assigned by the operating system 17, The _____ function crates ld process, a ohld pet child © esti fork 18, Inthe program in Figure 15.12 the parca proces prints at be 63 as 19. Inthe program in Figure 1812, he fist child process prats_statemens. at 2 3 as 20. Inthe program in Figure 15.12, the secon cil process prints _ statement, at be 23 as 21 Inthe program in Figure 15.12, he grandchild proces pins al 2 3 486 CUAPTERS. APPLICATION LAYER AND CLIENT-SERVER MODEL Exercises 22, Can acid process have more than on prea process? 25, Can a prea process have more than one child process? 24, Show how a parent can print he processd of ts chil. 25, Show bow a child can print the process ofits parent. Use the gerpid) funtion ‘which is simile to get, but pins the process ofthe pret. 126, Whatisthe output ofthe following program sepment? fork 0: rit (Helio print (Helo fork 0: pint Bye") eum 0: 27, Whats the ut ofthe following program segment? ied it) de prin Cp); 1 29, Whacis he output ofthe fling program segment? prin Heli): fork pine Byes") } ‘ nt HR foxk print Dear”): Tok Print (Pend); y SECTION 156 PRACTICESET 498 Programming Exercises 20, Write program that erestes child and prints the process of the child ist aad ‘the pent ae. 31, Weite a program that erates a child and a grandchild. The program shoud pin the proces ofthe parent, the child, an the grandchild inthis de. 32, Write a program tha creates a child and a grandcil. The program shoold pio the process ofthe grandchild, the eid so he parent inthis rd. 38, Write a program that erates two children and four grandchildren (wo foreach hid). The program should thn pint te process ofthe pare, the twa child, ‘andthe four granécilren in his ore. 3, Write the clea program forthe program in igure 15.9. 35, Rewrite the program of Figure 159 as an iterative server oO o R16 Socket Interface {Ina ctien-server mode, two application programs, ove ning onthe local system (a tient for example) and the other runing oa the remee systn a server for example), ‘eed to communicate with one another. To standardize network programming, apples, ‘on programming iatesfaes (APIS) have been developed. An APL is a set of deca ‘ons. definition, and procedures followed by programmers to write elient-sever programs. Aton the more common API are the Socket Interface, the Transport Layer Interface (TLD. the Sueam Inefae, the Tread Iterce, and the Remote Procedae Cal (RPC). The Socket Interface, whichis very common toda, ste implementation we will discus inthis ehaper, “The Socket Interface was developed s> pact of UNIX BSD. I is based on UNIX. and defines set of system cll (procedures) that are an extension of sytem ells wed jin UNIX to aooes files. Tis chaper shows the fundamentals of Socket Inerface po- ramming though iby ao means teaches Socket Inerface programing: thee ate whole books devoted Yo this subject. Instead, we intoduce the concept and ia, td, ‘maybe, provide motivation for those readers who want tea ore tn this chapter, we fit inoduce some data types an functions used in network programming, Then we define sockets and itrce socket interface calls Fivally we sie two pues of examples of client-server programs 16.1 SOME DEFINITIONS In this section, we inrodvce some “ata types and stractres tha are needed Fr wring Client server programs. Data Types Defined Figure 16.1 ists six datatypes used extensively in client-server programs. These are int int nt vim int, and wins? «data ype, 48 CHAPTER I6. SOCKET HVTEREACE igure 16.1_ Date npes ‘Sept ne Sot 16 per Spt inp int Ung ng be6.¢ Unsigned iter a.t Unsp 3-nege Internet Address Structure ‘An Pv adress defined as a ttre (srt nC) called nade which contin only ‘one fed called s_addrof type in_add_1 The stucture bol a IP adress a 32-8 ‘isry number Figure 16:2 shows he saucture andthe coresponing declaration, Figure 162 tnemetaddiesssractre i Fates te: | ° Internet Socket Address Structure ‘The application programs that use the TCPAP presen suite noe a stractre called socket address, which mainly bos an IP address, a por number, and the proacol family. The structure scaled soctadavessandhas five lds the Ost nl he lest kd ‘ae normally not used, however Figure 16.3 shows the sractue ands declaration. 16.2 SOCKETS ‘The communication store tha we need in socket programming is socket. A socket ses aan endpoint Two processes need «socket st cach end to communicate with acheter SPCTION 162 SOCKETS 418 Figure 163. Soot adds sractare 2 or sue sock : | - & | = = | 1 ‘A sockt is define inthe operating system structure. Figure 164 shows si plied vernon of socket strctre with five fils, These els ae sted below 1B Family This etd defines the protocol group: IPvt, 1Pv6, UNIX domain protools, andsoon, 1m Type. This il defines the type of socket stream socket, datagram sock, rr ‘ecko These are diseased in the next sein. 1m Protocol This fide usually se to zero for TCP and UDP. ft Local socket adress. This fed defines the local socket adress, a structs of type sokaddes, us defined previously. 1m emote socket address, This feb defines the rtote socket aes, astute of type sockadares, as defined previously, Figare 164 Sota sree [ ae | lee siely smpet eae = =o | = | a 480 CHAPTER 16. SOCKET wTERFACE Socket Types The socket imerac defines tres types of oekets: the steam socket, he datagram tosis andthe aw socket All de lypes canbe wed ia a TCPAP eve Gee Figwe 165), Figure 165 Sacer per ‘Stream Socket A steam socket is devigned to be used with «conneston-riented protocol such as TCP. TCP uses pair of steam sockets to connect one apliatonpopram to another cos he Interne. Datagram Socket {A datagram socket is designed tobe used with a coanectoness protocol such a8 UDR. UUDP uses pair of datagram sockets to sead a message fem one application program tw mothe across the Intel, Raw Socket ‘Some protocols such s ICMP or OSPF that directly use the services of IP use neithee stream sockets nor datagram sockets. RaW sockets are designed for these types of ‘plications, 16.3 BYTE ORDERING (Computers can be classified by the way they store dat in thir internal memories ‘Memories ae addressed byte by byte. A data unit ean span more than 1 byte, hhowever. For example, in most computes, «short integer is? bytes (16 bis) and a Jong imegeris$ bytes (32 bis). How a 2-byte shor integer or bye long inca ie SECTION 163 BYTEORDERING 481 stored in bytes of memory defines the eategory of computer: big endian or litle dian, Big-Endian Byte Order ‘A computer that uses the blg-endian system stores the most significant bye (the bie nd) of dats in the staring address ofthe data unit. Fr examples an IP aes such os 1023.146, when expressed as 32-bit binary number long integer, can be stored in bigendian computer as shown n Figure 166. Figure 166 Benoni onter oe zoo [oe [oe] | Meoory oat Ja +9 $894 mainframe computes 3s well as compuers based on Motorola inicrpeoces- sors ae based on the ig-endian sytem, Little-Endian Byte Order acompoter uses the Htle-endian system, itstores theless significant byt ie tle cod) of dain the staring adress of the data unit. For example, an TP adress such es 10.25.14, when expessed ss a 32-bittinary umber (ong integer) can be sored ina Tenia comptes as shown in Figure 167 igure 16.7 _Lieteendon byte oer oe a | « DEC VAX computers and computers using Intel microprocessors ae based on the Title-edian system “a CNPTER 16. SOCKET INTERFACE [Network Byte Order ‘Networking protocols can also choose their own byte order. The TCP proocol suite Ins chosen the big-enian byte ode. ‘The bye oder for tbe TEP petal te ig cada, Byte-Order Transformation ‘To creat porablity in application programs, TCPAP software provides set of func: tion that transforms inser fom a ost byte onder (big endian ox litle ent) tone ‘work byte order (big endian) Four fenctions are designed for this purpose: hos, ‘onl, tok, and mil (ee Figure 16.8). Figure 168 Byeonleraasfomaton fictions a_i ae ‘The prototypes ar shown in Figure 169, Figure 169 Decors for ye onder tafomtion int Mom (U6 et ser) | ines ae ies ere) in ha RB aoe Sn a WL ewok oe) ‘ons. The funtion hons host to network shor) converts & 16-bit integer from host byte order to network byte order 8 lon The fencton hon! (bst to network long) conversa 32-bit integer from host byte order to ncwork byte order SECTION 165 BYTEMANIPULATION FUNCTIONS 483 1m ntohs, The function nts (network to host short) consents 16-bit niger fom ecwork byte ode whos byte ere. ‘nto. The fueton stot (nctwork to hos long) converts a 32-itintger fom ne- ‘workbye one to host byte ode. 164 ADDRESS TRANSFORMATION [Network software provides functions to wansfonm an IP address from ASCT dtd decimal format 032-08 inary format evi Vesa. Two of these funetons are di ‘tas ere inet ton and inet nto (Se Figure 16.10, Figure 1610. Adis rnsormation “The proioiypes of transformation fonctions are shown in igure 16.11 igure 16.12 Declarations for aformation tons Ime tna (cmt sink Pai) ere tan ei in) ‘5 inet_aton, Tis fanetion transforms an ASCIT string that contains upto four ments separated by dot to a 32-i binary adress in network bye order. 1 inetntoa, This function transforms x 32-it inary adres in network byte oni oan ASCII string with four sogmeats separated by dos. 165 BYTE MANIPULATION FUNCTIONS In network programming, we offen need to ntlize a ed, copy the contents of one fel! o another, or compare the contents of two fs. We cannot use string functions such a rey strap because these futons asume tha edi terminated wi 8 rll characte, which i notte in network programming. Asa mater of fact, we nay 484 CHAPTER 6. SOCKET HTEREACE ‘eed to copy a sequence of bytes frm one il to another that may contain a zero byte, ‘The sing futons iment his 2ro terminator a sop a ht poi. Several functions have been defined inthe header file for thse byte ‘manipulations. We introduce the thee mast common: meme, memcpy ANd meme. ‘Tht procoypes ae shown ia Figure 16.12 Figure 1612._Decaraton forte manpalation factions eid tmemaat (old ete. void tmemepy (oil et, cot el seen) fot mma (camel cel asd, en) 1m Memset. Tis function sets a speci mame of bytes to value, The fst argu: rent is pointer tothe destination the eld tobe set. The second argument is he ‘ale andthe third arguments the numberof bytes. One can ws he seo operator ‘oil he cate fei. For example, the following sores aro in Geld called: memset (x 0, see): 18 Memepy. This fonction copies the value of one ldo another The fis argument isa pointer othe destination. The second arguneat is poatr tothe sours. The third argumet isthe numberof bytes to be copied. For example, the following copies the value of he y Held to the el smeapy (x.y zat) 18 Mememp. This function compares two fel. Tae Hint argument is pine to the fist field. The secon argent isa pointer to the Second field The hid ag rents the numberof byes to be compare. This function ets zr if the Wo fields ae the same. It returos 2 number lis chan 2eo ifthe fst Held is smaller than th second. It etaens a number greater than zero if heft fld is greater than the second. Fo example, the following compare the fst 10 bytes of andy smememp (x, 0) 16.6 INFORMATION ABOUT REMOTE HOST ‘A process often needs information about a remote host. Several netons have heen ‘designed to provide this information. We discuss one such function, called ethos ‘name. This function is seta call othe DNS, The function soceps the domain name ofthe host and returns stuctued information cll hasten that i actly the contents ofa resource record. The prototype ofthe function is given in Figure 16.13, SECTION 167 SOCKETSYSTEMCALLS 8 Figure 16.13 Declation or getosthmame toe bt Matha (ct ca ae): “The hostname i the domnin mame ofthe host in the form xxx.yy272. The function returns a pointer tothe stent strict. "The struct hostent provides several pieces of information. The fist field isa pointer to the name of ie host. The secon eld isa pointer to un aay of pointes ‘ith each pointer pointing to amas by which the host canbe called. The tid id isthe type of adress (AF INET i the Intermed), The next field is the length of te ress (4 bytes for TPvd. The last ld isa pointer to an arayof pointers with exh pointer pointing to one ofthe host addresses (the host can be multinomed hos See Figure 16.14 Figure 16.14 Tic hoster snatare aed owee hae feaape Weng tat | “ | tt | a aie i ent o nce 1 16.7 SOCKET SYSTEM CALLS Several functions have been defined tht can be called by an application progran ‘onmunicate with anther eppiction program. We introduce some ofthese in this ‘ection for ater sein or cient server programs Socket “The socket funtion is sed by «proces o create a socket. The prototype forth fac= Vio i given in Figure 16.1. The family, type, and protocol feds were defined in Figure 16:4, For TCP, the value of family isthe constant AF_INET. The value of 496 CHAPTER 16. SOCKET WTERFACE Figure 16.15 Declantin or socket faction ‘ype as used inthis chapter i iter the constant SOCK, STREAM (ated by steam sockets) or SOCK_DGRAM (use by datagram socks). ‘Although this function creates a socket it ses values for nly the it thre feds (fay, type, and protocol ofthe socket suuctre. The other elds ae se bythe oer Funcéoas orb the operating system, ase will cus late. “The Fueton returns an iteger called the socket descripor, which uniquely defines the created socket if the creation is succesful. Ie retums 1 if there is an error. The ‘socket deseriptor is sod by oter functions wo refer to the socket, Bind ‘The bind funtion bind a socket to aJoal socket aes by ang the local socket alice to an already create socket. The prototypes given in Figure 16.16. Figure 16.16 Decaravion or bad faction | = Sockfis te socket descriptor retured by the socket fonction; lcaladdr is a pointer to he socket adress ofthe loal machine; and ocoladdrln he length of the Toca socket addres "To use this faction the cllen fist needs ocll he socket funtion inorder to we te eetured value a the socket descriptor. The function ses Values forthe local socket ares. Note that this fneton is ot usually elle by the client Ina cent, he infor ‘maton about the local socket addres is usualy provided bythe operating system, This fianction urns an integer, 0 for sucess and =I foray ere. Connect ‘The connec function is wed by a process (usualy cient) 1a establish an ative con ncetion oa remot process (normally a seve) The prototype is given in Figure 16.17, SECTION 167 SOCKET SYSTEM CALLS 487 Figure 16.17 Declraon or comec faction ‘neces (nok, cot ae lait “eer Socks the socket deseripioe returned by the socket function; serveradd it 8 pointer othe emote socket ares; and serveradrlen she length ofthat adress, "Tous this function the cleo firs needs to eal the socket futon in onder to se ‘he retred vale asthe Socket descriptor. This faction sets values forthe remote socket lute. The local socket des is iter provided by the bind function or set by the ‘perting system. The function ers an integer, 0 fr sucess nd for any er Listen "The listen function i called only bythe TCP server. creates a passive socket from a “unconnected socket. Before calling the Hsten function, the socket mus already be re tic an he fea socket adress elds st. This fonction informs the operating sytem thatthe server is ready to accept connection through tis socket, Figure 16.18 shows en acc | . 5 eee Sockfd isthe socket deserptr returned by the socket function; backlog isthe umn ‘ber of equets that canbe queued fortis connection. This funtion returns an integer, (foe sucess and =I for any er Accept "The accept faction is cll by a TCP server to remove the ist connection request from the comesponting queue. I there are no requests (the queue is empty), the aecept function s puto sleep, The prototype is given in Figure 16.19. Figure 16.19 Declaration for accep fc r nace Gt dscns“) 48) CHAPTER 16. SOCKETINTEREACE Sook the socket descriptor; liewad the pointes othe des ofthe client ‘hat has requested the connetion; and cllenaddren i a poater to the client address length. Not thatthe socket address not passed to the function buts etumed fo ‘The length, however, is passed tothe function as a value; it is also returaed as esl ‘This function actually creates a new socket (child socket) that can be used by 8 ld server to connect to the cient. Al ofthe information needed for & new sockets [oride bythe operating system. The return vale i the new socket descriptor. Sendio ‘The sento funtion is used bya proces using UDP to send a message o another pro- cess sully runing on a emote machine. The prototypes given in Figure 16.20, Figure 16.20 Decoration for sno fncton smd etc, ld a se al, at ag, | oars cnr tsi adn). Sockfis the socket descriptor bus pointer othe bate bolding the message ‘be sent, buf defines the length ofthe bale, and the flags ld specifies Ob band ao lookahead messages. Normally iis set © 2eo. Toad sa pointer othe socket ures ofthe receiver and toadren is tbe length ofthe socket adress. The function retuns the mer of characters ent if there io ero and =f otherwise. Reevfrom ‘The revo fonction exacts the pest message that aves a a socket. Kalo exis the sender’ socket aes. In this way, te process tha use this union ca record the socket adres and use ito send reply back tothe sender. Its wed most by 2 UDP rocess. The proteype is given in Figure 1621. Figure 1621 Decoration for reefom incon eee | Socks the socket deserpor, bus poite tthe ble where the message wil be stored, buen defines the Jeagts of the buffer, and the fags eld specifies out-of band data or lokabead messages. Normally iis set to zero. Fromdar i a pointer to SECTION 167. SOCKETSYSTEM CALLS 9 the socket adress ofthe sender, and omadven ia potest the length ofthe socket ress. The function retums the numberof characters received if there is no eroF Shi =1 otherwise. Note thatthe socket addess isnot passed tothe funetion, iis feturaed from it Tecan be used by the process to respond tothe remote proces. THe Teng however, js pased sa valu and is ls returned a aes Read "The read fonction sued by a process to receive dts fom antes process runing on {remote machine. This funtion assumes that thee is already an open connection teween to machines therefor, ican aly be used by TCP processes. The XOyPE fs given in Figure 1622 Figure 162, Decoration rr action | ss va = | (ese Socks the socket descriptor, buf sa pointer to the bler where data will be sso and buen the lent of he bu This funtion ets the numberof bytes restive (ead if socesful, Oi an end-f-econttion is detected, a1 if thee is Write he write function is wed by a press to sed data o another process running 28 2 ‘emote machine, This funtion assumes that there s already an open connection ‘betwen wo machines, Therefore it can oly be used by TCP processes. Te protrype ispven in Figure 1623. Figure 1623. Declaration for write ection — vt tm hl) | Sovkf is the socket descriptor, buss poster to the baler where data tobe sats sored Due the gt the baton. Tae function retone she ramber of 368 Seat (wets) if sucesso and Lif there isan er ry (CHAPTER 16. SOCKET INTERFACE Close “The close fonction is used bya process to close a socket and terminate a TCP connec tion The potaype i given in Figure 1624, igure 1624 Declartionoreloefinton Inthe erst). “The socket desriptoris nt valid after calling his function. The socket ens an eget 0 for suezess and for err. 16.8 CONNECTIONLESS ITERATIVE SERVER In is section, we discuss comnetionlss, iterative clen-server communication using LUDP and datagar sockets. As we dscused in Chaper 14, a server that uses UDP is ‘uly conncetionless iterative. This means tht the serve serves one requests ime ‘serve get the request ecived in datagram fom UDP, processes the request, and {ives the response to UDP to send to the client The server pays no ateation to the ‘ier datagrams, These dulagrms, which could al be ftom one cient oF from many ‘ems, are sored in a queue, wing for service. They ae processed ove by one in loner of aia The serve ses one single port foe his purpose, the well-known ort. ll the dat rami rivng at this port wat ain tobe served Figure 1625 shows the Rowshar of ‘vents in connections erative communication. Server “The server performs the fllowing functions: 1. Opening a socket. The server issues the socket cal to ask the operating sytem to create a socket. The sock cal inthe socket interface is like the open cali he Se ntecace. The socket call crests a new socket suc, and the open cll re fics anew file stuctre, The eppliaion program makes his call ad pases three ‘lees of information: family, type and protocol. The operating system creates & {octet and enters the received information. However, the information forthe fecketis no complete. The operating system resus an nteye odie the socket ‘miguly, This integer i called the socket deseriptor and is used w refer tothe sack in he folowing eal SECTION 168 CONNECTIONLESS ITERATIVE SERVER 461 Figure 1625 _Soce were or connections erate server ‘torso ena aqua ie ‘interme ge 2 Binding, The server issues the bin call to ak the operating system to ene noe. ‘maton in the socket sructae create inthe previous tp, This information sn sists ofthe oeal socket adress, 5. Repeating the steps. The server repeats the folowing steps infty: 8 Receiving. The server issues the reevlfom call co tea, from the incoming ‘queue, a datagram stb aint Sending. After processing the daapram, the server issues the sedto call to ‘ed the datagram that contains the zest wo the outgoing ue. Because the ‘ommunicason is connectonless, the sent call provides the remote socket ‘ress (lien IP address an the let ephemera por des) foreach Ae ‘ram to be sent othe client These two pices of information ave obtained by the ecfrom system cll. “ (CHAPTER 16. SOCKET INTERFACE Client “The client performs the folowing furetions: 1. Opening a socket. The client issues the sack alo ask the operating system co create a sack. The clint does not have to do binding because the local socket free can be provided bythe operating system. The operating sytem enters the Jal IP adress an the ephereral port number in the feal socket address eld of the ete sockt. In Some implementations the lent ao issoes the bind cl ‘hat stray dat from anaerprogram donot enter tat pot Repeating the steps. The client repeats the following steps as lng as it has requests 0 make 4. Sending. Afer receiving the socket descriptor fom the operating sytem, the ‘bent ses the sendun calls wo send its eques 0 the serve: 1. Reedving. The cet issues she recviom to oben the response ofits request from the operating sytem, 3. Closing. When the client has ne more requests, issues aelose cl to destroy the socket 16.9 UDP CLIENT-SERVER PROGRAMS ‘This section contuins on sizple server program and ne simple lent progam. The server v3 gence server. We have inclided one PROCESS cal thts ied to deine the server fneton, For the sake of simplicity, we have aot included any enor checking or eror-handing statements Server Program “The serve program shown in Program 16. Program 161 (GDP erie Sener Pro “cide yep docine ytste * acse ntti | ‘ncade neta ee | | sncate cso» etude cig > oSne MAXBUF. 256 sd main (id ‘ SECTION 169 UDP CLIENTSERVER PROGRAMS 43 Program 161 (Conucd) backline [ : "TE heave Sener Pron ia] etarbae MA = oe ‘ [3] impsnesocer: e 1] sete tctiwaddiLen 15] stpstsostadis served 16) sstsoctaees canta i srssice- soial AR JMET, SOCK. DGRAM, 18] me err, 0, eo aera): |i] eat yA er: {oo]. severaisin gu = some km 5 [at] serene ade addon ONADDRCANY) | 122] tnd ounvescket, dsererAd, sie GenexAa chetAdieLen = azo seresA) snense (ut MAXBUFY : fois? t ‘wll es peieSocke. bot MAXBUT. 9 | “Scien, Bien) > 01 t PROCESS Cn seni (acuieScket, bot. MAXBUF.D, ebewAsie, clemvite) menset (ut0 MAXBUFY 1 Lines 1-6 are the header es. ‘Line 8 defines he bute size Line 17 eetes a socket 1 Line 18 iitiies «sever socket aes 1B Lines 19-21 se he vas forthe server socket address. Note that we ose ions and fort t create network byte-order integers. |= Line 2 nds he eestaa Sooke 10 te lal yehet lens (server aoc ee) Line 26 initiates te ter. 1 Line25 starts an innite lop. Line 27 receives the cen messages. 41 CHAPTER 16. SOCKET INTERFACE (© Line 30 uses procedie to press he dat ‘= Line 32 sends the sls tact the lien. Line 34 enalizes the bute forthe next iteration, (Client Program ‘The client program i shown in Program 162 Program 162 130) via oi) jaye : ' 12) wre air: 1B) variate; [14] sce renee: | Js] eratwctaon | rmtchdy |s} onus cation bala, | sal "ae | ‘Sirti leche AF BOY SOCK, DORAN, eset (eA) sf ema; eA fo = AR SET 23] mown gas hme ne Emp) Ser gehasteane (nomi imenepy fu) Brow ite, oe Sha Ho tr en | : | See eae Se ig cosy i fe : ses (mek, fa a ul, 51 TeREEE SECTION 1610 CONNECTION-ORIENTED CONCURRENT SERVER 468 Program 162 (Continued) : “UDP lane Cla Pra 2] memset 0, casa): 33] eco acvesoctt: but, MAXBUE 0; 35) _ pinto, bad: 36] memset ba 0 siz Us); sr] 38] lose otesocket) sol Lines 1-6 ae the header Sis. Line 8 defines the btfer size, Line 18 crests a socket. Line 19 iniiaizes a remose socket address ines 20-24 sc the ves forthe remote socket sess. ine 26 inialzs the ber ine 30 sends the ber contents to the sever. “Line 3 receives the responses rom the serves. [Line 35 prints the recived massage Line 36 reiniilizs the Baffler forthe next trac. Line 38 closes the conection 16.10 CONNECTION-ORIENTED CONCURRENT SERVER In this section, we ditcuss connection oriented, concurent client-server commutes tion using TCP and siream sockets, As mentioned im Cage 1 the servers the we ‘TCP are normally concurrent, This means thatthe server serves maa cients a the ‘ame time, Commnicaton is connecton-oientod, which means that «request is 4 Stream of byes that could arve in several segments, and the response could oo-apy Several sepments A connection is estublshedhetween the server and each client the Connection remains open until the eae stream i processed, andthe connection is terminated. or his typeof server. many connections maybe open a th sme time. Many pos are sed, bth server cn se aly ane Wel-kwn por. ho solduon i 10 ws ene ‘wei-known port and many ephemeral ports, The server suas a passive open athe well -Kaow por. A clint makes its intial approach fo this pet to make tbe conection Afr ‘the conection s made, the server asigns an ephemeral prt this connection to fe the ‘wel known por. Data transfer can now take place between these two ephemeral pots, 466 CHAPTER 16 SOCKET IeEREACE ea the clot site andthe ater a the server site. Te wellknown pot is now re for ‘she lent conection. The server must have one buffer for each connection. The Segments from the eli- es ae stored in the appropriate buffers and handled concurrently by the server ‘To provide tis servic, most implementations wse the concept of parent a ld servers. A Server tuning infinitely and accepting connections from cient sell a parent server The paren server uses the well-known pot. After the connection is ‘ade, the parent sever creates 8 child sererand an ephemeal pt and lets the child sever handle the clint. foes self wo that ican wait for another conection. I this ‘tio, we show how a server can srve sever elias concurrently using the services ‘Of TCP. Figure 16.26 shows the fowehart of evens fora server and a client Server ‘The server performs the folowing functions: 1. Opening a socket. The server sues the socket alt ask the operating sytem to create a socket. 2 Binding, The server ies the hind call w ask the operating sytem t0 ent fnformation in the socket situ eeaed inthe previous step. This information| consists of the local socket adress, 3, Listening The srr iss the sen cll fo conver socket int «passive socket, ‘sully called th Istening socket. stoning sockes doesnot connect ite to 3 socket tthe eer en it just waits fora connaion fos the ober end. The sever uses the socket descriptor andthe maximum number of requests or eonnecton, 4. Repeating the steps. The server repeats the folowing steps iniely ‘Accepting, Tho accep call create anew sock, called the accepting sock, for ‘ctu communication and contacts the next lien in line. After his eall, the ‘liens connected fo the new sock and the previous socket i reo ‘a. Forking. The sever now uss the fork call (See Chapter 4) to create a process st ike itself. This sealed the child process and the creators called the par ‘nt process. Aft his operation, te cliet is connected to bon he parent and the ld. Beh parent and child ave a isteaing and accepting socket Closing the accepting soeket. The pret issues th close call 19 else its sccepting socke, bt its Titening socket remains open forthe next ein . Closing the listening socket. The cil sswes the close call to clos it isten- ing socket, bur its accepting Socket remain open. Repeating, The child repeats the following steps as long ast has request rom the client ‘Reading, Tho child saves th read cll 0 rea as muuch data a ican press Jn one shot fom the incoming buffer assigned to the client. Processing, Te child processes the data ea fom the butter. ‘Weiting. The child issues the write cal to write the result of processing othe couigong buffer ssigned wo the client {Closing the communicating socket. Af the clot has ben served, the hid isses the close cll close the eommniatng socket. SECTION 16.10 CONNECTION-ORIENTED CONCURRENT SERVER 467 Figure 16.26 Soxter ince for conn 8 (CHAPTER 16. SOCKET INTERFACE Client “The clint performs the following fantions: 1 Opening a socket. The client sues the socket al to ask the operating system 0 rete a socket 2 Conectng The clicat isucs the connect all to ask the operating system to enter the socket address ofthe Server into the created socket structure. This ell also equet a connection withthe TCP onthe ober sie. 5. Repeating the steps. The cient repeats the flloing steps as long as it has requests to make 8. Writing, The client seus the writ allo write data ino he ougoing TCP ule ‘bs, Reading, The len issves the read cll og dita frm the incoming baler, 4 Closing. After the cient has finished it isses else cal to request TCP to cose the ‘connection. Ie ako sends an applicationefined “it pachet 1 ot the serve Figure 16.27 shows the relationships betwsen the lent, the parent server, and the cid Figure 1627 Reaonship been he loan he server 16.11 TCP CLIENT-SERVER PROGRAMS, ‘This section consis one simple server program and one simple clint program, The server isa generic sever We have included one PROCESS cal thats used to define {he server function, For the sake of simplicity, we have not included any emor-chocking ‘oreror handing Stemeats. SECTION 1611 TCPCLIENTSERVER PROGRAMS 4 Server Program Program 16.3 shows the server progr, ae a “Mio 20) ease? $9 CHAPTER 16. SOCKET ITERFACE Lines 1-6 ar the header les. Line 8 defines the bur sir ine 18 teu a passive socket, - Line 23 bind the pasive sncke tothe serve socket adress, ine 24 creates istening socket rm he passive wcket Line 28 crete an aceptng socket. Line 20 creates the cil process using fork Line 3 closes the parent accepting socket, Line 38 closes the cid listening socket Line 40 makes he child ead fom the aseptng cock in oop. Line 2 processes the dts read Line 4 makes the child wrt the result the accepting socket Line 47 closes the accepting socket. (Client Program “Te client program is shown Program 164. SECTION 16.11 TCP CLIENTSERVER PROGRAMS «71 17) stoke = seis AE-INET SOCK STREAM. 0 28} mine reo 0 io ere 19) rectal = AP INET 20). emuteAsinsit-gon oes ewe-inoen pind); 12] ptr gethostymame a-onn ") See 22) _memepy (cha) deemoreeinstces ade, 2a 5 ps 2s 2 sl 2 Bee a Fee e 42 CHAPTER 16. SOCKETINTERFACE Lines {-6 re the header files. Line 8 defines the ber size. ine 17 ereates.an ative socket. ‘Line 21 ges information about the remote host Server} and stores it invariable pointing toa hostntsouctre. ines 22-23 copy the socket address in hostent 10 the remote socket address ine 24 connect the clint tothe server ine 26 wes loop ogo dat roms the user and stores it ine butfer Line 28 writes the ater contents to the ative socket. Line 30 reads whats received from the server from the active socket Line 31 prints te contents of he rcaived bute Line 34 closes the active socket. 16.12 KEY TERMS ‘ees ansformation lide endian byte onder application program pent server pplication programing interfaces raw sekee APL) ae bigeeodin byte order oe eee socket aleess sta Socket Interfice connections iterative server ome ‘comecton-oriented concaen server acagram socket 16.13 SUMMARY ‘5 two aplication programs, ove running ona lea sytem and the ther running ‘on the remote sytem, need o communicate with ech other, network progam ring is required 1% The socket interface is a set of declarations, dfitions, and procedures for wring client-server programs. 1 The communication ture needed for socket programming isclled socket ‘Astrea socket ie wed with x comnecton-rinted protect such as TCP. ‘A ditgram socket is used witha connectinless protocol such as UDP. SECTION 1614 PRACTICESET 73 15 Ara sockets used by protocols suchas ICMP or OSPF that dire use tbe = vices of IP, ‘= Inbig-endian byte onder, the mos significant byte is stored inthe lowest memory ares ofthe data nit ‘4 Innle-endian bye order, the leas significant bytes stored inthe lowest memory ‘acess ofthe data ui ‘TCP uses he big-endian byte onder ‘Thee functions to manipulate bytes in nctwork programming are memset, max 93, and meme. {A funtion to provide information shout the remote ost is gethosbyname ‘The socket system cll rete a socket “The bind system call ads the local socks adress to an already crested socket. ‘The connect system cll establishes an active conection to a remote proces. ‘The listen system call conversa socket ato a passive socket “The accept system call creates anew socket for actual communication and can sss the next client inne ‘A connectionless process issues the Sedo system cll to send data wo a remote process '= A connectoness process issvs the reevirom system call 1 receive, from the ‘incoming quev, the datagrams sent a remote proces (= A connection orentd process isses the read system cll to recive datarane from a remote process ‘mA conecton-vinted process issues the write system call send datagrams a remote process. ‘2 The close system call loses asocko and terminates a TCP conection, 1 A conncctonles,terstive server uss the services of UDP and an serve oly one clint a ine ‘= A conecton-ointe, concurrent server uss the services of TCP and can seve ‘many cients simultaneous. ‘& A server runing innitely and scepting connections fom clin i ale aye 1m Avpirent server rete a hid server that scully handles the cient, 16.14 PRACTICE SET ‘Multiple-Choice Questions 1. AMAPLi8 set of declarations definitions 2 procedires 4. allofthe above 4 (CHAPTER 16. SOCKET INTERFACE 2 The structure to define an IP adress is called and contains fel called 2 in se 1. ar in_ader in. adr 4 in-cwin. 3. The eld inthe socket srocture is usally set to 0 fora process using he serves oF TCP oc UDP. family » ope © protcot 4, lal socket adress 4, The __ eld inthe socket sructare defines the protocol group. family bie © protocol A local sock address S. The ___ ied inthe sock rte is a suture of type sockaddr. a family by lea sock adress rome socket adress 4 bande 6 The socket is used with a comecton-riented protocol, datagram socket s sed with a connectionles proto fe daugeam 4 remote & The 1 diagram 4 remo socket is sed witha protocol that directly uses the services of IP 8 SECTION 1614 RARE SED as (On an TBM mainframe computer, the tating ues in meme fr the Pads 789.10 consis ‘ ooo00111 ' oo01000 «0001001 «, oop01010 (On aPC with an Intel processor, the staring address in memory forthe IP sds 789.10 contains 100000811 00001000 «©. 9001001, 4 oooo1010 ‘To convert a dotted decimal address to 32. binary adds, use the ation, hone 1 oat 4 neon ‘conver a 16-bit integer o network byt oder, use the rons obs © hood mont To convert a 32-bit integer fom peewee byte onfer to host byte onder, we ‘he __faetion. hon tos bot ab 4 network programming, the ___funetion copies the value of one fed 0 nother 1 memepy © mememp 4 memstr In network programming, the memcpy © mememp 4 menstr fonction function ses specified mun af hye 416 CHAPTER I6 16. 1”, vs. aL SOCKET INTEREACE Ifthe mememp funtion retusa value of 1, means 1 the fis felis the same asthe second eld te first eld greater than the second itd the fist elses han the econ fel 4 the fis eld has aval of 1 ‘The futon provides information abou the remote ost |. osent hostname «. gethosbyname 4 getmameothost, ‘A connestionless peocess issues the ystem call t receive, (fom the ‘incoming que, he datagrams sent bya remote process. 4 listen receive bind 4, retro ‘A conncton-tinted process issues the to a remote proces. 4. sendto bind accept 4 ie ‘A compectoness process ses the _ roses senda bin 6: listen 4. remote ‘The. system call ads the local socket aess to an already created socket address 1 crete bind 4 socket ‘The ____sgstem cll rete socket 1 socket © open & bind system cll send datagrams syste cll to send data to arene 6 SECTION 16.4 PRACTICESET 477 23, The 4 reovtrom close «shut bind 24. The system cll creates anew socket for actual communication and ea secs ext clea ine. a sccept 1 connect «bind crete 25, The system cll covers a socket nto passive socket. by iste «, socket bind 26, The____systen call establishes an sctive connection to a remote process accept bind «socket 4. connect 27. A connecton-rented process ssves the ‘rams fom aemete process, 2 road bs revtrom «titer 4. sendo 28, Te client program is__ because terminates afer it has ben served, by pasive «6. Binite 4 infinite 29, The sever program is because tis aways availabe, wating fora cent request by passive «fine 4 iniie system cll loses a socket and terminates TCP connection, system call to receive dax- ” (CHAPTER 16 SOCKET ITERFACE 30, A connecton-ointedconcurent server uses pons, a. ephemeral be wollknows 4 and 81, A connections iterative concurent server uses, ‘.ephemenl 1b welhinowa, a aandd 2A server serves mull clients, handing one request a ime | comecton-oiented iterative connection oriented concurrent «, conneetones iterative «. comectionlss concurrent 33, A_serer serves imple client simultaneously. 1, comecton-rentd iterative by campecton rented concurs «connectones iterative 4, conectoniessconcurest 34, A_sorver seth sento and receiom system. 1 conecton-riented iterative by, connection-rented concurrent os. connections iterative 4, comectonessconcuret 35.4 sever uses the read and write sytem calls, a connoston-orened iterative connection rented concurrent «, connectiones trative 4. conneetionless concurrent Exercises 36, Explain the difference between the bind function andthe connect function. 37. Expl the iffereae between the bind funedon and the listen funtion. 238, Expl the itferene between the socket function and the accep fencion. 239, Wt the necessary ines of code to connect a socket to the remote TELNET server arse sxcyyyeda 40, Wet the necessary lines of code to comect a socket to the emote FIP server at site yyzz.cd SPCTION 16.4 PRAcniCESEr 9 41, Wit the necessary lines of cde wo bind a socket othe local serve. 42, Write the necessary lines of code to create listening scket with queue sie of 10, 43, Wit the necessary ies of ede to create a child socket. 4, Describe te diferences between the Sendo and the write fntions 45, Describe he diferenes between the revi andthe read factions. 46, Descibe the relationship between the connect function and the TCP sate trans tion diagram. (See Chapter 12.) What isthe state of TCP after the connert incon? 47. Describe the relationship berween the bind fonction and the TCP state trasiten iagram. See Chapter 12.) What she sate of TCP af the bind fonction? 48. Descite the relationship ecweea the listen funtion and the TCP state tasten iagram. (See Chapter 12) What she state of TCP after he Viste union? 49, Deseibe te relationship between the accept fanction and the TCP state anston| siagram. (See Chapter 12) What isthe state of TCP afer the accept funtion? Programming Exercises 50, Write UDP client program that sends a string of characters toa server The cet oes not use a loop 51. Write a UDP server program tat receives sting of characters from alien, The server receives the sung fom the lon program in exerie 50 52. Write a TCP client program tbat des the same job asthe client program i cexerise 50. 53. Write a TCP server program thar dos tbe same job a the server program ia exerise 51 S54. Write UDP client program that aks forthe ime from a UDP server, 55. Write a UDP server program tha responds othe client in exerise 5. 56. Write TCP clint program that asks for the ime fran & TCP server, 57. Write TCP server program tat responds wo the client in exercise 36. 58. Write UDP cient program that behaves like a simple TET client, 59. Write a UDP server program that hchaves ike simple TFTP server, 0. Write TCP clint program that behaves Hk a siniple FP cient 61, Write TCP server program tat behaves like a simple FIP server, 62, Write TCP client program that behav like a simple TELNET client. 63. Write a TCP server progzam tat behaves like a simple TELNET serve. R17 BOOTP and DHCP Each computer that is attached to a TCP/IP interoet must know the following information wis Tastes fms subnet mask fm The BP acdres of router 1 The BP addiess ofa name server ‘This information i usualy stored ina configuration fle and accessed by the eompuse uring the boasts process. But what aout a dikless workstation ora computer wth ‘disk hats booted oe the Hest ie? In the case ofa diskless computes, Jn operating sytem and the networking. ft ware can be stored in read-only memory (ROM). Homever, the above informations nt Jepown tothe manufacurer and thus cannot be stored in ROM. The information is

You might also like