Vagrant box hosts file entries conflicts


I noticed that when adding a new node to replica set m103:27003 for the lab Remove and Re-Add a Node, I have NETWORK issue: Failed to connect to!

Checking the /etc/hosts file, I see that the hostname m103 is assigned to both and IP addresses!

In my conf files for the nodes, I have set the bindIp to,, which should map it correctly. But it does not.

I have now commented the line:
# m103


Now I have no error and my replica set response to rs.isMaster() shows the following hosts:
“hosts” : [

So one of the node shows the hostname instead of its IP in case there is an IP reconfiguration for the hostname and the DNS keeps finding the correct machine.

Now I do not have any NETWORK failure to a wrong IP address.

Why did we have this entry in the first place in the /etc/hosts file when the virtual machine was created from vagrant?

This may help.Known issue/BUG

Problem with IP