Backup Domain Controller can't join Domain - ERROR: Invalid IP address mydomain.com

I spent a couple hours troubleshooting this, and it turned out it was a firewall at the network level blocking outgoing ports that are necessary according to this.