PPawar, If you are using the default "dns" profile (it sounds like you are) the behavior you are seeing doesn't match my experience. I don't necessarily have an answer for you but some next steps that may get us there.
Do the DNS servers in the DNS Pool respond to test1.abc.com and test2.abc.com? If so, for troubleshooting you could change the IP in one place to see where the response is coming from.
I feel like there is a way to get DNS/GTM to indicate (log) how it made the resolution decision but I may be thinking of logging Load Balancing reasoning. I'll keep digging.
The flow should go as follows (this is not definitive, but covers most bases):
- DNS query received at Listener.
- Packet validated by IP and UCP/TCP profiles and dropped if malformed etc.
- Listener (LTM-type) iRules which have certain DNS/GTM-related limitations.
- DNSSEC
- Wide IP (DNS/GTM-type) iRules (if applicable) which have certain DNS/GTM/LTM-related limitations.
- DNS Express
- DNS Cache
- DNS Resolving Cache
- Unhandled Query Action: Allow (OPTION 1): DNS Load Balancing (to configured DNS Pool) if DNS Pool assigned to Listener.
- Unhandled Query Action: Allow (OPTION 2): F5-local BIND if DNS Pool NOT assigned to Listener AND "Use BIND Server on BIG-IP" set to Enabled.
- Unhandled Query Action: Allow (OPTION 3): Forward (not LB) to a DNS server (DNS server IP must match Listener IP) as long as Listener IP is not a Self IP (not using a Self IP is recommended best practice starting in 12.1, I believe--using a Self IP may have been required in v11 and earlier) AND if DNS Pool NOT assigned to Listener AND "Use BIND Server on BIG-IP" set to Disabled.