load balance DNS request

I would appreciate some help creating an iRule on a DNS listener to point specific DNS request to an Internal Pool of DNS servers and send all others to an External Pool of DNS servers.

I created rule below which is not working.

when DNS_REQUEST { if { [DNS::name contains “company.com”] || [DNS::name contains “company.us”] } {pool Internal_DNS } else {pool External_DNS} }

Any assistance with this would be greatly appreciated.

Below was the solution.

when DNS_REQUEST { if { [DNS::question name] ends_with “company.com” or [DNS::question name] ends_with “company.us” } {pool Internal_DNS} else {pool External_DNS} }