Forum Discussion

aalkhuja_160331's avatar
Dec 25, 2017

iRule to change the DNS response IP inside the header

Hi there,

 

I want to create an iRule to change the address in the DNS Response header (coming from the DNS) from public IP to private. Knowing that F5 is not the DNS itself (it is before the DNS). The F5 is already provisioned with both GTM and LTM.

 

Any thoughts,

 

Thank you

 

Ammar

 

1 Reply

  • you can try something like this:

    when DNS_RESPONSE {
        set rrs [DNS::answer]
        DNS::answer clear    
        foreach rr $rrs {
            if {[lindex $rr 4] equals "4.3.2.1"} {
                    DNS::answer insert "[lindex $rr 0] [lindex $rr 1] [lindex $rr 2] [lindex $rr 3] 1.2.3.4"
            } else {
                DNS::answer insert $rr
            }
        }
    
    }