Recently at work, due to a network switch going up and down, our production macOS Server that distributes Profiles to several hundred Macs had it’s Open Directory Master think that is had a self-assigned IP address. While other services remained with their standard host address, Open Directory was decidedly broken.
I’m not sure how this happened, possibly because the switch we restarted an untold number of times in the span of an hour, but there was no way to use the GUI to repair this. Even going into the Server.app and changing the servers hostname and then back again in an attempt to fool it, which I read could also realign IP addresses, failed.
It also appears even if the GUI correctly changes and “resolves” a changed IP, Open Directory will often not be updated.
I then discovered the changeip command line utility. I quick look at the man page and it seems like it would do the trick.
$ sudo changeip 169.254.249.204 10.0.1.201 stargate.example.com stargate.example.com
The format is: [old ip] [new ip] [old hostname] [new hostname]
If you are only changing the IP address of your server, just don’t enter any hostnames.
A reboot later and I was back in business.
Note: you will getting errors running this if you don’t have all services enabled, and that’s okay!
A handy trinket to keep on hand for sure, and it looks like you can use it to also change the hostname of your server as well, but that would probably break all your Profile Managed devices when they try to resolve. So, use this with care!