Forum Discussion
Angelo
Nimbostratus
Feb 21, 2013DNS 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 a simple redirect that would work but i just need to know if you can.
i read on the forum that it is possible but the code share links make no sense at all...
1 Reply
- Ian_SmithRet. EmployeeThe tricky part is that the response also contains the question, so you have to change all instances of "app4.pac.com" back as the response passes by or the original requestor will reject it.
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?
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