Forum Discussion
Ken_B_50116
Jun 13, 2012Cirrostratus
Again, thanks for taking the time to work up that code. For the sake of simplicity, I'm going to try a version that avoids needing any data groups. This iRule is focused on matching the hostname and not the domain name, or the end of the FQDN.
when RULE_INIT {
Log debug to /var/log/ltm? 1=yes, 0=no.
set static::dns_debug 0
set static::dns_server 10.10.9.8
}
when CLIENT_ACCEPTED {
Get PTR for client's IP address
set ptr [RESOLV::lookup @$static::dns_server -ptr [IP::client_addr]]
if {$static::dns_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: Resolved $ptr"}
Check if a pointer record was returned
if {$ptr eq ""}{
No PTR, so use the VS default pool
if {$static::dns_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: No PTR!"}
pool [LB::server pool]
} else {
switch -glob -- [string tolower $ptr] {
"wtscern*" { pool pool_Multum_prod }
"wtsc4prod*" { pool pool_Multum_prod }
"wtsc4test*" { pool pool_Multum_nonprod }
"wtsc4cert*" { pool pool_Multum_nonprod }
"wtsc4edu*" { pool pool_Multum_nonprod }
"vmqa*" { pool pool_Multum_nonprod }
}
}
}