Forum Discussion
Jim_Mathers_131
Jun 10, 2015Nimbostratus
GTM iRule to return CNAMEs based on LB_SELECTED
Hello,
Just want to make sure my iRule beneath my signature is correct. My intent:
- If the GTM chooses server 1.1.1.1, return cname "foo1.bar.com".
- If the GTM chooses server 2.2.2.2, return cname "foo2.bar.com"
- If the GTM chooses another server not equal to 1.1.1.1 or 2.2.2.2, return that server's IP address directly to the LDNS client.
Will this work?
Thanks, Jim
when LB_SELECTED {
if {[LB::server addr] equals "1.1.1.1"} {
persist enable
cname "foo1.bar.com"
}
elseif {[LB::server addr] equals "2.2.2.2"} {
persist enable
cname "foo2.bar.com"
}
}
- Samir_Jha_52506Noctilucent
Something like this. Please try link.
when DNS_REQUEST { if { [IP::addr [IP::remote_addr] equals 10.10.1.0/32] } { cname foo1.bar.com } elseif {[IP::addr [IP::remote_addr] equals 2.2.2.2/32] } { cname foo2.bar.com } }
- Jim_Mathers_131NimbostratusHello Samir, Thank you for the answer. My intent is not to return CNAMEs based on DNS_REQUEST but instead to return a CNAME based on the Pool Member selected by the GTM, which is why I think the event LB_SELECTED is more appropriate. In your config, you are triggering on DNS_REQUEST, I need to trigger based on LB_SELECTED (I think). Thanks, Jim
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects