TCPRegistered PortFirewall: Usually Closed
27017

MongoDB

What is Port 27017?

Port 27017 is the default port for MongoDB, one of the most popular NoSQL document databases. MongoDB stores data as flexible, JSON-like BSON documents, making it easy to map to objects in application code. Created by 10gen (now MongoDB Inc.) in 2007, MongoDB supports rich queries, secondary indexes, aggregation pipelines, transactions, and horizontal scaling through sharding. It's widely used for content management, real-time analytics, IoT data, mobile applications, and as a general-purpose database. MongoDB's flexibility and developer-friendly approach have made it the most popular NoSQL database. Cloud offerings include MongoDB Atlas, which provides fully managed clusters across AWS, Azure, and GCP.

Common Uses

  • Application database for web and mobile apps
  • Content management and e-commerce data
  • Real-time analytics and operational data
  • IoT data storage and time-series logging

Technical Details

Port Number27017
ProtocolTCP
CategoryRegistered
Service NameMongoDB
Default FirewallUsually Closed
Port Test Commands

Copy-paste commands to check port 27017 (MongoDB) from your terminal

Test connectivity

Netcat (nc)Check if TCP port is reachable
nc -zv example.com 27017
curl (HTTP)Test HTTP response on this port
curl -v --max-time 5 http://example.com:27017/
TelnetBasic TCP port connectivity check
telnet example.com 27017
nmapScan port 27017 with service detection
nmap -p 27017 -sV example.com
Bash /dev/tcpPure bash TCP check (no extra tools needed)
(echo > /dev/tcp/example.com/27017) 2>/dev/null && echo "open" || echo "closed"

Open port in firewall

UFW (Ubuntu / Debian)
sudo ufw allow 27017/tcp
iptables
sudo iptables -A INPUT -p tcp --dport 27017 -j ACCEPT
firewalld (RHEL / CentOS)
sudo firewall-cmd --permanent --add-port=27017/tcp && sudo firewall-cmd --reload

Security Considerations

!

MongoDB has been involved in thousands of data breaches due to instances left exposed without authentication. ALWAYS enable authentication (--auth). Create strong admin credentials. Enable TLS/SSL for encrypted connections. Use IP whitelisting and VPC peering in cloud environments. Enable audit logging. Disable legacy MongoDB wire protocol versions. Never expose port 27017 to the internet without authentication.

Popular Ports Reference

The most commonly used and referenced network ports

Related Ports