Failed to set up listener: Cannot assign requested address when binding ips

Hey there, I’m running on a Raspberry Pi 4 with Ubuntu 20.04 and MongoDB version 4.2.7. Today I installed Mongodb but by binding the ip of my Workstation I got this Error (48 - " Failed to set up listener: SocketException: Cannot assign requested address"). But by pinging this address I get a response.

I’ve tried to bind this address over the config and also with “monogd --bind_ip 127.0.0.1:28000,192.168.xxx.xxx”. I’ve also tried to use another distro but no success…

Hi @J_Hoffm,

The bind_ip is a comma separated list of IP addresses without port number. Have you tried

mongod --bind_ip 127.0.0.1,192.168.xxx.xxx

Note you also had monogd which I assume was just a typo when posting your question.

If you want to change the port that mongod listens on you can add --port 28000 to the command above.

1 Like

Hey @Doug_Duncan,
thank you for your reply.

Now I’ve tried to bind these ips without the port but it makes no difference (tried mongo config & command). I’ve also tired to bind the ips without localhost (127.0.0.1).

But every time I get the same Error (48): “SocketException: Cannot assign requested address”.

You may be having another mongod instance already running on that port

Try with another port and see if it works

Please provide the output of

ifconfig | grep [i]net