张鹏毕设英文翻译.docx
《张鹏毕设英文翻译.docx》由会员分享,可在线阅读,更多相关《张鹏毕设英文翻译.docx(20页珍藏版)》请在冰豆网上搜索。
张鹏毕设英文翻译
西安邮电学院
毕业设计(译文)
论文题目:
P2P技术在多媒体服务中的应用研究
院(系):
通信与信息工程学院
专业:
通信工程
班级:
通工0614班
学生姓名:
张鹏
导师姓名:
杨小宝职称:
工程师
Directory
Peer-to-Peer(P2P)communicationacrossmiddle-boxes1
3.1 Relaying1
3.2 Connectionreversal1
3.3 UDPholepunching3
3.3.1 PeersbehinddifferentNATs3
3.3.2 PeersbehindthesameNAT5
3.3.3 PeersseparatedbymultipleNATs6
3.3.4 Consistentportbindings7
3.4 UDPportnumberprediction7
3.5 SimultaneousTCPopen9
目录
利用代理服务器的P2P通信1
3.1 转发1
3.2 反向连接1
3.3 UDP打洞技术2
3.3.1 处于不同NAT之后的客户端通信2
3.3.2 客户端都处于相同的NAT之后3
3.3.3 客户端分别处于多层NAT之后4
3.3.4 保持端口绑定5
3.4 UPD端口号预言5
3.5 同时开放TCP连接6
Peer-to-Peer(P2P)communicationacrossmiddle-boxes
——TechniquesforP2PCommunicationovermiddle-boxes
Thissectionreviewsindetailthecurrentlyknowntechniquesforimplementingpeer-to-peercommunicationoverexistingmiddleboxes,fromtheperspectiveoftheapplicationorprotocoldesigner.
3.1 Relaying
Themostreliable,butleastefficient,methodofimplementingpeer-to-peercommunicationinthepresenceofamiddle-boxistomakethepeer-to-peercommunicationlooktothenetworklikeclient/servercommunicationthroughrelaying.Forexample,supposetwoclienthosts,AandB,haveeachinitiatedTCPorUDPconnectionswithawell-knownserverShavingapermanentIPaddress. Theclientsresideonseparateprivatenetworks,however,andtheirrespectivemiddle boxespreventeitherclientfromdirectlyinitiatingaconnectiontotheother(asinFIG1-1).
FIG1-1ServerRelaying
Insteadofattemptingadirectconnection,thetwoclientscansimplyusetheserverStorelaymessagesbetweenthem.Forexample,tosendamessagetoclientB,clientAsimplysendsthemessagetoserverSalongitsalready-establishedclient/serverconnection,andserverSthensendsthemessageontoclientBusingitsexistingclient/serverconnectionwithB.
Thismethodhastheadvantagethatitwillalwaysworkaslongasbothclientshaveconnectivitytotheserver.Itsobviousdisadvantagesarethatitconsumestheserver'sprocessingpowerandnetworkbandwidthunnecessarily,andcommunicationlatencybetweenthetwoclientsislikelytobeincreasedeveniftheserveriswell-connected.TheTURNprotocol[TURN]definesamethodofimplementingrelayinginarelativelysecurefashion.
3.2 Connectionreversal
Thesecondtechniqueworksifonlyoneoftheclientsisbehindamiddlebox.Forexample,supposeclientAisbehindaNATbutclientBhasagloballyroutableIPaddress,asintheFIG1-2:
FIG1-2Connectionreversal
ClientAhasprivateIPaddress10.0.0.1,andtheapplicationisusingTCPport1234.ThisclienthasestablishedaconnectionwithserverSatpublicIPaddress18.181.0.31andport1235.NATAhasassignedTCPport62000,atitsownpublicIPaddress155.99.25.11,toserveasthetemporarypublicendpointaddressforA'ssessionwithS:
therefore,serverSbelievesthatclientAisatIPaddress155.99.25.11usingport62000.ClientB,however,hasitsownpermanentIPaddress,138.76.29.7,andthepeer-to-peerapplicationonBisacceptingTCPconnectionsatport1234.
NowsupposeclientBwouldliketoinitiateapeer-to-peercommunicationsessionwithclientA.BmightfirstattempttocontactclientAeitherattheaddressclientAbelievesitselftohave,namely10.0.0.1:
1234,orattheaddressofAasobservedbyserverS,namely155.99.25.11:
62000.Ineithercase,however,theconnectionwillfail.Inthefirstcase,trafficdirectedtoIPaddress10.0.0.1willsimplybedroppedbythenetworkbecause10.0.0.1isnotapubliclyroutableIPaddress.Inthesecondcase,theTCPSYNrequestfromBwillarriveatNAT-Adirectedtoport62000,butNATAwillrejecttheconnectionrequestbecauseonlyoutgoingconnectionsareallowed.
AfterattemptingandfailingtoestablishadirectconnectiontoA,clientBcanuseserverStorelayarequesttoclientAtoinitiatea"reversed"connectiontoclientB.ClientA,uponreceivingthisrelayedrequestthroughS,opensaTCPconnectiontoclientBatB'spublicIPaddressandportnumber.NATAallowstheconnectiontoproceedbecauseitisoriginatinginsidethefirewall,andclientBcanreceivetheconnectionbecauseitisnotbehinda middle-box.
Avarietyofcurrentpeer-to-peersystemsimplementthistechnique. Itsmainlimitation,ofcourse,isthatitonlyworksaslongasonlyoneofthecommunicatingpeersisbehindaNAT:
intheincreasinglycommoncasewherebothpeersarebehind NAT-s, themethodfails. Becauseconnectionreversalisnotageneralsolutiontotheproblem, itisNOTrecommendedasaprimarystrategy.Applicationsmaychoosetoattemptconnectionreversal,butshouldbeabletofallbackautomaticallyonanothermechanismsuchasrelayingifneithera"forward"nora"reverse"connectioncanbeestablished.
3.3 UDPholepunching
Thethirdtechnique,andtheoneofprimaryinterestinthisdocument,iswidelyknownas"UDPHolePunching."UDPholepunchingreliesonthepropertiesofcommonfirewallsandconeNATstoallowappropriatelydesignedpeer-to-peerapplicationsto"punchholes"throughthemiddle-boxandestablishdirectconnectivitywitheachother,evenwhenbothcommunicatinghostsmayliebehindmiddle boxes. Thistechniquewasmentionedbrieflyinsection5.1ofRFC3027[NAT-PROT],andhasbeeninformallydescribedelsewhereontheInternet[KEGEL]andusedinsomerecentprotocols[TEREDO,ICE].Asthenameimplies,unfortunately,thistechniqueworksreliablyonlywithUDP.
Wewillconsidertwospecificscenarios,andhowapplicationscanbedesignedtohandlebothofthemgracefully. Inthefirstsituation,representingthecommoncase,twoclientsdesiringdirectpeer-to-peercommunicationresidebehindtwodifferentNAT-s. Inthesecond, thetwoclientsactuallyresidebehindthesameNAT,butdonotnecessarilyknowthattheydo.
3.3.1 PeersbehinddifferentNATs
SupposeclientsAandBbothhaveprivateIPaddressesandliebehinddifferentnetworkaddresstranslators. Thepeer-to-peerapplicationrunningonclientsAandBandonserverSeachuseUDPport1234.AandBhaveeachinitiatedUDPcommunicationsessionswithserverS, causingNATAtoassignitsownpublicUDPport62000forA'ssessionwithS,andcausingNATBtoassignitsport31000toB'ssessionwithS,respectively.
FIG1-3AandBcommunicationsessionswithserverS
NowsupposethatclientAwantstoestablishaUDPcommunicationsessiondirectlywithclientB. IfAsimplystartssendingUDPmessagestoB'spublicaddress,138.76.29.7:
31000,thenNATBwilltypicallydiscardtheseincomingmessages(unlessitisafullconeNAT),becausethesourceaddressandportnumberdoesnotmatchthoseofS,withwhichtheoriginaloutgoingsessionwasestablished. Similarly,ifBsimplystartssendingUDPmessagestoA'spublicaddress,thenNATAwilltypicallydiscardthesemessages.
SupposeAstartssendingUDPmessagestoB'spublicaddress,however,andsimultaneouslyrelaysarequestthroughserverStoB,askingBtostartsendingUDPmessagestoA'spublicaddress.A'soutgoingmessagesdirectedtoB'spublicaddress(138.76.29.7:
31000)causeNATAtoopenupanewcommunicationsessionbetweenA'sprivateaddressandB'spublicaddress.Atthesametime,B'smessagestoA'spublicaddress(155.99.25.11:
62000)causeNATBtoopenupanewcommunicationsessionbetweenB'sprivateaddressandA'spublicaddress.OncethenewUDPsessionshavebeenopenedupineachdirection,clientAandBcancommunicatewitheachotherdirectlywithoutfurtherburdenonthe"introduction"serverS.
TheUDPholepunchingtechniquehasseveralusefulproperties.Onceadirectpeer-to-peerUDPconnectionhasbeenestablishedbetweentwoclientsbehindmiddle boxes,eitherpartyonthatconnectioncaninturntakeovertheroleof"introducer"andhelptheotherpartyestablishpeer-to-peerconnectionswithadditionalpeers,minimizingtheloadontheinitialintroductionserverS. Theapplicationdoesnotneedtoattempttodetectexplicitlywhatkindofmiddle boxitisbehind,ifany[STUN],sincetheprocedureabovewillestablishpeer-to-peercommunicationchannelsequallywellifeitherorbothclientsdonothappentobebehindamiddle box.TheholepunchingtechniqueevenworksautomaticallywithmultipleNATs,whereoneorbothclientsareremovedfromthepublicInternetviatwoormorelevels
3.3.2 PeersbehindthesameNAT
Nowconsiderthescenarioinwhichthetwoclients(probablyunknowingly)happentoresidebehindthesameNAT,andarethereforelocatedinthesameprivateIPaddressspace.ClientAhasestablishedaUDPsessionwithserverS,towhichthecommonNAThasassignedpublicportnumber62000.ClientBhassimilarlyestablishedasessionwithS,towhichtheNAThasassignedpublicportnumber62001.
FIG1-4A,BestablishedaUDPsessionwithserverS
SupposethatAandBusetheUDPholepunchingtechniqueasoutlinedabovetoestablishacommunicationchannelusingserverSasanintroducer. ThenAandBwilllearneachother'spublicIPaddressesandportnumbersasobservedbyserverS,andstartsendingeachothermessagesatthosepublicaddresses. ThetwoclientswillbeabletocommunicatewitheachotherthiswayaslongastheNATallowshostsontheinternalnetworktoopentranslatedUDPsessionswithotherinternalhostsandnotjustwithexternalhosts. Werefertothissituationas"loopbacktranslation,"becausepacketsarrivingattheNATfromtheprivatenetworkaretranslatedandthen"loopedback"totheprivatenetworkratherthanbeingpassedthroughtothepublicnetwork. Forexample,whenAsendsaUDPpackettoB'spublicaddress,thepacketinitiallyhasasourceIPaddress