Вы находитесь на странице: 1из 16

5/2/2015

IPv4QuickGuide

IPV4QUICKGUIDE
http://www.tutorialspoint.com/ipv4/ipv4_quick_guide.htm

Copyrighttutorialspoint.com

IPV4OVERVIEW
Thiseraissaidtobetheeraofcomputers.Computershavesignificantlychangedlivesandthewayweused
tolive.Acomputingdevicewhenconnectedtoothercomputingdevicesenablesustosharedataand
informationatlightningfastspeed.

WhatisNetwork?
ANetworkintheworldofcomputersissaidtobeacollectionofinterconnectedhosts,viasomeshared
mediawhichcanbewiredorwireless.Acomputernetworkenablesitshoststoshareandexchangedata
andinformationoverthemedia.NetworkcanbeaLocalAreaNetworkspannedacrossanofficeorMetro
AreaNetworkspannedacrossacityorWideAreaNetworkwhichcanbespannedacrosscitiesand
provinces.
ComputernetworkcanbeassimpleastwoPCsconnectedtogetherviaasinglecoppercableoritcanbe
grownuptothecomplexitywhereeverycomputerinthisworldisconnectedtoeveryother,theInternet.A
networkthenincludesmoreandmorecomponentstoreachitsultimategoalofdataexchange.Belowisa
briefdescriptionofthecomponentsinvolvedincomputernetwork:
HostsHostsaresaidtobesituatedatultimateendofthenetwork,i.e.ahostisasourceof
informationandanotherhostwillbethedestination.Informationflowsendtoendbetweenhosts.A
hostcanbeausersPC,aninternetServer,adatabaseserveretc.
MediaIfwired,thenitcanbecoppercable,fiberopticcable,coaxialcableorifwireless,itcanbe
freetoairradiofrequencyorsomespecialwirelessband.Wirelessfrequenciescanbeusedto
interconnectremotesitestoo.
HubAhubisamultiportrepeateranditisusedtoconnecthostsinaLANsegment.Becauseoflow
throughputshubsarenowrarelyused.HubworksonLayer1P hysicalLayerofOSIModel.
SwitchASwitchisamultiportbridgeandisusedtoconnecthostsinaLANsegment.Switchesare
muchfasterthanHubsandoperateonwirespeed.SwitchworksonLayer2DataLinkLayer but
Layer3N etworkLayerswitchesarealsoavailable.
RouterArouterisLayer3N etworkLayerdevicewhichmakesroutingdecisionsforthe
data/informationsentforsomeremotedestination.Routersmakethecoreofanyinterconnected
networkandtheInternet.
GatewaysAsoftwareorcombinationofsoftwareandhardwareputtingtogetherworksfor
exchangingdataamongnetworkswhichareusingdifferentprotocolsforsharingdata.
FirewallSoftwareorcombinationofsoftwareandhardware,usedtoprotectusersdatafrom
unintendedrecipientsonthenetwork/internet.

Allcomponentsinanetworkultimatelyservethehosts.

HostAddressing
Communicationbetweenhostscanhappenonlyiftheycanidentifyeachotheronthenetwork.Inasingle
collisiondomainwhereeverypacketsentonthesegmentbyonehostisheardbyeveryotherhost hostscan
communicatedirectlyviaMACaddress.
MACaddressisafactorycoded48bitshardwareaddresswhichcanalsouniquelyidentifyahostinthe
world.Butifahostwantstocommunicatewitharemotehost,i.e.notinthesamesegmentorlogicallynot
connected,thensomemeansofaddressingisrequiredtoidentifytheremotehostuniquely.Alogical
http://www.tutorialspoint.com/cgibin/printpage.cgi

1/16

5/2/2015

IPv4QuickGuide

addressisgiventoallhostsconnectedtoInternetandthislogicaladdressiscalledInternetProtocol
Address.

IPV4OSIMODEL
InternationalStandardOrganizationhasawelldefinedModelforCommunicationSystemsknownasOpen
SystemInterconnection,orOSIModel.Thislayeredmodelisaconceptualizedviewofhowonesystem
shouldcommunicatewiththeother,usingvariousprotocolsdefinedineachlayer.Further,eachlayeris
designatedtoawelldefinedpartofcommunicationsystem.Forexample,thePhysicallayerdefinesallthe
componentsofphysicalnature,i.e.wires,frequencies,pulsecodes,voltagetransmissionetc.ofa
communicationsystem.
OSIModelhasfollowingsevenlayers:

ApplicationLayer Layer 7 :Thisiswheretheuserapplicationsitswhoneedstotransferdata


betweenoramonghosts.Forexample:HTTP,filetransferapplicationF T P andelectronicmailetc.
PresentationLayer Layer 6 :Thislayerhelpstounderstanddatarepresentationinoneform
onahosttootherhostintheirnativerepresentation.Datafromthesenderisconvertedtoonthe
wiredatageneralstandardf ormatandatthereceiversenditisconvertedtothenative
representationofthereceiver.
SessionLayer Layer 5 :Thislayerprovidessessionmanagementcapabilitiesbetweenhosts.
Forexampleifsomehostneedsapasswordverificationforaccessandifcredentialsareprovided
thenforthatsessionpasswordverificationdoesnothappenagain.Thislayercanassistin
synchronization,dialogcontrolandcriticaloperationmanagemente. g. , anonlinebanktransaction .
TransportLayer Layer 4 :Thislayerprovidesendtoenddatadeliverybetween/amonghosts.
ThislayertakesdatafromabovelayerandbreaksitintosmallerunitscalledSegmentsandthen
givesittoNetworklayerfortransmission.
NetworkLayer Layer 3 :Thislayerhelpstouniquelyidentifyhostsbeyondthesubnetsand
definesthepathwhichthepacketswillfolloworberoutedtoreachthedestination.
DataLinkLayer Layer 2 :Thislayertakestherawtransmissiondatasignal, pulsesetc. from
http://www.tutorialspoint.com/cgibin/printpage.cgi

2/16

5/2/2015

IPv4QuickGuide

PhysicalLayerandmakesDataFramesandsendsthattoupperlayerandviceversa.Thislayeralso
checksanytransmissionerrorsandsortitoutaccordingly.
PhysicalLayer Layer 1 :Thislayerdealswithhardwaretechnologyandactualcommunication
mechanismlikesignaling,voltage,cabletypeandlengthetc.

NetworkLayer
Thenetworklayerisresponsibleforcarryingdatafromonehosttoanother.Itprovidesmeanstoallocate
logicaladdressestohostsandidentifythemuniquelyusingthesame.Networklayertakesdataunitsfrom
TransportLayerandcutsthemintosmallerunitcalledDataPacket.
Networklayerdefinesthedatapath,thepacketsshouldfollowtoreachthedestination.Routersworkon
thislayerandprovidesmechanismtoroutedatatoitsdestination.

IPV4TCP/IPMODEL
MajorlyoftheinternetusesaprotocolsuitecalledtheInternetProtocolSuitealsoknownasTCP/IP
protocolsuite.Thissuiteisacombinationofprotocolswhichencompassesanumberofdifferentprotocols
fordifferentpurposeandneed.BecausethetwomajorprotocolsinthissuitesareTCP
T ransmissionC ontrolP rotocol andIPI nternetP rotocol ,thisiscommonlytermedasTCP/IPProtocol
suite.Thisprotocolsuitehasitsownreferencemodelwhichitfollowsovertheinternet.Incontrastwith
OSImodel,thismodelofprotocolscontainslesslayers.

[ComparativedepictionofOSIandTCP/IPReferenceModels]
Thismodelisindifferenttotheactualhardwareimplementation,i.e.PhysicallayerofOSIModel.Thisis
whythismodelcanbeimplementedonalmostallunderlyingtechnologies.TransportandInternetlayers
correspondstothesamepeerlayers.AllthreetoplayersofOSIModelarecompressedtogetherinsingle
ApplicationlayerofTCP/IPModel.

InternetProtocolVersion4I P v4
InternetProtocolisoneofthemajorprotocolinTCP/IPprotocolssuite.ThisprotocolworksatNetwork
layerofOSImodelandatInternetlayerofTCP/IPmodel.Thusthisprotocolhastheresponsibilityof
http://www.tutorialspoint.com/cgibin/printpage.cgi

3/16

5/2/2015

IPv4QuickGuide

identificationofhostsbasedupontheirlogicaladdressesandtoroutedatabetween/amongthemoverthe
underlyingnetwork.
IPprovidesamechanismtouniquelyidentifyhostbyIPaddressingscheme.IPusesbesteffortdelivery,
i.e.itdoesnotguaranteethatpacketswouldbedeliveredtodestinedhostbutitwilldoitsbesttoreachthe
destination.InternetProtocolversion4uses32bitlogicaladdress.

IPV4PACKETSTRUCTURE
InternetProtocolbeingalayer3protocolOS I takesdataSegmentsfromlayer4T ransport anddividesit
intowhatscalledpacket.IPpacketencapsulatesdataunitreceivedfromabovelayerandaddsitsown
headerinformation.

TheencapsulateddataisreferredtoasIPPayload.IPheadercontainsallthenecessaryinformationto
deliverthepacketattheotherend.

IPheaderincludesmanyrelevantinformationincludingVersionNumber,which,inthiscontext,is4.Other
detailsareasfollows:
Version:Versionno.ofInternetProtocolusede. g. I P v4
IHL:InternetHeaderLength,LengthofentireIPheader
DSCP:DifferentiatedServicesCodePoint,ThisisTypeofService.
ECN:ExplicitCongestionNotification,carriesinformationaboutthecongestionseenintheroute.
TotalLength:LengthofentireIPPacketincludingI P headerandI P P ayload
Identification:IfIPpacketisfragmentedduringthetransmission,allthefragmentscontainsame
identificationno.toidentifyoriginalIPpackettheybelongto.
http://www.tutorialspoint.com/cgibin/printpage.cgi

4/16

5/2/2015

IPv4QuickGuide

Flags:Asrequiredbythenetworkresources,ifIPPacketistoolargetohandletheseflagstellthat
iftheycanbefragmentedornot.Inthis3bitflag,theMSBisalwayssetto0.
FragmentOffset:ThisoffsettellstheexactpositionofthefragmentintheoriginalIPPacket.
TimetoLive:Toavoidloopinginthenetwork,everypacketissentwithsomeTTLvalueset,which
tellsthenetworkhowmanyroutershopsthispacketcancross.Ateachhop,itsvalueisdecremented
byoneandwhenthevaluereacheszero,thepacketisdiscarded.
Protocol:TellstheNetworklayeratthedestinationhost,towhichProtocolthispacketbelongsto,
i.e.thenextlevelProtocol.ForexampleprotocolnumberofICMPis1,TCPis6andUDPis17.
HeaderChecksum:Thisfieldisusedtokeepchecksumvalueofentireheaderwhichisthenused
tocheckifthepacketisreceivederrorfree.
SourceAddress:32bitaddressoftheSenderorsourceofthepacket.
DestinationAddress:32bitaddressoftheReceiverordestination ofthepacket.
Options:Thisisoptionalfield,whichisusedifthevalueofIHLisgreaterthan5.Theseoptionmay
containvaluesforoptionssuchasSecurity,RecordRoute,TimeStampetc.

IPV4ADDRESSING
IPv4supportsthreedifferenttypeofaddressingmodes:

UnicastAddressingMode:
Inthismode,dataissentonlytoonedestinedhost.TheDestinationAddressfieldcontains32bitIP
addressofthedestinationhost.Hereclientsendsdatatothetargetedserver:

BroadcastAddressingMode:
Inthismodethepacketisaddressedtoallhostsinanetworksegment.TheDestinationAddressfield
containsspecialbroadcastaddressi.e.255.255.255.255.Whenahostseesthispacketonthenetwork,it
isboundtoprocessit.Hereclientsendspacket,whichisentertainedbyalltheServers:

http://www.tutorialspoint.com/cgibin/printpage.cgi

5/16

5/2/2015

IPv4QuickGuide

MulticastAddressingMode:
Thismodeisamixofprevioustwomodes,i.e.thepacketsentisneitherdestinedtoasinglehostnorallthe
hostonthesegment.Inthispacket,theDestinationAddresscontainsspecialaddresswhichstartswith
224.x.x.xandcanbeentertainedbymorethanonehost.

HereaserversendspacketswhichisentertainedbymorethanoneServers.EverynetworkhasoneIP
addressreservedfornetworknumberwhichrepresentsthenetworkandoneIPaddressreservedfor
BroadcastAddress,whichrepresentsallthehostinthatnetwork.

HierarchicalAddressingScheme
IPv4useshierarchicaladdressingscheme.AnIPaddresswhichis32bitsinlength,isdividedintotwoor
threepartsasdepicted:

http://www.tutorialspoint.com/cgibin/printpage.cgi

6/16

5/2/2015

IPv4QuickGuide

AsingleIPaddresscancontaininformationaboutthenetworkanditssubnetworkandultimatelythehost.
ThisschemeenablesIPAddresstobehierarchicalwhereanetworkcanhavemanysubnetworkswhichin
turncanhavemanyhosts.

SubnetMask
The32bitIPaddresscontainsinformationaboutthehostanditsnetwork.Itisverynecessaryto
distinguishtheboth.Forthis,routersuseSubnetMask,whichisaslongasthesizeofthenetworkaddress
intheIPaddress.SubnetMaskisalso32bitslong.IftheIPaddressinbinaryisANDedwithitsSubnet
Mask,theresultyieldstheNetworkaddress.Forexample,saytheIPAddress192.168.1.152andtheSubnet
Maskis255.255.255.0then

ThiswaySubnetMasthelpsextractNetworkIDandHostfromanIPAddress.Itcanbeidentifiednowthat
192.168.1.0istheNetworknumberand192.168.1.152isthehostonthatnetwork.

BinaryRepresentation
Thepositionalvaluemethodisthesimplestformofconvertingbinaryfromdecimalvalue.IPaddressis32
bitvaluewhichisdividedinto4octets.Abinaryoctetcontains8bitsandthevalueofeachbitcanbe
determinedbythepositionofbitvalue'1'intheoctet.

Positionalvalueofbitsisdeterminedby2raisedtopowerposition 1 ,thatisthevalueofabit1at
position6is261thatis25thatis32.Thetotalvalueoftheoctetisdeterminedbyaddingupthepositional
valueofbits.Thevalueof11000000is128+64=192.SomeExamplesareshowninthetablebelow:

http://www.tutorialspoint.com/cgibin/printpage.cgi

7/16

5/2/2015

IPv4QuickGuide

IPV4ADDRESSCLASSES
InternetProtocolhierarchycontainsseveralclassesofIPAddressestobeusedefficientlyinvarious
situationaspertherequirementofhostspernetwork.Broadly,IPv4Addressingsystemisdividedinto5
classesofIPAddresses.Allthe5classesareidentifiedbythefirstoctetofIPAddress.

InternetCorporationforAssignedNamesandNumbersresponsibleforassigningIP
addresses.

Thefirstoctetreferredhereistheleftmostofall.Theoctetsnumberedasfollowsdepictingdotted
decimalnotationofIPAddress:

http://www.tutorialspoint.com/cgibin/printpage.cgi

8/16

5/2/2015

IPv4QuickGuide

Numberofnetworksandnumberofhostsperclasscanbederivedbythisformula:

WhencalculatinghostsIPaddresses,2IPaddressesaredecreasedbecausetheycannotbeassignedto
hostsi.e.thefirstIPofanetworkisnetworknumberandthelastIPisreservedforBroadcastIP.

ClassAAddress
Thefirstbitofthefirstoctetisalwayssetto0zero.Thusthefirstoctetrangesfrom1127,i.e.

ClassAaddressesonlyincludeIPstartingfrom1.x.x.xto126.x.x.xonly.TheIPrange127.x.x.xisreserved
forloopbackIPaddresses.
ThedefaultsubnetmaskforClassAIPaddressis255.0.0.0whichimpliesthatClassAaddressingcanhave
126networks(272)and16777214hosts(2242).
ClassAIPaddressformatthus,is0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH

ClassBAddress
AnIPaddresswhichbelongstoclassBhasthefirsttwobitsinthefirstoctetsetto10,i.e.

ClassBIPAddressesrangefrom128.0.x.xto191.255.x.x.ThedefaultsubnetmaskforClassBis
255.255.x.x.
ClassBhas16384(214)Networkaddressesand65534(2162)Hostaddresses.
ClassBIPaddressformatis,10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH

ClassCAddress
ThefirstoctetofClassCIPaddresshasitsfirst3bitssetto110,thatis

ClassCIPaddressesrangefrom192.0.0.xto192.255.255.x.ThedefaultsubnetmaskforClassBis
http://www.tutorialspoint.com/cgibin/printpage.cgi

9/16

5/2/2015

IPv4QuickGuide

255.255.255.x.
ClassCgives2097152(221)Networkaddressesand254(282)Hostaddresses.
ClassCIPaddressformatis110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH

ClassDAddress
VeryfirstfourbitsofthefirstoctetinClassDIPaddressesaresetto1110,givingarangeof

ClassDhasIPaddressragefrom224.0.0.0to239.255.255.255.ClassDisreservedforMulticasting.In
multicastingdataisnotdestinedforaparticularhost,that'swhythereisnoneedtoextracthostaddress
fromtheIPaddress,andClassDdoesnothaveanysubnetmask.

ClassEAddress
ThisIPClassisreservedforexperimentalpurposesonlylikeforR&DorStudy.IPaddressesinthisclass
rangesfrom240.0.0.0to255.255.255.254.LikeClassD,thisclasstooisnotequippedwithanysubnet
mask.

IPV4SUBNETTINGCI DR
EachIPclassisequippedwithitsowndefaultsubnetmaskwhichboundsthatIPclasstohaveprefixed
numberofNetworksandprefixednumberofHostspernetwork.ClassfulIPaddressingdoesnotprovide
anyflexibilityofhavinglessnumberofHostsperNetworkormoreNetworksperIPClass.
CIDRorClasslessInterDomainRoutingprovidestheflexibilityofborrowingbitsofHostpartofthe
IPaddressandusingthemasNetworkinNetwork,calledSubnet.Byusingsubnetting,onesingleClassA
IPaddressescanbeusedtohavesmallersubnetworkswhichprovidesbetternetworkmanagement
capabilities.

ClassASubnets
InClassA,onlythefirstoctetisusedasNetworkidentifierandrestofthreeoctetsareusedtobeassigned
toHostsi. e. 16777214H ostsperN etwork .TomakemoresubnetinClassA,bitsfromHostpartare
borrowedandthesubnetmaskischangedaccordingly.
Forexample,ifoneMSBM ostS ignif icantBit isborrowedfromhostbitsofsecondoctetandaddedto
Networkaddress,itcreatestwoSubnets(21=2)with(2232)8388606HostsperSubnet.
TheSubnetmaskischangedaccordinglytoreflectsubnetting.Givenbelowisalistofallpossible
combinationofClassAsubnets:

http://www.tutorialspoint.com/cgibin/printpage.cgi

10/16

5/2/2015

IPv4QuickGuide

Incaseofsubnettingtoo,theveryfirstandlastIPaddressofeverysubnetisusedforSubnetNumberand
SubnetBroadcastIPaddressrespectively.BecausethesetwoIPaddressescannotbeassignedtohosts,
Subnettingcannotbeimplementedbyusingmorethan30bitsasNetworkBitswhichprovideslessthan
twohostspersubnet.

ClassBSubnets
ByDefault,usingClassfulNetworking,14bitsareusedasNetworkbitsproviding(214)16384Networks
and(2161)65534Hosts.ClassBIPAddressescanbesubnettedthesamewayasClassAaddresses,by
borrowingbitsfromHostbits.BelowisgivenallpossiblecombinationofClassBsubnetting:

http://www.tutorialspoint.com/cgibin/printpage.cgi

11/16

5/2/2015

IPv4QuickGuide

ClassCSubnets
ClassCIPaddressesnormallyassignedtoaverysmallsizenetworkbecauseitonlycanhave254hostsina
network.GivenbelowisalistofallpossiblecombinationofsubnettedClassBIPaddress:

IPV4VARIABLELENGTHSUBNETMASKINGV LSM
InternetServiceProvidersmayfaceasituationwheretheyneedtoallocateIPsubnetsofdifferentsizesas
pertherequirementofcustomer.OnecustomermayaskClassCsubnetof3IPaddressesandanothermay
askfor10IPs.ForanISP,itisnotfeasibletodividetheIPaddressesintofixedsizesubnets,ratherhemay
wanttosubnetthesubnetsinsuchawaywhichresultsinminimumwastageofIPaddresses.
Forexample,anadministratorhave192.168.1.0/24network.Thesuffix/24pronouncedas " slash24 "
tellsthenumberofbitsusedfornetworkaddress.Heishavingthreedifferentdepartmentswithdifferent
numberofhosts.Salesdepartmenthas100computers,Purchasedepartmenthas50computers,Accounts
has25computersandManagementhas5computers.InCIDR,thesubnetsareoffixedsize.Usingthesame
methodologytheadministratorcannotfulfillalltherequirementsofthenetwork.
ThefollowingprocedureshowshowVLSMcanbeusedinordertoallocatedepartmentwiseIPaddresses
asmentionedintheexample.

http://www.tutorialspoint.com/cgibin/printpage.cgi

12/16

5/2/2015

IPv4QuickGuide

Step1
MakealistofSubnetspossible.

Step2
SorttherequirementsofIPsindescendingorderH ighesttoLowest .
Sales100
Purchase50
Accounts25
Management5

Step3
AllocatethehighestrangeofIPstothehighestrequirement,solet'sassign192.168.1.0/25
255.255.255.128 toSalesdepartment.ThisIPsubnetwithNetworknumber192.168.1.0has126validHost
IPaddresseswhichsatisfytherequirementofSalesDepartment.ThesubnetMaskusedforthissubnethas
10000000asthelastoctet.

Step4
Allocatethenexthighestrange,solet'sassign192.168.1.128/26255.255.255.192 toPurchasedepartment.
ThisIPsubnetwithNetworknumber192.168.1.128has62validHostIPAddresseswhichcanbeeasily
assignedtoallPurchasedepartment'sPCs.Thesubnetmaskusedhas11000000inthelastoctet.

Step5
Allocatethenexthighestrange,i.e.Accounts.Therequirementof25IPscanbefulfilledwith192.168.1.192
/27255.255.255.224 IPsubnet,whichcontains30validhostIPs.ThenetworknumberofAccounts
departmentwillbe192.168.1.192.Thelastoctetofsubnetmaskis11100000.

Step6
AllocatenexthighestrangetoManagement.TheManagementdepartmentcontainsonly5computers.The
subnet192.168.1.224/29withMask255.255.255.248hasexactly6validhostIPaddresses.Sothiscanbe
assignedtoManagement.Thelastoctetofsubnetmaskwillcontain11111000.
ByusingVLSM,theadministratorcansubnettheIPsubnetsuchawaythatleastnumberofIPaddresses
arewasted.EvenafterassigningIPstoeverydepartment,theadministrator,inthisexample,stillleftwith
plentyofIPaddresseswhichwasnotpossibleifhehasusedCIDR.

IPV4RESERVEDADDRESSES
http://www.tutorialspoint.com/cgibin/printpage.cgi

13/16

5/2/2015

IPv4QuickGuide

TherearefewReservedIPv4addressspaceswhichcannotbeusedontheinternet.Theseaddressesserve
specialpurposeandcannotberoutedoutsideLocalAreaNetwork.

PrivateIPAddresses
EveryclassofIP, A,B&C hassomeaddressesreservedasPrivateIPaddresses.TheseIPscanbeused
withinanetwork,campus,companyandareprivatetoit.TheseaddressescannotberoutedonInternetso
packetscontainingtheseprivateaddressesaredroppedbytheRouters.

Inordertocommunicatewithoutsideworld,Internet,theseIPaddressesmusthavetobetranslatedto
somepublicIPaddressesusingNATprocessorWebProxyservercanbeused.
Thesolepurposetocreateseparaterangeofprivateaddressesistocontrolassignmentofalreadylimited
IPv4addresspool.ByusingprivateaddressrangewithinLAN,therequirementofIPv4addresseshas
globallydecreasedsignificantly.IthasalsohelpeddelayingtheIPv4addressexhaustion.
IPclass,whileusingprivateaddressrange,canbechosenasperthesizeandrequirementofthe
organization.LargerorganizationmaychooseclassAprivateIPaddressrangewheresmallermayoptfor
classC.TheseIPaddressescanbefurthersubnettedbeassignedtodepartmentswithinanorganization.

LoopbackIPAddresses
TheIPaddressrange127.0.0.0127.255.255.255isreservedforloopbacki.e.aHostsselfaddress.Also
knownaslocalhostaddress.ThisloopbackIPaddressismanagedentirelybyandwithintheoperating
system.Usingloopbackaddresses,enabletheServerandClientprocessesonasinglesystemto
communicatewitheachother.Whenaprocesscreatesapacketwithdestinationaddressasloopback
address,theoperatingsystemloopsitbacktoitselfwithouthavinganyinterferenceofNIC.
Datasentonloopbackisforwardbytheoperatingsystemtoavirtualnetworkinterfacewithinoperating
system.Thisaddressismostlyusedfortestingpurposeslikeclientserverarchitectureonasinglemachine.
Otherthanthat,ifahostmachinecansuccessfullyping127.0.0.1oranyIPfromloopbackrange,implies
thattheTCP/IPsoftwarestackonthemachineissuccessfullyloadedandworking.

LinklocalAddresses
IncaseoftheHostisnotabletoacquireanIPaddressfromDHCPserverandithasnotbeenassignedany
IPaddressmanually,thehostcanassignitselfanIPaddressfromarangeofreservedLinklocaladdresses.
Linklocaladdressrangeis169.254.0.0169.254.255.255.
AssumeanetworksegmentwhereallsystemsareconfiguredtoacquireIPaddressesfromaDHCPserver
connectedtothesamenetworksegment.IftheDHCPserverisnotavailable,nohostonthesegmentwill
beabletocommunicatetoanyother.Windows98orlater,andMacOS8.0orlater supportthisfunctionality
ofselfconfigurationofLinklocalIPaddress.InabsenceofDHCPserver,everyhostmachinerandomly
choosesanIPaddressfromtheabovementionedrangeandthencheckstoascertainbymeansofARP,if
someotherhostalsohasnotconfiguredhimselfwiththesameIPaddress.Onceallhostareusinglinklocal
addressesofsamerange,theycancommunicatetoeachother.
TheseIPaddressescannothelpsystemtocommunicatewhentheydonotbelongtothesamephysicalor
logicalsegment.TheseIPsarealsonotroutable.

IPV4EXAMPLE
ThissectiontellshowactualcommunicationhappensontheNetworkusingInternetProtocolversion4.
http://www.tutorialspoint.com/cgibin/printpage.cgi

14/16

5/2/2015

IPv4QuickGuide

Packetflowinnetwork
AllthehostsinIPv4environmentareassigneduniquelogicalIPaddresses.Whenahostwantstosend
somedatatoanotherhostonthenetwork,itneedsthephysicalM AC addressofthedestinationhost.To
gettheMACaddress,thehostbroadcastsARPmessageandaskstogivetheMACaddresswhoeveristhe
ownerofdestinationIPaddress.AllthehostonthatsegmentreceivesARPpacketbutonlythehostwhich
hasitsIPmatchingwiththeoneinARPmessage,replieswithitsMACaddress.Oncethesenderreceives
theMACaddressofreceivingstation,dataissentonthephysicalmedia.
Incase,theIPdoesnotbelongtothelocalsubnet.ThedataissenttothedestinationbymeansofGateway
ofthesubnet.Tounderstandthepacketflowwemustfirstunderstandfollowingcomponents:
MACAddress:MediaAccessControlAddressis48bitfactoryhardcodedphysicaladdressof
networkdevicewhichcanuniquelybeidentified.Thisaddressisassignedbydevicemanufacturers.
AddressResolutionProtocol:AddressResolutionProtocolisusedtoacquiretheMACaddress
ofahostwhoseIPaddressisknown.ARPisaBroadcastpacketwhichisreceivedbyallthehostin
thenetworksegment.ButonlythehostwhoseIPismentionedinARPrespondstoitprovidingits
MACaddress.
ProxyServer:ToaccessInternet,networksusesProxyServerwhichhasapublicIPassigned.All
PCsrequestProxyServerforaServeronInternet,ProxyServeronbehalfofPCsendstherequest
toserverandwhenitreceivesresponsefromtheServer,theProxyServerforwardsittotheclient
PC.ThisisawaytocontrolInternetaccessincomputernetworksandithelpstoimplementweb
basedpolicies.
DynamicHostControlProtocol:DHCPisaservicebywhichahostisassignedIPaddressfrom
apredefinedaddresspool.DHCPserveralsoprovidesnecessaryinformationsuchasGatewayIP,
DNSServerAddress,leaseassignedwiththeIPetc.ByusingDHCPservicesnetworkadministrator
canmanageassignmentofIPaddressesatease.
DomainNameSystem:ThisisverylikelythatauserdoesnotknowtheIPaddressofaremote
Serverhewantstoconnectto.Butheknowsthenameassignedtoitforexample,
tutorialpoints.com.Whentheusertypesinthenameofremoteserverhewantstoconnecttothe
localhostbehindthescreenssendsaDNSquery.DomainNameSystemisamethodtoacquiretheIP
addressofthehostwhoseDomainNameisknown.
NetworkAddressTranslation:AlmostallPCsinacomputernetworkareassignedprivateIP
addresseswhicharenotroutableonInternet.AssoonasarouterreceivesanIPpacketwithprivate
IPaddressitdropsit.InordertoaccessServersonpublicprivateaddress,computernetworksuse
anaddresstranslationservice,whichtranslatesbetweenpublicandprivateaddresses,called
NetworkAddressTranslation.WhenaPCsendsanIPpacketoutofaprivatenetwork,NATchanges
theprivateIPaddresswithpublicIPaddressandviceversa.
Wecannowdescribethepacketflow.Assumethatauserwantstoaccesswww.TutorialsPoint.comfrom
herpersonalcomputer.SheishavinginternetconnectionfromherISP.Thefollowingstepswillbetaken
bythesystemtohelpherreachdestinationwebsite.

Step:1AcquiringanIPAddressDH C P
WhenusersPCbootsup,itsearchesforaDHCPservertoacquireanIPaddress.Forthesame,PCsendsa
DHCPDISCOVERbroadcastwhichisreceivedbyoneormoreDHCPserversonthesubnetandtheyall
respondwithDHCPOFFERwhichincludesallthenecessarydetailslikeIP,subnet,Gateway,DNSetc.PC
sendsDHCPREQUESTpacketinordertorequesttheofferedIPaddress.Finally,DHCPsendsDHCPACK
packettotellPCthatitcankeeptheIPforsomegivenamountoftimeakaIPlease.
AlternativelyaPCcanbeassignedanIPaddressmanuallywithouttakinganyhelpfromDHCPServer.
WhenaPCiswellconfiguredwithIPaddressdetails,itcannowspeaktoothercomputersallovertheIP
enablednetwork.

Step:2DNSquery
http://www.tutorialspoint.com/cgibin/printpage.cgi

15/16

5/2/2015

IPv4QuickGuide

Whenauseropensawebbrowserandtypeswww.tutorialpoints.comwhichisadomainnameandaPC
doesnotunderstandhowtocommunicatewiththeserverusingdomainnames.PCsendsaDNSqueryout
onthenetworkinordertoobtaintheIPaddresspertainingtothedomainname.ThepreconfiguredDNS
serverrespondsthequerywithIPaddressofthedomainnamespecified.

Step:3ARPrequest
ThePCfindsthatthedestinationIPaddressdoesnotbelongtohisownIPaddressrangeandithasto
forwardtherequesttotheGateway.GatewayinthisscenariocanbearouteroraProxyServer.Though
GatewaysIPaddressisknowntotheclientmachinebutcomputersdonotexchangedataonIPaddresses
rathertheyneedmachineshardwareaddresswhichisLayer2factorycodedMACaddress.Toobtainthe
MACaddressoftheGatewaytheclientPCbroadcastsanARPrequestsaying"WhoownsthisIPaddress?"
TheGatewayinresponsetotheARPquerysendsitMACaddress.UponreceivingMACaddressPCsends
thepacketstoGateway.
AnIPpackethasbothsourceanddestinationaddressesandthisconnectshostwitharemotehostlogically.
WhereasMACaddresseshelpssystemsonasinglenetworksegmenttotransferactualdata.Thisis
importantthatsourceanddestinationMACaddresseschangeastheytravelacrosstheInternet
segmentbysegmentbutsourceanddestinationIPaddressneverchanges.

IPV4SUMMARY
TheInternetProtocolversion4wasdesignedtobeallocatedtoapprox.4.3billionaddresses.Atthe
beginningofInternetthiswasconsideredamuchwideraddressspaceforwhichtherewasnothingtoworry
about.
ThesuddengrowthinInternetusersanditswidespreadusehasexponentiallyincreasethenumberof
deviceswhichneedsrealanduniqueIPtobeabletocommunicate.Gradually,anIPisrequiredbyalmost
everydigitalequipmentwhichweremadetoeasehumanlife,suchasMobilePhones,Carsandother
electronicdevices.Thenumberofdevicesotherthancomputers/routers expandedthedemandforextra
IPaddresses,whichwerenotconsideredearlier.
AllocationofIPv4isgloballymanagedbyInternetAssignedNumbersAuthorityI AN A under
coordinationwithInternetCorporationforAssignedNamesandNumbersI C AN N .IANAworksclosely
withRegionalInternetRegistries,whichinturnsareresponsibleforefficientlydistributeIPaddressin
theirterritories.TherearefivesuchRIRexist.AccordingtoIANAreports,alltheIPv4addressblockshave
beenallocated.Tocopeupwiththesituation,asanearlystepsthefollowingpracticeswerebeingdone:
PrivateIPs:FewblocksofIPsweredeclaredforprivateusewithinaLANsothattherequirement
forpublicIPaddressescanbereduced.
NAT:NetworkaddresstranslationisamechanismbywhichmultiplePCs/hostswithprivateIP
addressesareenabledtoaccessusingoneorfewpublicIPaddresses.
UnusedPublicIPswerereclaimedbyRIRs.

InternetProtocolv6I P v6
IETFI nternetEngineeringT askF orce hasredesignedIPaddressesandtomitigatethedrawbacksofIPv4.
ThenewIPaddresshasversion6andis128bitaddress,bywhicheverysingleinchoftheearthcanbe
givenmillionsofIPaddresses.
TodaymajorityofdevicesrunningonInternetareusingIPv4anditisnotpossibletoshiftthemtoIPv6in
comingdays.TherearemechanismprovidedbyIPv6,bywhichIPv4andIPv6cancoexistunlessthe
InternetentirelyshiftstoIPv6:
DualIPStack
Tunneling6to4and4to6
NATProtocolTranslation
http://www.tutorialspoint.com/cgibin/printpage.cgi

16/16

Вам также может понравиться