I'm trying to setup a mongodb in a FreeBSD jail. I found in the documetation that I can set the bind_ip to to allow only access from localhost. But when I check with sockstats it's bound to my jail ip and not to localhost.

sockstats -l46

mongodb mongod 86661 6 tcp4 *:*

My mongodb config

port = 27017
bind_ip = # do not communicate with the external world
maxConns = 100 # you may want more
objcheck = true
dbpath = /var/db/mongodb
noauth = true

So my question is why is that bound to and not to


You probably need to add to the jail, as jails will forbid binding to anything but the jail ip.

But, if you want to confine mongo just to the jail, maybe a better idea would be to firewall it ... using in jail could be wrong from security point of view.

  • With firewall it you mean something like a pf rule to allow access to the mongodb instance only from the jail ip? May 15 '15 at 9:49
  • Yes. Or you could add another loopback with different ip allowed in the jail ...
    – Fox
    May 15 '15 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.