I can think of two options at least:
1. External lookup
Perform a DNS lookup via script. See this.
PROS: quick and easy to configure
2. DB or CSV lookup
Write a script to dump all your internal DNS records into a CSV file or SQL database
Then configure a file or database lookup.
Keep in mind CSV is natively supported whereas DB is not and you need an app.
PROS: good performance
CONS: requires some maintenance and might not be fully real-time
Hope that helps.
... View more