MongoDB bind_ip error: bind() failed errno:99 Cannot assign requested address for socket

醉酒当歌 提交于 2019-12-20 17:35:31

问题


I want to configure mongodb to allow remote connections from an external ip address like 66.31.123.123.

Setting 0.0.0.0 to bind_ip works, but I want to be more restrictive and only allow certain ip addresses to connect. I appended 66.31.123.123 to the bind_ip list but mongodb throws an error below:

mongodb.conf

bind_ip = 127.0.0.1,66.31.123.123
port = 27017

auth = true

mongodb logs

Mon Dec  9 03:25:59 [initandlisten] ERROR: listen(): bind() failed errno:99 Cannot assign requested address for socket: 66.31.123.123:27017

Question: Why does adding an external ip not work? If auth=true is used, does that make it safe enough to use 0.0.0.0 as the bind_ip? The mongodb will be locally accessed from a Meteor.js app.


回答1:


As guido said, the bind_ip is for the mongo server's own IP address.

Auth is a good idea but only relying on auth opens you up to a brute force attack.

You could bind_ip = 0.0.0.0 and use a firewall to block all incoming connections to port 27017, unless coming from 66.31.123.123.

Another concern is proximity of your meteor server to your mongo server — is it on private networking or across public network. If across public, you should either recompile mongodb to support SSL, or you should tunnel your mongodb connection through SSH.

If you do decide to tunnel, bind_ip to 127.0.0.1 and leave out incoming 27017.



来源:https://stackoverflow.com/questions/20466250/mongodb-bind-ip-error-bind-failed-errno99-cannot-assign-requested-address-fo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!