《iRules技术分享》PPT课件.ppt_第1页
《iRules技术分享》PPT课件.ppt_第2页
《iRules技术分享》PPT课件.ppt_第3页
《iRules技术分享》PPT课件.ppt_第4页
《iRules技术分享》PPT课件.ppt_第5页
已阅读5页,还剩26页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

,iRules技术分享,ITSC马新元2012-07-02,Copyright2010ByNeusoftGroup.Allrightsreserved,内容概要,一、iRules介绍及应用领域二、iRules编程基础三、编写第一个iRules四、常用iRules分析五、参考资料,一、iRules介绍及应用领域,iRules工作环境:F5负载均衡设备GTM、LTM、LC。iRules使用语言:TCL(ToolCommandLanguage)iRules组成部分:事件、命令和逻辑。,一、iRules介绍及应用领域,根据协议的不同,实现不同的功能,在OSI模型中,iRules可以工作在3-7层,TCP,HTTP,Cookie,UDP,FTP,L3Network,一、iRules介绍及应用领域,iRules的功能1、实现了对所有TCP、UDP应用的数据包分析与信息提取功能。2、根据数据信息进行分流。3、双向的数据流改写功能。4、选择性地址转换(iSNAT)。5、基于内容的会话保持。,一、iRules介绍及应用领域,iRules可以提取的数据:TCP部分TCP:bandwidth-Returnsabandwidthestimateforthepeer.TCP:client_port-ReturnstheTCPport/servicenumberofthespecifiedclient.TCP:close-ClosestheTCPconnection.TCP:collect-Collectsthespecifiedamountofcontentdata.TCP:local_port-ReturnsthelocalTCPport/servicenumber.TCP:mss-Returnstheon-wireMaximumSegmentSize(MSS)foraTCPconnection.TCP:notify-CausesthetheUSER_REQUESTorUSER_RESPONSEeventtoberaised.TCP:offset-ReturnsthepositionintheTCPdatastreaminwhichthecollectedTCPdatastarts.TCP:payload-ReturnsorreplacesTCPdatacontent.TCP:release-Resumesprocessingandflushescollecteddata.TCP:remote_port-ReturnstheremoteTCPport/servicenumber.TCP:respond-Sendsthespecifieddatadirectlytothepeer.TCP:rtt-Returnsthesmoothedround-triptimeestimateforaTCPconnection.TCP:server_port-ReturnstheTCPport/servicenumberofthespecifiedserver.TCP:unused_port-ReturnsanunusedTCPportforthespecifiedIPtuple.,一、iRules介绍及应用领域,iRules可以提取的数据:UDP部分UDP:client_port-ReturnstheUDPport/servicenumberofaclientsystem.UDP:drop-InProgress-AddSummaryHereUDP:local_port-ReturnsthelocalUDPport/servicenumber.UDP:mss-Returnstheon-wireMaximumSegmentSize(MSS)foraUDPconnection.UDP:payload-ReturnsthecontentorlengthofthecurrentUDPpayload.UDP:remote_port-ReturnstheremoteUDPport/servicenumber.UDP:respond-Sendsdatadirectlytoapeer.UDP:server_port-ReturnstheUDPport/servicenumberofaserversystem.UDP:unused_port-InProgress-AddSummaryHere,一、iRules介绍及应用领域,iRules可以提取的数据:HTTP部分HTTP:close-ClosestheHTTPconnection.HTTP:cookie-QueriesforormanipulatescookiesinHTTPrequestsandresponses.HTTP:fallback-SpecifiesoroverridesafallbackhostspecifiedintheHTTPprofile.HTTP:header-QueriesormodifiesHTTPheaders.HTTP:host-ReturnsthevalueoftheHTTPHostheader.HTTP:is_keepalive-ReturnsatruevalueifthisisaKeep-Aliveconnection.HTTP:method-ReturnsthetypeofHTTPrequestmethod.HTTP:password-ReturnsthepasswordpartofHTTPbasicauthentication.HTTP:path-ReturnsorsetsthepathpartoftheHTTPrequest.HTTP:respond-Generatesaresponsetotheclientasifitcamefromtheserver.HTTP:retry-Resendsarequesttoaserver.HTTP:status-Returnstheresponsestatuscode.HTTP:uri-ReturnsorsetstheURIpartoftheHTTPrequest.HTTP:username-ReturnstheusernamepartofHTTPbasicauthentication.HTTP:version-ReturnsorsetstheHTTPversionoftherequestorresponse.,一、iRules介绍及应用领域,根据数据信息进行分流iRules可以根据提取的信息(比如ip、httpheader、httpuri等)进行数据分流,使得不同的请求类型分配到不同的服务器群中。,一、iRules介绍及应用领域,根据数据信息进行分流根据文件类型选择不同的服务器whenHTTP_REQUESTifHTTP:uriends_with.gifpoolpool1elsepoolpool2,一、iRules介绍及应用领域,根据数据信息进行分流根据浏览器不同选择不同服务器whenHTTP_REQUESTsetmy_browserHTTP:headerUser-Agentifmy_browsercontains“MSIE”poolIE_poolelseifmy_browsercontains“Mozilla”poolMz_pool,一、iRules介绍及应用领域,根据数据信息进行分流根据用户类型不同选择不同服务器whenHTTP_REQUESTiffindstrHTTP:uriuser=5if$jsess!=“”persistuie$jsess,iRules编程基础,1、TCL语言和命令结构TCL语言简介TCL(读作“tickle”)语言是一种解释性脚本语言,是一种嵌入命令的脚本语言,具有使用简单,功能强大,可移植性强的特点iRules的命令结构命令参数1参数2参数3参数niRules的注释语句#thisisanoteline.,iRules编程基础,2、iRules变量简单变量数组变量全局变量,iRules编程基础,3、数据类型数值和字符串反斜杠置换双引号和大括号4、操作符运算符和优先级数学函数,iRules编程基础,5、事件事件是iRules构成中的重要的一部分,不同事件代表数据在整个访问过程中的逻辑位置whenHTTP_REQUESTwhenHTTP_RESPONSE,iRules编程基础,6、命令命令也是iRules构成的重要组成部分之一,命令是iRules中对数据进行操作的直接函数,如:HTTP:uri该命令中HTTP代表HTTP协议,uri表示取这个http访问中的uri,他们之间用“:”连接,代表从属关系,uri是属于HTTP这个命令体系的,类似的还有:IP:addr、TCP:payload、SSL:handshake等。,iRules编程基础,7、逻辑流模型,编写第一个iRules,学过编程的人都知道,几乎所有编程语言的第一个例子都是教大家输出“HelloWorld!”,我们的第一个iRules也以这样的功能开始:whenHTTP_REQUESTHelloWorld!,常用iRules分析,1、拓扑风格DNS解析WhenDNS_REQUESTifIP:addrIP:remote_addr/24equals/24host11elsehost0,常用iRules分析,2、根据不同的请求来源连接到不同的POOLwhen

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论