[Solution] Incorrect Hostname and IP address mapping in the /etc/hosts file

Hi,

We have noticed that the m103 and m103.mongodb.university hostnames are not getting mapped to the correct IP address i.e. 192.168.103.100 in the /etc/hosts file in the Vagrant environment.

Due to this, learners are having difficulty in completing the labs when they add a node in the replica set using the hostnames.

For the resolution of the issue, you have to modify this line :

127.0.0.1 m103.mongodb.university m103


You can edit the /etc/hosts/ file using the vim editor. Run this command in the vagrant prompt to open the file.

sudo vim /etc/hosts

This will open the hosts file in your terminal. Now press i and hit enter to enter the insert mode.

Change 127.0.0.1 to 192.168.103.100 in the first line.

Press esc and then,
Press :x and enter to save and exit

After making the change, your /etc/hosts file would look like this.

You can verify the changes by pinging the hostnames.

ping m103

ping m103.mongodb.university

Both the ping results will show 192.168.103.100.

Hope it helps!

Please feel free to get back to us if you have any query.

Thanks,
Shubham Ranjan
Curriculum Services Engineer