This iRule uses data groups and should allow you some more flexibility going forward, if you wish to add more domains. This will require you to create two data groups (string type is fine) in order for this to work:
dotuk_group (include gcsx.gov.uk and gsi.gov.uk domains)
nhs_group (include nhs.uk domain)
This iRule should work for you:
when DNS_REQUEST {
DNS::question name [string tolower [DNS::question name]]
if { [class match [DNS::question name] eq dotuk_group] } {
DNS::disable all
pool pool1
}
elseif { [class match [DNS::question name] eq nhs_group] } {
DNS::disable all
pool pool2
}
else {
DNS::disable all
pool default_pool
}
}