[Solution] Cannot assign requested address

Hi Everyone,

When trying to run mongod with bind_ip like:

vagrant@m103:~$ mongod --port XXXX --dbpath XXXX --bind_ip “127.0.0.1,192.168.103.100” --auth

If you encounter error like:

Failed to set up listener: SocketException: Cannot assign requested address xxx I CONTROL [initandlisten] now exiting xxxI CONTROL [initandlisten] shutting down with code:48

Steps to follow:

  • Check ifconfig from your vagrant box. Look for IP: 192.168.103.100 .
  • If you can see the IP, then restart vagrant and try again.
  • If you don’t see the IP, then provision your vagrant again.
  • Exit your vagrant. Run these commands.
  • vagrant halt
  • vagrant up --provision
  • Try mongod again.

Let me know if it still don’t work.

Thanks, Kanika

2 Likes