Search code examples
macosdnsupnp

How to set DNS Servers on Router from OSX Client?


I want to set the dns servers that my router will hand out to all clients from a program running on osx. Is there any native way to do this. Does osx provide any uPNP wrapper apis. I have seen some 3rd party apis for uPNP like minipnp etc, but would prefer to use the OS if available.

It seems from people I have talked to that "DNSServiceNATPortMappingCreate" will do uPNP nat port forwards. So should I assume DNSServiceAddRecord would do the same?


Solution

  • You've no chance.

    Many routers don't even support overriding the DHCP DNS settings from their own GUI, let alone from uPNP. See Section 5 of RFC 5625 for the gory details on how DHCP and DNS interact on routers.

    The only practical solution is to run your own DHCP server, and turn off the one on the router. If your OSX machine is your network server you can easily install ISC DHCPD from the MacPorts project.