title: can't connect to mongodb remotely after opening ubuntu firewall and mongod.conf
body: <p>Can't connect to mongodb remotely on fresh installation of mongodb on ubuntu 20.10 server on Linode.</p>
  <pre><code>root@localhost:~# sudo ufw status
  Status: active
  
  To                         Action      From
  --                         ------      ----
  22                         ALLOW       Anywhere
  27017                      ALLOW       0.0.0.0
  22 (v6)                    ALLOW       Anywhere (v6)
  </code></pre>
  <p>/etc/mongod.conf</p>
  <pre><code>net:
    port: 27017
    bindIp: 0.0.0.0
  </code></pre>
  <p>mongo server is up and running</p>
  <pre><code>root@localhost:~# sudo service mongod status
  ● mongod.service - MongoDB Database Server
       Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
       Active: active (running) since Sun 2021-04-04 18:34:05 UTC; 19min ago
         Docs: https://docs.mongodb.org/manual
     Main PID: 1332 (mongod)
       Memory: 161.0M
       CGroup: /system.slice/mongod.service
               └─1332 /usr/bin/mongod --config /etc/mongod.conf
  
  Apr 04 18:34:05 localhost systemd[1]: Started MongoDB Database Server.
  </code></pre>
  <p>netstat on host running mongo server</p>
  <pre><code>root@localhost:~# sudo netstat -tulpn
  Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
  tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      1332/mongod
  tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      640/systemd-resolve
  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      817/sshd: /usr/sbin
  tcp6       0      0 :::22                   :::*                    LISTEN      817/sshd: /usr/sbin
  udp        0      0 127.0.0.53:53           0.0.0.0:*                           640/systemd-resolve
  </code></pre>
  <p><code>nc -zv IP_ADDRESS 27017</code> times out, so <code>mongo -u $DB_USERNAME -p $DB_PASSWORD IP_ADDRESS/admin</code> will just time out as well</p>
  <p><code>nc -zv IP_ADDRESS 22</code> works as expected</p>