Linux Network Traffic ControlImplementation OverviewWord下载.docx

上传人:b****3 文档编号:18181379 上传时间:2022-12-14 格式:DOCX 页数:19 大小:453.38KB
下载 相关 举报
Linux Network Traffic ControlImplementation OverviewWord下载.docx_第1页
第1页 / 共19页
Linux Network Traffic ControlImplementation OverviewWord下载.docx_第2页
第2页 / 共19页
Linux Network Traffic ControlImplementation OverviewWord下载.docx_第3页
第3页 / 共19页
Linux Network Traffic ControlImplementation OverviewWord下载.docx_第4页
第4页 / 共19页
Linux Network Traffic ControlImplementation OverviewWord下载.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

Linux Network Traffic ControlImplementation OverviewWord下载.docx

《Linux Network Traffic ControlImplementation OverviewWord下载.docx》由会员分享,可在线阅读,更多相关《Linux Network Traffic ControlImplementation OverviewWord下载.docx(19页珍藏版)》请在冰豆网上搜索。

Linux Network Traffic ControlImplementation OverviewWord下载.docx

intserv"

group[2],andwillserveasthebasisforsupportingthemorerecentworkof"

diffserv"

[3].Seealso[4]forfurtherdetailsonhowintservanddiffservarerelated.ThisdocumentillustratestheunderlyingarchitectureanddescribeshownewtrafficcontrolfunctionscanbeaddedtotheLinuxkernel.Thekernelversionweusedis2.2.6.

Figure1showsroughlyhowthekernelprocessesdatareceivedfromthenetwork,andhowitgeneratesnewdatatobesentonthenetwork:

incomingpacketsareexaminedandtheneitherdirectlyforwardedtothenetwork(e.g.onadifferentinterface,ifthemachineisactingasarouterorabridge),ortheyarepasseduptohigherlayersintheprotocolstack(e.g.toatransportprotocollikeUDPorTCP)forfurtherprocessing.Thosehigherlayersmayalsogeneratedataontheirownandhandittothelowerlayersfortaskslikeencapsulation,routing,andeventuallytransmission.

"

Forwarding"

includestheselectionoftheoutputinterface,theselectionofthenexthop,encapsulation,etc.Onceallthisisdone,packetsarequeuedontherespectiveoutputinterface.Thisisthepointwheretrafficcontrolcomesintoplay.Trafficcontrolcan,amongotherthings,decideifpacketsarequeuedoriftheyaredropped(e.g.ifthequeuehasreachedsomelengthlimit,orifthetrafficexceedssomeratelimit),itcandecideinwhichorderpacketsaresent(e.g.togiveprioritytocertainflows),itcandelaythesendingofpackets(e.g.tolimittherateofoutboundtraffic),etc.

Oncetrafficcontrolhasreleasedapacketforsending,thedevicedriverpicksitupandemitsitonthenetwork.

Sections2to4giveanoverviewandexplainsometerminology.Sections5to8describetheelementsoftrafficcontrolintheLinuxkernelinmoredetail.Section9describesaqueuingdisciplinethathasbeenimplementedbytheauthor.

2Overview

ThetrafficcontrolcodeintheLinuxkernelconsistsofthefollowingmajorconceptualcomponents:

●queuingdisciplines

●classes(withinaqueuingdiscipline)

●filters

●policing

Figure1:

Processingofnetworkdata.

Eachnetworkdevicehasaqueuingdisciplineassociatedwithit,whichcontrolshowpacketsenqueuedonthatdevicearetreated.Averysimplequeuingdisciplinemayjustconsistofasinglequeue,whereallpacketsarestoredintheorderinwhichtheyhavebeenenqueued,andwhichisemptiedasfastastherespectivedevicecansend.Seefigure2forsuchaqueuingdisciplinewithoutexternallyvisibleinternalstructure.

Figure2:

Asimplequeuingdisciplinewithoutclasses.

Moreelaboratequeuingdisciplinesmayusefilterstodistinguishamongdifferentclassesofpacketsandprocesseachclassinaspecificway,e.g.bygivingoneclasspriorityoverotherclasses.

Figure3showsanexampleofsuchaqueuingdiscipline.Notethatmultiplefiltersmaymaptothesameclass.

Queuingdisciplinesandclassesareintimatelytiedtogether:

thepresenceofclassesandtheirsemanticsarefundamentalpropertiesofthequeuingdiscipline.Incontrasttothat,filterscanbecombinedarbitrarilywithqueuingdisciplinesandclassesaslongasthequeuingdisciplinehasclassesatall.Butflexibilitydoesn'

tendyet-classesnormallydon'

ttakecareofstoringtheirpacketsthemselves,buttheyuseanotherqueuingdisciplinetotakecareofthat.Thatqueuingdisciplinecanbearbitrarilychosenfromthesetofavailablequeuingdisciplines,anditmaywellhaveclasses,whichinturnusequeuingdisciplines,etc.

Figure4showsanexampleofsuchastack:

first,thereisaqueuingdisciplinewithtwodelaypriorities.Packetswhichareselectedbythefiltergotothehigh-priorityclass,whileallotherpacketsgotothelow-priorityclass.Whenevertherearepacketsinthehigh-priorityqueue,theyaresentbeforepacketsinthelow-priorityqueue(e.g.thesch_prioqueuingdisciplineworksthisway).Inordertopreventhigh-prioritytrafficfromstarvinglow-prioritytraffic,weuseatokenbucketfilter(TBF),whichenforcesarateofatmost1Mbps.Finally,thequeuingoflow-prioritypacketsisdonebyaFIFOqueuingdiscipline.Notethattherearebetterwaystoaccomplishwhatwe'

vedonehere,e.g.byusingclass-basedqueuing(CBQ)[5].

Packetsareenqueuedasfollows:

whentheenqueuedfunctionofaqueuingdisciplineiscalled,itrunsonefilteraftertheotheruntiloneofthemindicatesamatch.Itthenqueuesthepacketforthecorrespondingclass,whichusuallymeanstoinvoketheenqueuedfunctionofthequeuingdiscipline"

owned"

bythatclass.Packetswhichdonotmatchanyofthefiltersaretypicallyattributedtosomedefaultclass.

Typically,eachclass"

owns"

onequeue,butitisinprinciplealsopossiblethatseveralclassessharethesamequeueoreventhatasinglequeueisusedbyallclassesoftherespectivequeuingdiscipline.Notehoweverthatpacketsdonotcarryanyexplicitindicationofwhichclasstheywereattributedto.Queuingdisciplinesthatchangeper-classinformationwhendequeuingpackets(e.g.CBQ)maythereforenotworkproperlyifthe"

inner"

queuesareshared,unlesstheyareableeithertorepeattheclassificationortopasstheclassificationresultfromenqueuedtodequeuebysomeothermeans.

Usuallywhenenqueuingpackets,thecorrespondingflow(s)canbepoliced,e.g.bydiscardingpacketswhichexceedacertainrate.

Wewillnottrytointroducenewterminologytodistinguishamongalgorithms,theirimplementations,andinstancesofsuchelements,butratherusethetermsqueuingdiscipline,class,andfilterthrough-outmostofthisdocument,torefertoallthreelevelsofabstractionatthesametime.

3Resources

Linuxtrafficcontrolisspreadoveracomparablylargenumberoffiles.Notethatallpathnamesarerelativetothebasedirectoryoftherespectivecomponent,Filtere.g.fortheLinuxkernelthisis/usr/src/linux/,forthetcprogramiproute2/tc/.

Figure3:

Asimplequeuingdisciplinewithmultipleclasses.

Figure4:

Combinationofpriority,TBF,andFIFOqueuingdisciplines.

Tcisauser-spaceprogramusedtomanipulateindividualtrafficcontrolelements.Itssourceisinthefileiproute2-version.tar.gz,whichcanbeobtainedfromftp:

//linux.wauug.org/pub/net/ip-routing/.

Thekernelcoderesidesmainlyinthedirectorynet/sched/.Theinterfacesbetweenkerneltrafficcontrolelementsanduserspaceprogramsusingthemaredeclaredininclude/linux/pkt_cls.handinclude/linux/pkt_sched.h.Declarationsusedonlyinsidethekernelandthedefinitionsofsomeinlinefunctionscanbefoundininclude/net/pkt_cls.handinclude/net/pkt_sched.h.

Thertnetlinkmechanismusedforcommunicationbetweentrafficcontrolelementsinuser-spaceandinthekernelisimplementedinnet/core/rtnetlink.candinclude/linux/rtnetlink.h.rtnetlinkisbasedonnetlink,whichcanbefoundinnet/netlink/andinclude/linux/netlink.h.

Thekernelsourcecanbeobtainedfromtheusualwell-knownplaces,e.g.fromftp:

//ftp.kernel.org/pub/linux/kernel/v2.2/.

Theexampleinsection9isincludedintheATMonLinuxdistribution,whichcanbedownloadedfromhttp:

//icawww1.epfl.ch/linux-atm/dist.html.

TheDifferentiatedServicesonLinuxproject(http:

//icawww1.epfl.ch/linux-diffserv/)hasproducedfurtherexamplesforextensionsofLinuxtrafficcontrolandtheiruse.

4Terminology

Unfortunately,theterminologyusedtodescribetrafficcontrolelementsisfarfromconsistentinliterature,andtherearesomevariationsevenwithinLinuxtrafficcontrol.Thepurposeofthissectionistohelptoputthingsintocontext.

Figure5showsthearchitecturalmodelsandtheterminologyusedintheIETFgroups"

[6]and"

[7,8],andhowelementsofLinuxtrafficcontrolarerelatedtothem.Notethatclassesplayanambivalentrole,becausetheydeterminethefinaloutcomeofaclassificationandtheycanalsobepartofthemechanismthatimplementsacertainqueuingorschedulingbehavior.

Table1summarizesthekeywordsusedatthetccommandline,thefilenamesusedinthekernel(innet/sched/),andthefilenamesusedinthesourceoftc.

Figure5:

RelationofelementsoftheintservanddiffservarchitecturetotrafficcontrolintheLinuxkernel.

Table1:

Keywordsandfilenamesusedfortrafficcontrolelements.

5Queuingdisciplines

Eachqueuingdisciplineprovidesthefollowingsetoffunctionstocontrolitsoperation(seestructQdisc_opsininclude/net/pkt_sched.h):

enqueueenqueuesapacketwiththequeuingdiscipline.Ifthequeuingdisciplinehasclasses,theenqueuedfunctionfirstselectsaclassandtheninvokestheenqueuefunctionofthecorrespondingqueuingdisciplineforfurtherenqueuing.

dequeuereturnsthenextpacketeligibleforsending.Ifthequeuingdisciplinehasnopacketstosend(e.g.becausethequeueisemptyorbecausethey'

renotscheduledtobesentyet),dequeuereturnsNULL.

requeueputsapacketbackintothequeueafterdequeuingitwithdequeue.Thisdiffersfromenqueueinthatthepacketshouldbequeuedate

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 其它课程

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1