irule to redirect DNS traffic

We are trying to create an iRule to catch any wayward DNS traffic. We created a default VS for all port 53 traffic, but now we need a specific iRule so that we can forward these DNS request to the NameServer that isn’t on the same network.

For the life of me I can’t seem to find something on here that will do that. I’m looking for something like:

when CLIENT_ACCEPTED {

if { [IP::addr [IP::client_addr] equals “0.0.0.0/0”]

} {

node “192.168.1.1”

}

}

Any help would be greatly appreciated.

If it’s on a seperate network you might need to apply SNAT Automap into your irule

I.E.

when CLIENT_ACCEPTED { 
    if { [IP::addr[IP::client_addr] eq "0.0.0.0/0"] } { 
       snat automap 
       node 192.168.1.1 
       } 
 }

I hope this helps

CB

Another option would be to enable SNAT automap on the VIP and create a pool with 192.168.1.1 in it and remove the iRule.

Aaron

You may also consider a service specific 0.0.0.0:53 VIP with this iRule applied to it. That way you’ll be able to treat this traffic uniquely from a profile/protocol/iRule perspective.

-Matt