You haven't mentioned ontap version here, b'cos the DNS reachability requirement has changed since 8.3.
Beginning with Data ONTAP 8.3, each Data SVM must be configured with its assigned DNS servers. This includes ensuring that DNS servers configured on the Data SVM are accessible from LIFs hosted by that SVM.
In case the filer is running 8.3 or later, Data SVM can use any available gateway that can reach the DNS server IP? However, the recommended practice is to use one separate mgmt LIF (data protocol=none) per data SVM to talk to DNS (or other external mgmt services) server.
You can verify the DNS reachability via these commands, try both LIFs.