Just add 27017/tcp to iptable and it will work! sudo firewall-cmd –zone=public –add-port=27017/tcp –permanent sudo firewall-cmd –reload Check using: sudo iptables -L -v and/or sudo firewall-cmd –list-ports Check if firewalld is running: sudo systemctl status firewalld tested on: ubuntu: 22.04.1 LTS Make sure you have disable ufw: sudo ufw disable Errors: E-1: connect ECONNREFUSED …