已阅读5页,还剩52页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1 IntroducingiRules 2005 07 12徐超 Computer xu Oknetxuchao 2 BasiciRuleelements iRulesareevent driven whichmeansthattheLTMsystemtriggersaniRulebasedonaneventthatyouspecifyintheiRule iRulesaremadeupofthesebasicelements EventdeclarationsOperatorsiRulecommands 3 BasiciRuleFormat Eventdeclarations Operators iRulecommands 4 Eventdeclarations Eventdeclarations when eventtype Anexample whenCLIENT ACCEPTED if IP addr IP remote addr equals10 1 1 80 poolmy pool1 5 Eventtypes GlobaleventsHTTPeventsSSLeventsAuthenticationeventsReferrencetoLTM config guide pdfpage302 303 table13 2 6 Eventtypes GlobalEvents CLIENT ACCEPTEDCLIENT DATALB SELECTED beforesendtoserver LB FAILED nonodeavailableforthisvs SERVER CONNECTEDSERVER DATARULE INITCLIENT CLOSEDSERVER CLOSED 7 CLIENT ACCPTED CLIENT DATA LB SELECTED LB FAILED SERVER ACCPTED SERVER DATA CLIENT CLOSED SERVER CLOSED RULE INIT START 8 Eventtypes HTTPEvents HTTP REQUESTHTTP REQUEST DATAHTTP RESPONSEHTTP RESPONSE DATAHTTP RESPONSE CONTINUE 9 HTTP REQUEST HTTP REQUEST DATA HTTP RESPOND HTTP RESPOND DATA START HTTP RESPOND CONTINUE 10 Eventtypes SSLEvents CLIENTSSL HANDSHAKECLIENTSSL CLIENTCERTSERVERSSL HANDSHAKE 11 Eventtypes AuthenticationEvents AUTH FAILUREAUTH ERRORAUTH WANTCREDENTIALAUTH SUCCESS 12 Operators Relationaloperatorscontainsmatches equals equalsstarts withends withmatches regex 参考常用简单正则表达式 Logicaloperatorsnotandor 13 iRulecommands iRuleCommandsTypeStatementcommandsQueryandDatamanipulationcommandsUtilitycommands 14 iRulecommandsStatementcommands1 if elseif 15 iRulecommandsStatementcommands2 clientside serverside peer 16 clientside serverside ForeveryeventthatyouspecifywithinaniRule youcanalsospecifyacontext denotedbythekeywordsclientsideorserverside Becauseeacheventhasadefaultcontextassociatedwithit youneedonlydeclareacontextifyouwanttochangethecontextfromthedefault Anexample whenSERVER CONNECTED if IP addr IP addr clientside IP remote addr equals10 1 1 80 discard 17 iRulecommandsStatementcommands3 event disable disableallDiscontinuesevaluatingthespecifiediRuleevent oralliRuleevents onthisconnection However theiRulecontinuestorun log 18 iRulecommandsStatementcommands4 use pool member use node persist use rateclassmatchclass use snat none use snatpool none 19 iRulecommandsStatementcommands5 discard Causesthecurrentpacketorconnectiontobediscarded Thisstatementmustbeconditionallyassociatedwithanifstatement drop discardforward SetstheconnectiontoforwardIPpacketsreject CausestheconnectiontoberejectedReturn TerminatesexecutionoftheiRuleevent 20 iRulecommandsQueryandDatamanipulationcommands QueryingheaderorcontentdataLinkLayerheadersIPheadersTCPheadersandcontentUDPheadersandcontentHTTPheadersandcontentSSLheadersinHTTPrequests Authenticationdata 21 iRulecommandsQueryandDatamanipulationcommands LinkLayerheadersLINK vlan idReturnstheVLANtagofthepacket LINK vlan qosReturnstheVLANQualityofService QoS valueofthepacket SettheVLANQoSlevelthatyouwantthesystemtousewhentransmittingthepacket 22 iRulecommandsQueryandDatamanipulationcommands LinkLayerheaders Cont1 Anexample whenCLIENT ACCEPTED if LINK qos 2 poolfast pool else poolslow pool 23 iRulecommandsQueryandDatamanipulationcommands IPheadersIP remote addrReturnstheremoteIPaddressofaconnection IP local addrReturnsthelocalIPaddressofaconnection IP client addrReturnstheclientIPaddressofaconnection Thiscommandisequivalenttothecommandclientside IP remote addr IP server addrReturnstheserver sIPaddress Thiscommandisequivalenttothecommandserverside IP remote addr Willreturn0iftheload balancingdecisionhasnotoccurred 24 iRulecommandsQueryandDatamanipulationcommands IPheaders Cont1 IP protocolReturnstheIPprotocolvalue IP tosReturnsthevalueoftheIPprotocol sTypeofService ToS field SetstheIPToSlevelthatyouwantthesystemtousewhentransmittingthepacket IP ttlReturnstheTTLforaninboundIPv4orIPv6packetfromthepeer IP idle timeoutReturnsorsetstheidletimeoutvalue 25 iRulecommandsQueryandDatamanipulationcommands IPheaders Cont2 IP hopsFindsthenearest next highestpoweroftwointherange suchas64 128 255 andsubtractsthevalueretrievedbytheIP ttlcommand WiththeIP hopscommand youcanpassivelyestimatethenumberofhopsbetweenasystemanditspeer Ahopof0indicatesthattheclientisonthelocalnetwork Forexample iftheTTLvalueequals55 thenumberofestimatedhopsis9 64minus55 IftheTTLvalueequals127 thenumberofestimatedhopsis1 128minus127 26 iRulecommandsQueryandDatamanipulationcommands IPAddressMatchCommandIP addrequals AnexamplewhenCLIENT ACCEPTED if IP addr IP remote addr equals206 0 0 0 255 0 0 0 poolclients from 206 else poolother clients pool 27 iRulecommandsQueryandDatamanipulationcommands TCPheadersTCP remote portReturnstheremoteTCPport servicenumber TCP local portReturnsthelocalTCPport servicenumber TCP client portReturnstheclient sTCPport servicenumber Equivalenttothecommandclientside TCP remote port TCP server portReturnstheserverTCPport servicenumber Equivalenttothecommandserverside TCP remote port 28 iRulecommandsQueryandDatamanipulationcommands TCPheaders Cont1 TCP rttReturnsthesmoothedround triptimeestimateforaTCPconnection TCP mssReturnstheon wireMaximumSegmentSize MSS foraTCPconnection TCP unused portReturnsanunusedTCPportforthespecifiedIPtuple usingthevalueofasastartingpoint 29 iRulecommandsQueryandDatamanipulationcommands TCPheaders Cont2 TCP offsetReturnsthepositionintheTCPdatastreaminwhichthecollectedTCPdatastarts TCP collectCausesTCPtostartcollectingthespecifiedamountofcontentdata TCP payload ReturnstheaccumulatedTCPdatacontent TCP payload lengthReturnstheamountofaccumulatedTCPdatacontentinbytes 30 iRulecommandsQueryandDatamanipulationcommands TCPheaders Cont3 TCP payloadreplaceReplacescollectedpayloadwiththegivendata TCP releaseCausesTCPtoresumeprocessingtheconnectionandtoflushcollecteddata TCP respondSendsthenameddatadirectlytothepeer ThiscommandisusedtocompleteaprotocolhandshakewithaniRule TCP closeClosestheconnection 31 TCP COLLECT TCP PAYLOAD TCP RELEASE START TCP RESPOND TCP CLOSE TCP PAYLOAD REPLACE 32 iRulecommandsQueryandDatamanipulationcommands TCPheaders Cont3 Anexample whenCLIENT ACCEPTED TCP collect15 whenCLIENT DATA if TCP payload15 contains XYZ poolxyz servers else poolweb servers 33 iRulecommandsQueryandDatamanipulationcommands UDPheadersUDP remote portReturnstheremote sUDPport servicenumber UDP local portReturnsthelocalUDPport servicenumber UDP client portReturnstheclient sUDPport servicenumber Equivalenttothecommandclientside UDP remote port UDP server portReturnstheserverUDPport servicenumber Equivalenttothecommandserverside UDP remote port UDP payload ReturnsthecurrentUDPpayloadcontent UDP payloadlengthReturnstheamountofUDPpayloadcontentinbytes 34 iRulecommandsQueryandDatamanipulationcommands HTTPHeaderHTTP headernamesReturnsalistofalltheheaderspresentontherequestorresponse HTTP headercountReturnsthenumberofHTTPheaderspresentontherequestorresponse HTTP headeratReturnstheHTTPheaderthatthesystemfindsatthezero basedindexvalue HTTP headerexistsReturnstrueifthenamedheaderispresentontherequestorresponse 35 iRulecommandsQueryandDatamanipulationcommands HTTPHeader Cont1 HTTP header value ReturnsvalueoftheHTTPheadernamed Youcanomittheargumentiftheheadernamedoesnotcollidewithanyofthesubcommands HTTP headerinsert lws InsertsthenamedHTTPheaderanditsvalueintotheendoftheHTTPrequestorresponse Ifyouspecify lws thesystemaddslinearwhitespacetolongheadervalues HTTP headerinsert lws n1 v1 n2 v2 n3 v3 PassesaTcllisttoinsertintoaheader Insuchcases thesystemtreatsthelistasalistofname valuepairs Ifyouspecify lws thesystemaddslinearwhitespacetolongheadervalues 36 iRulecommandsQueryandDatamanipulationcommands HTTPHeader Cont2 HTTP header value Setsthevalueofthenamedheader Iftheheaderispresent thecommandreplacestheheader otherwise thecommandaddstheheader Youcanomittheargumentiftheheadernamedoesnotcollidewithanyothervalues HTTP headerreplace Replacesthelastoccurrenceofthenamedheaderwiththestring Thiscommandperformsaheaderinsertioniftheheaderwasnotpresent HTTP headerremoveRemovesthelastoccurrenceofthenamedheaderfromtherequestorresponse 37 iRulecommandsQueryandDatamanipulationcommands HTTPHeader Cont3 HTTP headerinsert modssl fields options InsertsHTTPheaderfieldsneededtoduplicateModSSLbehavior Notethattousethiscommand youmustalsoenabletheModSSLMethodssettingwithinanSSLprofile FormoreinformationonModSSLoptions seeChapter7 ManagingSSLTraffic HTTP headersanitize Removesallbuttheheadersyouspecify TheexceptiontothisissomeessentialHTTPheaders 38 iRulecommandsQueryandDatamanipulationcommands HTTPHeader Cont4 HTTP methodReturnsthetypeofHTTPrequestmethod HTTP statusReturnstheresponsestatuscode HTTP version 0 9 1 0 1 1 ReturnsorsetstheHTTPversionoftherequestorresponse HTTP usernameReturnstheusernamepartoftheHTTPbasicauthorization HTTP passwordReturnsthepasswordpartoftheHTTPbasicauthorization 39 iRulecommandsQueryandDatamanipulationcommands HTTPHeader Cont5 HTTP path ReturnsthepathpartoftheHTTPrequest HTTP uri ReturnsthecompleteURIoftherequest HTTP query ReturnsthequerypartoftheHTTPrequest HTTP is keepaliveReturnsatruevalueifthisisaKeep Aliveconnection 40 iRulecommandsQueryandDatamanipulationcommands HTTPHeader Cont6 HTTP is redirectReturnsatruevalueiftheresponseisacertaintypeofredirect HTTP redirectRedirectsaHTTPrequestorresponsetothespecifiedURL Notethatthiscommandsendstheresponsetotheclientimmediately Therefore youcannotspecifythiscommandmultipletimesinaniRule norcanyouspecifyanyothercommandsthatmodifyheaderorcontent afteryouspecifythiscommand 41 iRulecommandsQueryandDatamanipulationcommands HTTPHeader Cont7 HTTP collect Collectstheamountofdatathatyouspecifywiththe length argument Whenthesystemcollectsthespecifiedamountofdata itcallstheTcleventHTTP REQUEST DATAorHTTP RESPONSE DATA Usegreatcautionwhenomittingthevalueofthecontentlength Eventhoughthisisallowedincertaincases doingsoorusingavaluelargerthanthesizeoftheactuallengthcanstalltheconnection 42 iRulecommandsQueryandDatamanipulationcommands HTTPHeader Cont8 HTTP payload ReturnsthecontentthattheHTTP collectcommandhascollectedthusfar Ifyoudonotspecifyasize thesystemreturnsthecollectedcontent HTTP payloadlengthReturnsthesizeofthecontentthatthecommandhascollectedthusfar notincludingtheHTTPheaders HTTP payloadreplaceReplacestheamountofcontentthatyouspecifiedwiththeargument startingatwith 43 iRulecommandsQueryandDatamanipulationcommands HTTPHeader Cont9 HTTP releaseReleasesthecollecteddata UnlessasubsequentHTTP collectcommandwasissued thereisnoneedtousetheHTTP releasecommandinsideoftheHTTP REQUEST DATAandHTTP RESPONSE DATAevents sinceinthesecases thedataisimplicitlyreleased HTTP closeInsertsaConnection CloseheaderandclosetheHTTPconnection 44 iRulecommandsQueryandDatamanipulationcommands HTTPHeader Cont10 HTTP respond content ThisisapowerfulAPIthatallowsuserstogenerateorrewriteaclientrequestoraserverresponse Whenthesystemrunsthecommandontheclientside itsendstheresponsetotheclientwithoutanyloadbalancingtakingplace Ifthesystemrunsthecommandontheserverside thecontentfromtheactualserverisdiscardedandreplacedwiththeinformationprovidedtothisAPI NotethatbecausethesystemsendstheresponsedataimmediatelyafterthisiRuleruns werecommendthatyounotrunanymoreiRulesafterthisAPI HTTP request numReturnsthenumberofHTTPrequeststhataclientmadeontheconnection forHTTP 1 1keepalive 45 iRulecommandsQueryandDatamanipulationcommands HTTPHeaderUtilityURI protocolExtractstheprotocolpartfromtheURIstringthatyouspecify URI basenameExtractsthebasenamepartfromtheURIstringthatyouspecify URI pathExtractsthepathfromtheURIstringthatyouspecify URI queryExtractsthequerypartfromtheURIstringthatyouspecify 46 iRulecommandsQueryandDatamanipulationcommands HTTPHeaderUtility Cont1 URI hostExtractsthehostpartfromtheURIstringthatyouspecify URI compareComparesURIsasrecommendedbyRFC2616section3 2 3 URI decodeReturnsthedecodedURIstring URI encodeReturnstheencodedURIstringURI portExtractstheportpartfromtheURIstringthatyouspecify 47 iRulecommandsQueryandDatamanipulationcommands HTTPHeaderUtility Cont7 ExampleswhenHTTP REQUEST if HTTP uri ends with cgi poolcgi pool elseif HTTP uri starts with abc poolabc servers 48 iRulecommandsQueryandDatamanipulationcommands SSLheader
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年《产品质量追溯制度》知识考试题库及答案解析
- 2025年《网络危机公关》知识考试题库及答案解析
- 2025年《车辆使用记录》知识考试题库及答案解析
- 2025年《消防员职业健康检查规定》知识考试题库及答案解析
- 2025年《个人信息保护法》知识考试题库及答案解析
- 2025年《质量管理体系合规管理》知识考试题库及答案解析
- 2025年《纳米技术》知识考试题库及答案解析
- 2025年《认证认可认证机构非物质文化遗产保护指南》知识考试题库及答案解析
- 2025年《清洁生产促进法》知识考试题库及答案解析
- 2025年《化学品安全管理》知识考试题库及答案解析
- 2025重庆水务环境控股集团管网有限公司招聘20人笔试考试参考试题及答案解析
- 七年级上册语文期中常考作文押题+范文
- 2025广西玉林市福绵区退役军人事务局招聘编外人员3人笔试考试参考试题及答案解析
- 膏药的营销方案
- 广东省佛山市三水区2024-2025学年七年级上学期语文期末考试试卷(含答案)
- 2025年古玩艺术品委托拍卖协议
- 2025课堂惩罚 主题班会:马达加斯加企鹅课堂惩罚 课件
- ERP系统运行使用管理办法
- 2025年四川成都环境投资集团有限公司及下属公司招聘笔试参考题库含答案解析
- (高清版)DB13(J)∕T 8448-2024 热处理带肋高强钢筋应用技术标准
- 人工神经网络PPT课件
评论
0/150
提交评论