




已閱讀5頁,還剩82頁未讀, 繼續(xù)免費閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
F5iRule介紹 L4和L7交換的本質(zhì)區(qū)別 L2 Payload L3 L4 L7 Header FullPayload 對不定址 不定長的特征碼進行的交換是L7交換的特征 對L7交換特征的提取 iRule WhatisaniRule iRule是一種腳本語言工具它的語法是基于TCL語言的大部分TCL語言的功能都被支持同時還有很多iRule的擴展功能它能幫你實現(xiàn)許多擴展功能當你在CLI GUI介面無法找到對應(yīng)的命令 菜單請相信iRule iRules的組成元素 iRules是基于事件驅(qū)動 Event Driven 的由LTM系統(tǒng)觸發(fā)你在iRules中指定 期望的事件iRules是由以下的基本元素構(gòu)成 事件聲明操作符iRules命令 iRules的基本格式 事件聲明 表達式 iRules命令 whenCLIENT ACCEPTED if IP addr IP remote addr equals 202 101 1 0 24 discard iRule的創(chuàng)建和管理 1 iRule的創(chuàng)建和管理 2 Datagroup的創(chuàng)建 1 Datagroup的創(chuàng)建 2 iRuleEditor iRule的引用 1 新建virtualserver iRule的引用 2 已有virtualserver iRule案例 1 whenHTTP REQUEST if HTTP uri starts with csp dwr and HTTP uri ends with js poolcsp6 cache pool elseif HTTP uri starts with csp js poolcsp6 cache pool elseif HTTP uri starts with csp resources poolcsp6 cache pool elseif HTTP uri starts with csp help poolcsp6 cache pool elseif HTTP uri starts with csp esales poolcsp6 esales pool else poolcsp6 professional pool iRule例子 2 whenHTTP REQUEST if HTTP headerexistsx up calling line id persistuie HTTP headervaluesx up calling line id loglocal0 thephonenumberis HTTP headervaluesx up calling line id 根據(jù)http數(shù)據(jù)包中的手機號碼做會話保持 iRule例子 3 whenHTTP REQUEST if matchclass HTTP uri ends with class end poolpool gatewayloglocal0 theuriis HTTP uri matchuriclass elseif matchclass HTTP host contains class domain poolpool gatewayloglocal0 thedomainnameis HTTP host matchclass domain else poolCSS W3loglocal0 theuriis HTTP uri usecache 全局變量 在v10在不要再采用 而是直接把 去掉 classclass domain classclass end aspx cfm cgi jsp php phtml shtml iRule案例 4 whenCLIENT ACCEPTED loglocal0 theclientis IP remote addr theserveris IP local addr if IP addr IP local addr equals10 64 238 0 23 IP addr IP local addr equals10 64 69 0 23 IP addr IP local addr equals10 64 208 0 23 IP addr IP remote addr equals192 168 68 106 IP addr IP remote addr equals192 168 68 109 IP addr IP remote addr equals192 168 68 113 IP addr IP remote addr equals192 168 68 114 snat10 228 69 133loglocal0 snatto10 228 69 133 elseif IP addr IP local addr equals10 64 238 0 23 IP addr IP local addr equals10 64 69 0 23 IP addr IP local addr equals10 64 208 0 23 IP addr IP remote addr equals192 168 68 132 IP addr IP remote addr equals192 168 68 135 IP addr IP remote addr equals192 168 68 139 snat192 168 68 219loglocal0 snatto192 168 68 219 else snat172 16 0 130loglocal0 snatto172 16 0 130 iRule調(diào)試 log命令 Log的輸出會放在 var log ltm中 var log ltmiRule本身如果有錯誤 也會放在 var log ltm可以增加一些debug語句 來驗證iRule的運行l(wèi)oglocal0 Startoftherule loglocal0 Middleoftherule loglocal0 Endoftherule Log命令的輸出 TheargumentforthelogstatementisthefacilitydotlevelFacilitiesare local0is var log ltmlocal1is var log emlocal2is var log gtmlocal3is var log asmlocal4is var log ltmlocal5is var log pktfilterlocal6is var log httpd httpd errorslocal7is var log boot log注意log命令會消耗資源 請在正式生產(chǎn)上 一定要注釋掉 iRule的資源 iRule論壇 iRule其他 請注意一定要充分測試F5support只支持命令的語法 但無法支持客戶的iRule應(yīng)用邏輯有顧問服務(wù)可以購買 一起開發(fā) 演示 TCLFoundational 變量表達式流程控制if then elseswitchfor 變量 基本操作setunsetappend incr 變量 列表setlst item1 item2 item3 lindexlindex lindex lindex a1 2 3 lindex a 123 lappend linsert 在index之前插入內(nèi)容lreplace 替換first至last之間的內(nèi)容如果變量不足 則刪除對應(yīng)部分llength 變量 全局變量RULE INIT內(nèi)定義的均為全局變量 varname為全局變量使用全局變量將導致CMP失效 即只能單CPU處理流量 這在v10以后的版本一定非常注意 表達式與操作符 TCLStandard 表達式與操作符 iRulesExtended 關(guān)聯(lián)操作符containsmatches 參考Tcl stringmatch equalsstarts withends withmatches regex 參考常用簡單正則表達式 邏輯操作符not and or 表達式 關(guān)于字符串比較 TCL語言習慣性的將字符串轉(zhuǎn)換為數(shù)值進行比較3 20 建議使用eq ne FlowControl if then elseif then else Notice then and else areoptional注意 請采用盡量少的elseif elseif FlowControl switch option dosomethingelse default don tdoanything 盡可能多的使用switch 而不是if FlowControl SwitchOptions Convert If to Switch FlowControl For for for seti3 i 12 incri puts Iinsidesecondloop i iRuleFoundational1 全局命令功能函數(shù)功能命令事件 iRules命令 iRule命令類型數(shù)據(jù)流控制命令 Statement 數(shù)據(jù)流的目的地選擇是否進行SNAT沒有返回值數(shù)據(jù)提取命令 Query 獲取數(shù)據(jù)流中指定的內(nèi)容數(shù)據(jù)操作命令 Datamanipulation 修改數(shù)據(jù)流中指定的內(nèi)容實用工具命令 Utility 一組功能函數(shù) 提供常用的數(shù)據(jù)解析功能 iRules命令 全局命令1 iRules命令 全局命令2 whenSERVER CONNECTED if IP addr clientside IP remote addr equals10 1 1 80 discard iRules命令 全局命令3 iRules命令 全局命令4 iRules命令 全局命令5 whenCLIENT ACCEPTED if TCP local port equals531 snatpoolchat snatpool elseif TCP local port equals25 snatpoolsmtp snatpoolmember10 20 30 40 iRules命令 全局命令6 iRules命令 全局命令7 whenHTTP REQUEST if cpuusage5sec 1 poolwww else HTTP redirect iRules命令 全局命令8 iRules命令 功能函數(shù) iRules命令 功能函數(shù) iRules命令 功能函數(shù) Findstr HTTP payload fid 4 iRules命令 TCLStringFunc iRules命令 TCLSCAN iRules命令 TCLBINARYSCAN TMOSCommands祥解 LB OneConnect相關(guān)命令TCP IP相關(guān)命令HTTP Cache DNS相關(guān)命令 TMOSCMD LB TMOSCMD OneConnect TMOSCMD LINK TMOSCMD IP whenCLIENT ACCEPTED if IP addr IP client addr equals10 10 10 10 poolmy pool TMOSCMD TCP TMOSCMD TCP TMOSCMD TCP TMOSCMD TCP whenSERVER CONNECTED peer TCP collect4 whenCLIENT DATA if TCP payload starts with EHLO TCP respond 5005 3 3Unrecognizedcommand r n TCP payloadreplace0 TCP payloadlength TCP release TMOSCMD HTTP TMOSCMD HTTP Header TMOSCMD HTTP Header TMOSCMD HTTP Header TMOSCMD HTTP Cookie TMOSCMD HTTP Cookie TMOSCMD HTTP Cookie TMOSCMD HTTP TMOSCMD HTTP whenHTTP REQUEST setckname app setckvalue 893 setcookie format s s path domain s ckname ckvalue domain org HTTP respond302Location http www domain org Set Cookie cookie whenHTTP RESPONSE if HTTP status 302 foreachaCookieName HTTP cookienames setcurrentCookie aCookieName HTTP cookievalue aCookieName setcookies cookies r nSet Cookie currentCookie HTTP respond200content ForbiddenRedirectFromremoteServerTheserveristryingtoredirecttheclienttoanexternalsite butitisforbidden Set Cookie cookies TMOSCMD HTTP iRules事件 如何聲明事件when body Anexample whenCLIENT ACCEPTED if IP addr IP remote addr equals10 1 1 80 poolmy pool1 iRules事件 事件類型GlobalEventsIPEventsTCP UDPEventsHTTP SSL DNS Auth CacheEventsOthers F5還在不斷擴充支持的事件類型 SIP XML RTSP etc TMOSEvents
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 網(wǎng)絡(luò)安全產(chǎn)品研發(fā)人員保密協(xié)議及技術(shù)保密義務(wù)
- 出租車企業(yè)股權(quán)轉(zhuǎn)讓與城市交通管理服務(wù)合同
- 《國有土地產(chǎn)權(quán)方與承租管理公司合作協(xié)議》
- 成都高端住宅項目代理銷售服務(wù)合同
- 時尚商業(yè)街區(qū)場地租賃及品牌入駐管理合同
- 餐飲連鎖品牌股權(quán)聯(lián)營合同
- 爆破拆除工程安全生產(chǎn)責任保險合同
- ICU急救藥物的應(yīng)用
- 智能制造參股經(jīng)營合同文本
- 倉庫管理員職位聘用及保密協(xié)議
- 2025年度會計人員繼續(xù)教育會計法律法規(guī)答題活動測試100題答案
- 24秋國家開放大學《社會教育及管理》形考任務(wù)1-3參考答案
- 2024年河北省高考地理試卷(含答案逐題解析)
- 2024年江西省高考化學試卷(真題+答案)
- 內(nèi)審內(nèi)審員培訓試題對內(nèi)審員的考試版
- 水泥庫筒倉滑模施工方案
- 華容道關(guān)卡(三張A3紙)
- 標準型號鏈條參數(shù)表-鏈節(jié)參數(shù)表
- TCCES 6003-2021 預制混凝土構(gòu)件用金屬預埋吊件
- 高三物理高考常考知識點選擇題歸納
- 我國房屋安全管理的現(xiàn)狀與對策
評論
0/150
提交評論