Port 27017 — MongoDB (TCP)
What is Port 27017?
Port lalai untuk pangkalan data NoSQL MongoDB.
This is a registered port (1024–49151) often assigned to vendor or application services like MongoDB. · No formal RFC; MongoDB Wire Protocol
When do you need Port 27017 open?
Almost never open to the internet. MongoDB should be bound to localhost or a private network interface. If a remote application must connect, use a VPN or SSH tunnel rather than exposing this port publicly.
Common uses and software
- MongoDB Community Server
- MongoDB Atlas (via VPN/private peering)
- Mongoose (Node.js ODM)
- Studio 3T
- Compass (official GUI)
Security
Enable authentication immediately (security.authorization: enabled in mongod.conf). Set bindIp: 127.0.0.1 to prevent listening on external interfaces. Never expose port 27017 to the internet — exposed MongoDB instances have been a source of mass data breaches and ransomware. Use TLS for any remote connection (net.tls.mode: requireTLS). For remote access, use an SSH tunnel or VPN.
Is Port 27017 safe?
An open port increases your attack surface. Safety depends on how MongoDB is configured.
Low risk, but confirm that MongoDB on this port is intentionally running and required by your application before leaving it open.
Test connectivity for Port 27017 on any host.
How to Open Port 27017
To allow incoming connections to Port 27017 (MongoDB) from outside your network, configure your firewall and add a port forwarding rule on your router pointing to your device's local IP address.
Open Windows Defender Firewall → Advanced Settings → Inbound Rules → New Rule → Port → TCP → Specific local ports: 27017 → Allow the connection → Name and save the rule.
netsh advfirewall firewall add rule name="Open Port 27017" dir=in action=allow protocol=tcp localport=27017sudo ufw allow 27017/tcpsudo iptables -A INPUT -p tcp --dport 27017 -j ACCEPTLog into your router (192.168.1.1 or 192.168.0.1) → Port Forwarding → Add a new rule: Protocol TCP, External port 27017, Internal IP: your device's local IP, Internal port 27017 → Save.
How to close Port 27017
If you do not need MongoDB, block this port in your firewall or router.
To block port 27017 on Windows, run the following command in PowerShell or Command Prompt (as Administrator):
netsh advfirewall firewall add rule name="Block Port 27017" dir=in action=block protocol=tcp localport=27017sudo ufw deny 27017/tcpsudo iptables -A INPUT -p tcp --dport 27017 -j DROPRemove or disable any port forwarding rule for Port 27017.
Frequently Asked Questions
What is Port 27017 used for?▾
Port 27017 is the default TCP port for MongoDB. It is used by servers and applications that need to accept incoming connections for this service. Whether you need it open depends on whether you are actively running a MongoDB server — if not, it should remain closed to reduce your attack surface.
Is Port 27017 safe to keep open?▾
An open Port 27017 increases your attack surface. If you are not actively running MongoDB, close this port in your firewall and remove any port forwarding rules. If MongoDB must be accessible, restrict access to known IP ranges, keep the service software updated with security patches, and use strong authentication.