I added bindIpAll: true and I have a db with user and pass, when I run this Command from Ubuntu Terminal, everything is ok and I can Connect to db, But When I run That from my Laptop I Get This Error:

mongo -u user3 -p SOh3ThghgypJPxmt1oOfL myServerIP/db


E QUERY    [thread1] Error: couldn't connect to server myServerIP:27017, connection attempt failed :
exception: connect failed

I Added My Laptop Ip to server and Solved.

sudo iptables -A INPUT -s myyyyyyLaptopIp -p tcp --destination-port 27017 -m state --state NEW,ESTABLISHED -j ACCEPT

sudo iptables -A OUTPUT -d myyyyyyLaptopIp -p tcp --source-port 27017 -m state --state ESTABLISHED -j ACCEPT

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.