Angelo
Feb 22, 2013Nimbostratus
DNS rewrite
Hi
I need a create a irule to rewrite a DNS entry i though it would be quite simple will i tried to write it LOL. basically i need to rewrite app.pac.com to app4.pac.com i thought about ...
You need to be running 11.1 or newer and have either GTM or DNS Services licensed for this rule to work:
when DNS_REQUEST {
if { [DNS::question name] eq "app.pac.com" } {
DNS::question name app4.pac.com
}
}
when DNS_RESPONSE {
if { [ expr { [DNS::header rcode] eq "NOERROR"} ] && [ expr { [DNS::header ancount] > 0 } ] } {
if { [DNS::question name] eq "app4.pac.com" } {
DNS::question name app.pac.com
}
foreach a [DNS::answer] {
if { [DNS::name $a] eq "app4.pac.com" } {
DNS::name $a app.pac.com
}
}
}
}
But since the effect of this rule is to create an alias, why don't you just use a CNAME entry in the dns zone file?