Forum Discussion
matus_c_59161
Nimbostratus
Dec 21, 2011node with dynamic IP
hello guys,
We're trying to add node that has a dynamic IP to the LTM virtual server pool.
The goal is to forward the outbound traffic to the internet via LTM to host that has a dynamic...
hoolio
Cirrostratus
May 31, 2012You can use lindex to get the first list element:
From: https://devcentral.f5.com/wiki/iRules.resolv__lookup.ashx
Select the first returned IP address as the destination IP (inherits the destination port from the client's destination port).
when RULE_INIT {
set static::dns_vs my_dns_vs
}
when CLIENT_ACCEPTED {
Get IP(s) for hostname www.example.com against 4.2.2.1 name server
set ips [RESOLV::lookup @$static::dns_vs -a "www.example.com"]
Log result. If there are multiple IP's it could be a TCL list like {1.1.1.1 2.2.2.2 3.3.3.3}.
log local0. "Looked up www.example.com and found $ips, parsed first element: [lindex $ips 0]"
Check if the first list element was empty
if {$ips eq ""}{
Input wasn't an IP address, take some default action?
} else {
Select the IP
node [lindex $ips 0]
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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