I have shut down and restarted all servers. It doesn't change anything.
Also, on the one host that had nothing on it but the vCenter appliance which the vCenter appliance couldn't attach to, I reinstalled the vCenter appliance but this didn't help. I then reinstalled VMware from scratch and then installed the vCenter appliance and now vCenter can attach to that host. It still fails attempting to attach to the other hosts. I also changed IP addresses of all hosts but this didn't help either.