[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 “,” --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: .
  • 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