When you buld these servers are you using your own hosted infrastructure or are you using a cloud provider (AWS, Azure, etc.)?
Are you able to establish a connection between the machines outside of the Atlassian applications (using ping or something to that nature?)
Have you checked the log files for either BitBucket or Bamboo to see if there is any additional information provided on the errors when you are trying to connect?