close

 

 

【F5】iRules 設定

[狀況]
WAN端出口有兩條線路

目標
1.設備IP為 1.1.1.1 的流量需走Pool"p_link_first"
2.其他走另一條Pool"p_default_gw"
3.開啟log紀錄

when CLIENT_ACCEPTED {   
  if { [IP::addr [IP::local_addr] equals 1.1.1.1/32] } {   
    pool p_link_first
    log local0. "link_first-- Client:[IP::client_addr] Pool:[LB::server pool] Link:[LB::server addr] IP Local:[IP::local_addr]"
  } else {   
    pool p_default_gw
    log local0. "default_gw-- Client:[IP::client_addr] Pool:[LB::server pool] Link:[LB::server addr] IP Local:[IP::local_addr]"
  }   
}   

 

[狀況]
設定固定IP轉給特定member主機

目標
1.將設備IP 1.1.1.1 的80流量轉給"p_link_first" 中的member主機 192.168.1.222
2.其他走另一條Pool"p_default_gw"

when CLIENT_ACCEPTED {   
  if { [IP::addr [IP::local_addr] equals 1.1.1.1/32] } {   
    pool p_link_first member 192.168.1.222 80
  } else {   
    pool p_default_gw
  }   
}

[狀況]
設定特定IP連線中斷

目標
1.將IP是 10.1.1.80 的連線中斷

when SERVER_CONNECTED {
  if { [IP::addr [IP::addr [clientside {IP::remote_addr}] equals 10.1.1.80] } {
discard }
}


*也可以使用class建立IP群組再套用iRules
when CLIENT_ACCEPTED {
  if { [class match [IP::remote_addr] equals aol] } {
     pool aol_pool
  } else {
     pool all_pool
 }
}


查看log

#tail -f /var/log/ltm 

Use <Ctrl-C> to stop the tail output

 

 

arrow
arrow
    文章標籤
    f5 big-ip iRules
    全站熱搜

    鵝 發表在 痞客邦 留言(0) 人氣()