Forum Discussion

zafer's avatar
zafer
Icon for Nimbostratus rankNimbostratus
Sep 10, 2007

convert v9x to v4x

Hello,

 

 

how can i change this code for v4.x

 

 

best regards

 

 

zafer

 

 

 

when RULE_INIT {

 

These are global variables

 

set ::time [clock seconds]

 

set ::poolb_selected 0

 

log local0. "second time from epoc is: $::time"

 

}

 

when CLIENT_ACCEPTED {

 

set persist_time 180

 

if { [active_nodes poolA] == 0} {

 

log local0. "poolA is failing..."

 

if { $::poolb_selected equals 0 } {

 

log local0. "poolB value is: 0"

 

set ::time [clock seconds]

 

set ::poolb_selected 1

 

pool poolB

 

persist source_addr 180

 

} else {

 

log "poolB value is: $::poolb_selected"

 

pool poolB

 

}

 

} else {

 

log local0. "poolA is available..."

 

if { $::poolb_selected == 0 } {

 

log "poolA never went down"

 

} else {

 

log "poolb_selected value is: $::poolb_selected"

 

set curtime [clock seconds]

 

set expirationTime [expr {$::time + $persist_time}]

 

if { $curtime > $expirationTime } {

 

set ::poolb_selected 0

 

pool poolA

 

} else {

 

pool poolB

 

}

 

}

 

}

 

}

7 Replies

  • There are several issues with back-porting this to v4.x:

     

     

    1. 4.x does not have support for user based local variables.

     

    2. 4.x has no "clock" command for determining time.

     

     

    Looks to me that there is not way to fully support this in v4.x. Anyone else have any ideas?

     

     

    -Joe
  • zafer's avatar
    zafer
    Icon for Nimbostratus rankNimbostratus
    Hi Joe

     

     

    Could you give me any suggestion for this problem, i want explain to you why

     

    we wrote this code.

     

     

    we have two site, A and B and we have redundant LTM 5100 units each sites

     

     

    if Site A goes down (vip nodes goes down), redirect traffic to Site B and keep

     

    traffic 7 days

     

     

    thats all .

     

     

    what can i do ?

     

     

    best regards

     

     

    zafer
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Hi Zafer -

     

     

    I agree with Joe, there really isn't a way to automate this with iRules.

     

     

    /deb
  • zafer's avatar
    zafer
    Icon for Nimbostratus rankNimbostratus
    Hi Deb,

     

     

    Could you please help me how can i solve my problem, i want exxplain what i want do

     

     

    we have two wan site A and B

     

    they have connectivity each site has same server but different ip network

     

     

    Pool A in Site A node1: 1.1.1.1 node2: 1.1.1.2

     

    Pool B in Site B node1: 2.2.2.1 node2: 2.2.2.2

     

     

    same servers and contents They are ldap servers and it does not important application replication for us

     

     

    Clients know same vip adress (not dns adress) and they dont change anythings

     

     

    client request vip (in site A) if poolA is down not have active member, i enable Pool B for this vip and pool B has Site B nodes and add persistency with 7 days and after 7 days persistency record will expire.

     

     

    i tested my irule in v9 it worked but we use 5100 model with v4.x and you say i cant use it

     

     

    so What can i do for this issue?

     

     

    regards

     

     

    zafer

     

     

     

     

  • zafer's avatar
    zafer
    Icon for Nimbostratus rankNimbostratus
    Hi deb,

     

    thanks for information but i gaved shortly sample for explanation

     

     

    we use 3 members in pool each site

     

     

    regards

     

     

    zafer