第七课:子网掩码及其作用
字号: 小
中 大
| 打印 发布:
2007-04-30 作者:
来源: 本站原创 查看:
Protocols,Lesson7:SubnetmasksandtheireffectThereareafewdifferentwaystoapproachsubnetting,anditcangetconfusingbecauseofthecomplexityofsomesubnetsandtheflexibilitytheyoffer.ForthisreasonIcreatedthislittleparagraphtoletyouknowhowwearegoingtoapproachandlearnsubnetting.Wearegoingtoanalyzethecommonsubnetmasksforeachclass,givingdetailedexamplesformostofthemandallowingyouto"see"howeverythingiscalculatedandunderstandthedifferenteffectsasubnetmaskcanhaveasyouchangeit.Onceyouhavemasteredthis,youcanthengoonandcreateyourcustomsubnetmasksusinganytypeofclass.Defaultsubnetmasksofeachclass
Bynowyoushouldhavesomeideawhatthesubnetmaskdoesandhowit'susedtopartitionanetwork.WhatyouneedtokeepinmindisthateachclasshasitsDEFAULTsubnetmask,whichwecanchangetosuitourneeds.Ihavealreadymentionedthisinthepreviouspage,butweneedtolookintoitinabitmoredetail.Thepicturebelowshowsourthreenetworkclasseswiththeirrespectivedefaultsubnetmasks:
TheeffectofasubnetmaskonanIPaddress
IntheIPclassespageweanalyzedandshowedhowanIPaddressconsistsoftwoparts,1)ThenetworkIDand2)ThehostID.ThisruleappliesforallIPaddressesthatusethedefaultsubnetmask,sowecallthemclassfulIPaddresses.Wecanseethisonceagaininthepicturebelow,wheretheIPaddressisanalyzedinbinary,becausethisisthewayyoushouldworkwhendealingwithsubnetmasks:
WearelookingatanIPaddresswithitssubnetmaskforthefirsttime.Whatwehavedoneistakethedecimalsubnetmaskandconvertedittobinary,alongwiththeIPaddress.Itisessentialtoworkinbinarybecauseitmakesthingsclearerandwecanavoidmakingsillymistakes.Theones(1)inthesubnetmask"lock"or,ifyoulike,definethenetworkIDportion.IfwechangeanybitwithinthenetworkIDoftheIPaddress,thenweimmediatelymovetoadifferentnetwork.Sointhisexample,wehavea24bitsubnetmask.NOTE:AllclassCclassfulIPaddresseshavea24bitsubnetmask(255.255.255.0).AllclassBclassfulIPaddresseshavea16bitsubnetmask(255.255.0.0).AllclassAclassfulIPaddresseshavean8bitsubnetmask(255.0.0.0).Ontheotherhand,theuseofanIPaddresswithasubnetmaskotherthanthedefaultresultsinthestandardhostbits(theBitsusedtoidentifytheHOSTID)beingdividedintotwoparts:asubnetIDandHostID.ThesetypesofIPaddressesarecalledclasslessIPaddresses.Inordertounderstandwhata"classlessIPaddress"iswithoutgettingconfused,wearegoingtotakethesameIPaddressasabove,andmakeitaclasslessIPaddressbychangingthedefaultsubnetmask:
LookingatthepictureaboveyouwillnownoticethatwehaveasubnetID,somethingthatdidn'texistbefore.Asthepictureexplains,wehaveborrowedthreebitsfromthehostIDandusedthemtocreateasubnetID.EffectivelywepartitionedourclassCnetworkintosmallernetworks.Ifyou'rewonderinghowmanysmallernetworks,you'llfindtheansweronthenextpage.IpreferthatyouunderstandingeverythinghereratherthanblastingyouwithmoresubnetID's,bitsandalltherest:)Summary
InthispagewesawthedefaultsubnetmaskofeachclassandalsointroducedtheclassfulandclasslessIPaddresses,whicharearesultofusingvarioussubnetmasks.WhenweuseIPaddresseswiththeirdefaultsubnetmasks,e.g.192.168.0.10isaclassCIPaddresssothedefaultsubnetmaskwouldbe255.255.255.0,thentheseare"classfulIPaddresses."Ontheotherhand,classlessIPaddresseshavetheirsubnetmaskmodifiedinawaysothatthereisa"subnetID".ThissubnetIDiscreatedbyborrowingbitsfromthehostIDportion.Thepicturebelowshowsusbothexamples:
Ihopethatyouhaveunderstoodthenewconceptsandmaterialonthispage.Nextwearegoingtotalkaboutsubnetbits,learnhowtocalculatehowmanybitscertainsubnetmasksareandseethedifferentandmostusedsubnetmasksavailable.Ifyouthinkyoumighthavenotunderstoodafewsectionsthroughoutthispage,Iwouldsuggestyoureaditoncemore:)
TAG: