Question

I would like to have a local DNS server which I can configure in some way. Maybe a php script, which gets the requested hostname and returns the IP. I don't want to have an IP/Hostname list, but I want to generate the IPs in code! Do you know how to do this?

Was it helpful?

Solution

Simple DNS Plus has several APIs (plain HTTP, .NET, COM, command line) that are easy to use.

For example, you could add an IP-address (A-record) by seding it a simple HTTP request like "http://127.0.0.1:8053/updatehost?host=test.example.com&data=1.2.3.4" - which you could issue from your PHP script with the standard cURL library.

OTHER TIPS

Maybe MyDNS is something to look into. It gets the IPs from a database (MySQL or PostgreSQL).

I don't know if it can be hooked directly to another source. But maybe it is wiser to decouple that and let the database be updated from the internet-source and let the DNS system query the database.

How about utilizing your hosts file?

I'm not quite sure what it is that you want, but many routers have a built in DNS capability which is usually very easy to use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top