Block DNS domain on Big IP DNS

Hello,

I am trying to block certain domains on a specific Listener (ie ) Can you help me writing an iRule?

you can try something like that:

when DNS_REQUEST {
    if { [DNS::question name] ends_with "example.com" } {
        noerror
        DNS::return
    }
}