Skip to content
Studio 3T - The professional GUI, IDE and client for MongoDB
  • Tools
    • Aggregation Editor
    • IntelliShell
    • Visual Query Builder
    • Export Wizard
    • Import Wizard
    • Query Code
    • SQL Query
    • Connect
    • Schema Explorer
    • Compare
    • SQL ⇔ MongoDB Migration
    • Data Masking
    • Task Scheduler
    • Reschema
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Blog
    • Community
    • Testimonials
    • Whitepapers
    • Reports
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Careers
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • Download
  • My 3T
search

Studio 3T Knowledge Base

  • Documentation
  • Tutorials
  • Workshops
Take the fastest route to learning MongoDB. Cover the basics in two hours with MongoDB 101, no registration required.
Start the free course

How to Fix MongoDB Atlas IP Whitelisting Issues

Posted on: 21/04/2020 (last updated: 31/08/2021) by Kathryn Vargas

When you create a MongoDB Atlas account, you are asked to “whitelist your current IP address”.

Whitelisting is a sensible precaution to make it difficult for an attacker to get to the point of having the opportunity to guess your credentials.

This security feature, however, has also caused many a headache when connecting to MongoDB Atlas.

In this article, we present solutions to the most common MongoDB Atlas login issues that relate to IP whitelisting.

Why IP whitelisting matters

In Studio 3T, users see the error Prematurely reached end of stream when their current IP address isn’t whitelisted on MongoDB Atlas.

MongoDB Atlas connection error in Studio 3T

The problem is that most IP addresses are dynamic, instead of static. They change over time as your network assigns them to devices connecting to the internet. As one user reported, even a quick power shortage was enough for his router to change its IP address.

MongoDB Atlas only allows client connections to your cluster from IP addresses that are matched by entries in your project’s IP whitelist.

You may need to access your cluster from several locations, and these locations can involve the IP address being allocated to you just for that connection. This is why you need to whitelist both your home and work IP address, for example.

Do you need to access multiple MongoDB Atlas accounts at once? Connect to as many clusters as you need with Studio 3T. Try it for free.

Even your own permanent location can have an dynamic IP address allocated within a range. If you are allowing cloud-based processes such as websites to access your Atlas cluster, you will need to add the IP addresses of your services to your Atlas project’s IP whitelist to grant those services access to the cluster.

A well-managed whitelist is a valuable first-line defense that will deter a high proportion of opportunistic attackers. Each whitelist entry can either be a single IP address or a range of addresses – and you can enter up to 200 whitelist entries.

Changes to old IP addresses

Because most IP addresses change over time, the IP address you whitelisted in MongoDB Atlas might have changed since your initial setup. This is perhaps the most common MongoDB Atlas login issue.

Follow these steps to add your current IP address to the IP whitelist tab, or add a range of IP addresses as listed by your provider.

Wrong current IP address detected

On the note of detecting current IP addresses, sometimes MongoDB Atlas doesn’t (automatically) get it right.

If you’ve already whitelisted your current IP address and you’re still getting a connection error after your MongoDB Atlas login, try a quick “whats my ip” Google search or use a tool like whatsmyip.org.

Double-check that the IP addresses are the same, and if not, try whitelisting the other IP addresses instead.

If the other IP addresses also don’t work, continue reading this troubleshooting guide to see if other factors are at play: maybe you need to whitelist your VPN or check your router settings.

Connecting from a different physical location

If you’ve set up your MongoDB Atlas connection, say in the office, and are now trying to connect from home, that means you need to add your home IP address to the IP Whitelist tab, too.

Add the new IP address by following these steps.

Connecting to MongoDB Atlas through a VPN

If you’re using a VPN and are getting a connection error, chances are you’ve whitelisted your current IP address but MongoDB Atlas is still blocking your VPN’s IP address.

Confirm that you have your VPN IP address and add it to your IP whitelist tab.

Router settings

Some users have reported that their router sometimes didn’t allow them to connect to the default MongoDB ports.

A good way to check is to connect to a different network (e.g. tethering to your phone for internet) to see if connecting to MongoDB Atlas works then. If it does, then it could very well be a router setting issue.

How to whitelist IP addresses on MongoDB Atlas

Whitelist your current IP address

With your MongoDB Atlas login credentials, open your account and find the cluster that is triggering the error message.

Next, click on Network Access under the Security tab on the left-hand sidebar. This will take you to the IP Whitelist tab.

Click on Add IP Address in the top-right corner. This will open the Add IP Whitelist Entry dialog.

The MongoDB Atlas IP whitelist tab

Click on Add current IP address. MongoDB will automatically detect your current address, then click Confirm.

Add current IP address in MongoDB Atlas

MongoDB Atlas will take a few minutes to deploy the changes, after which you should be good to go.

MongoDB Atlas deploying changes

This IP address should be the same that appears when you search for it manually, using tools like whatsmyip.org.

Whitelist multiple or additional IP addresses

To whitelist multiple IP addresses, go to your target cluster on MongoDB Atlas.

Next, go to Network Access under the Security tab. On the IP Whitelist tab, click on Add IP address.

The MongoDB Atlas IP whitelist tab

Type your IP address manually under Whitelist Entry, then click Confirm.

Whitelist multiple IP addresses on MongoDB Atlas

Whitelist a range of IP addresses

To whitelist a block of IP addresses, you may need to look up the IP ranges that your provider has allocated to you. With luck, these will already be in Classless Inter-Domain Routing (CIDR) form.

How IP range notation works

Each IP address must be unique on its network. There are currently two protocols in use for IP addresses: IPv4, the protocol which most systems support, and IPv6, a newer protocol which addresses the limitations of IPv4.

We often see the IPv4 format, which are 32-bit addresses that look like this:

192.168.1.1

Each segment separated by the periods is an 8-bit or a byte. Each byte can be an integer between 0 and 255.

Classless Inter-Domain Routing creates a range from an IP address followed by a slash (‘/’) character and then an integer.

Since an IPv4 address can have a maximum of 32 bits, adding 32 after the slash means that you’re allowing no changes to any of the 32 bits:

192.168.1.1/32

This means you’re only whitelisting this particular IP address.

If you’d like to allow 192.168.1.xxx, meaning any combination of 0 to 255 in the final 8-bit segment, then that would be represented as:

192.168.1.1/24

If you’d like to allow the range 192.168.xxx.xxx, meaning any combination of 0-255 in the last two 8-bit segments, then that would be represented as:

192.168.1.1/16

And so on.

All ranges correspond with a subnet mask, so it is easy to look up the value that this trailing integer should be, using the chart here:https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#IPv4_CIDR_blocks

In MongoDB, you can enter this range by going to Network Access under the Security tab. On the IP Whitelist tab, click on Add IP address.

Enter the range under Whitelist Entry, then click Confirm.

Whitelist a range of IP addresses

Please remember not to whitelist very wide ranges, for example including > 265 IP addresses, and to regularly delete whitelisted IP addresses that are not in use.

By whitelisting your provider’s range of IP addresses, this effectively also whitelists other users using this range. This is still, however, a more secure alternative to whitelisting 0.0.0.0 or allowing access from any IP address.


Other MongoDB Atlas-related articles:

  • Set up a Free Tier Cluster & Import Your First Collection
  • How to Connect to MongoDB Atlas
  • 5 Best MongoDB Atlas Tools of 2020
  • How MongoDB Atlas Pricing Works

How helpful was this article?
This article was hideous
This article was bad
This article was ok
This article was good
This article was great
Thank you for your feedback!

About The Author

Kathryn Vargas

When she's not writing about working with MongoDB, Kathryn spends her free time exploring Berlin's food scene, playing the drums, learning languages (current mission: German), and hiking.

Article navigation

Related articles

  • How to Connect to MongoDB Atlas
  • Detecting COVID-19 Trends Using MongoDB Atlas Data
  • 5 Best Tools for MongoDB Atlas in 2021
  • MongoDB Atlas Pricing & Tips to Help Manage Costs
  • MongoDB Atlas Tutorial: Set Up a Free Tier Cluster & Import Your First Collection

Studio 3T

MongoDB Enterprise Certified Technology PartnerSince 2014, 3T has been helping thousands of MongoDB developers and administrators with their everyday jobs by providing the finest MongoDB tools on the market. We guarantee the best compatibility with current and legacy releases of MongoDB, continue to deliver new features with every new software release, and provide high quality support.

Find us on FacebookFind us on TwitterFind us on YouTubeFind us on LinkedIn

Education

  • Free MongoDB Tutorials
  • Connect to MongoDB
  • Connect to MongoDB Atlas
  • Import Data to MongoDB
  • Export MongoDB Data
  • Build Aggregation Queries
  • Query MongoDB with SQL
  • Migrate from SQL to MongoDB

Resources

  • Feedback and Support
  • Sales Support
  • Knowledge Base
  • FAQ
  • Reports
  • White Papers
  • Testimonials
  • Discounts

Company

  • About Us
  • Blog
  • Careers
  • Legal
  • Press
  • Privacy Policy
  • EULA

© 2023 3T Software Labs Ltd. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum

We value your privacy

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data.

By clicking “Accept all”, you consent to the storage of cookies and the processing of personal data for these purposes, including any transfers to third countries. By clicking on “Decline all”, you do not give your consent and we will only store cookies that are necessary for our website. You can customize the cookies we store on your device or change your selection at any time - thus also revoking your consent with effect for the future - under “Manage Cookies”, or “Cookie Settings” at the bottom of the page. You can find further information in our Privacy Policy.
Accept all
Decline all
Manage cookies
✕

Privacy Preference Center

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data. Please choose for which purposes you wish to give us your consent and store your preferences by clicking on “Accept selected”. You can find further information in our Privacy Policy.

Accept all cookies

Manage consent preferences

Essential cookies are strictly necessary to provide an online service such as our website or a service on our website which you have requested. The website or service will not work without them.

Performance cookies allow us to collect information such as number of visits and sources of traffic. This information is used in aggregate form to help us understand how our websites are being used, allowing us to improve both our website’s performance and your experience.

Google Analytics

Google Ads

Bing Ads

Facebook

LinkedIn

Quora

Hotjar

Functional cookies collect information about your preferences and choices and make using the website a lot easier and more relevant. Without these cookies, some of the site functionality may not work as intended.

HubSpot

Social media cookies are cookies used to share user behaviour information with a third-party social media platform. They may consequently effect how social media sites present you with information in the future.

Accept selected