Forum Discussion

Leo_D_53884's avatar
Leo_D_53884
Icon for Nimbostratus rankNimbostratus
Jan 25, 2013

GTM iRule for Data Center Selection

All,

 

I have an interesting scenario, two data centers, NY with 1 GTM, 1 LTM cluster and Tokyo with no GTMs, 1 LTM cluster. I have different public IPs at each data center that are NATed to each LTM VS private IP. Since the GTM responded to DNS queries with the LTM VS private IP I wrote an iRule to respond with the Public IP address. What I would like to do is improve on the iRule so when NYC VS NYC-HTTP-VS goes down my iRule will respond with 1.1.2.10 the Tokyo public address.

 

NYC Data Center

 

Public IP 1.1.1.10 NATed to 10.10.20.5

 

LTM HTTP Virtual Server NYC-HTTP-VS is 10.10.20.5

 

LTM HTTP Pool HTTP-POOL

 

GTM iRule

 

when DNS_REQUEST {

 

if { [DNS::rrname] eq "www.wip.leo-d.com" } {

 

host 1.1.1.10

 

}

 

}

 

 

 

Tokyo Data Center

 

Public IP is 1.1.2.10 NATed to 10.10.30.5

 

LTM HTTP Virtual Server TKY-HTTP-VS is 10.10.30.5

 

LTM HTTP Pool HTTP-POOL

 

No GTM at this site

 

 

I have looked at the Jason Rahms post on new GTM iRules and it gets me in the ball park but I still am not sure.

 

https://devcentral.f5.com/tech-tips/articles/v10-new-gtm-irules-commands.UQLHD-z_Fog

 

 

I also looked at Colin Walkers post and am wondering if I should handle this some how with a CNAME redirect. Bottom line I am looking to trigger an action (new host IP) on an event (VS is down (GTM Pool member is down)).

 

https://devcentral.f5.com/tech-tips/articles/gtm-and-irules-allowing-intelligent-redirection-for-most-protocols.UQLHeOz_Fog

 

Sorry for the novel, any advise appreciated!

 

 

leo

 

2 Replies

  • Hi Leo,

     

    If I am reading this correctly, then you should also monitor the Tokyo LTM via the GTM pool

     

     

    Then you could then re-write the irule as the following:

     

     

    when DNS_REQUEST {

     

    if { [active_members pool_tokyo] == 0 } {

     

    host 1.1.2.10

     

    } else {

     

    if { [DNS::rrname] eq "www.wip.leo-d.com" } {

     

    host 1.1.1.10

     

    }

     

    }

     

    }

     

     

    I haven't tested this out but hopefully this works for you

     

     

    =Bhattman=

     

  • Bhattman,

     

     

    Actually I started to test this and realized that I need to look at the members of the pool. The pool HTTP-POOL would have two members NYC-HTTP-VS and TKY-HTTP-VS. What I am trying to do is trigger a response dependent on the status of the pool member. For example, when NYC-HTTP-VS is not available then I would direct traffic to Tokyo via the host 1.1.2.10 IP. If pool member NYC-HTTP-VS is available then I would like to direct traffic to NY via the host 1.1.1.10. The part I need help with is determining when the pool member, TKY-HTTP-VS is down. Thanks a bunch.

     

     

    leo