Forum Discussion
Kai_Wilke
Dec 21, 2015MVP
Hi Kmussa,
customized Hamish Marson's "GTM traslation" iRule for you needs...
Original iRule can be found here: https://devcentral.f5.com/wiki/iRules.GTM-Translation.ashx
when DNS_RESPONSE {
foreach rr [DNS::answer] {
if { ([DNS::type $rr] eq "A") } then {
if { [IP::addr [DNS::rdata $rr] equals 10.10.10.0/24]) } then {
log -noname local0.debug "DNS Rewrite: [DNS::rdata $rr] > 1.1.1.[getfield [DNS::rdata $rr] "." 4]"
DNS::rdata $rr "1.1.1.[getfield [DNS::rdata $rr] "." 4]"
} elseif { [IP::addr [DNS::rdata $rr] equals 20.20.20.0/24]) } then {
log -noname local0.debug "DNS Rewrite: [DNS::rdata $rr] > 2.2.2.[getfield [DNS::rdata $rr] "." 4]"
DNS::rdata $rr "2.2.2.[getfield [DNS::rdata $rr] "." 4]"
}
}
}
}
Note: I don't have a GTM to my hands, hope it will work out... 🙂
Cheers, Kai