How to Configure Remote Access for MongoDB on Ubuntu and Windows

Sifeddine Lamraoui
4 min readAug 5, 2022

MongoDB is the most popular NoSQL database today, it’s a document-oriented database used in many modern web applications. By default, it only allows same-server connections when it’s installed, and if you want to access it from a remote server in the same private network or over the internet, then you can follow this guild to make the necessary changes to do so.

To configure remote access, we will be doing the following:

  • Configure IP Binding
  • Configure the Firewall
  • Test Remote Connectivity

So let’s get started.

Prerequisites

  • A server with a working MongoDB installation on Windows, or on Ubuntu with UFW configured.
  • A second computer to access your MongoDB instance remotely.

Configure IP Binding

IP Binding is used to make MongoDB only listen to a particular set of IP addresses, as I mentioned above it only allows same-server connections that’s because it binds to localhost by default, so we need to change its default configuration to bind to our trusted IP addresses.

Ubuntu

--

--

Sifeddine Lamraoui

I’m a Software Developer, Interested in Technology and Computer Science.