Report this

What is the reason for this report?

How do I get my droplet to listen to port 4000 and port 27017

Posted on June 28, 2022

So my company has a webserver on port 4000 (Cloudflare) and mongodb on port 27017. I tried to do ufw allow 27017/tcp, or ufw allow 27017, ufw allow 4000, ufw allow 4000/tcp. However when I’ve done an nmap scan the ports are still closed for some reason. Why is this? What am I missing? I’ve tried to enable nginx and apache but we already have a webserver on cloudflare, so isn’t it mood point?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello there,

What is your problem? Your droplet has this ports open but you can’t to connect to them?

From your Droplet

Check out your open ports

  1. netstat -putan

Check out the current status of your firewall

  1. sudo ufw status verbose

From outside your Droplet

Check out your open ports

  1. nmap your_droplet_ip

If you need to check a specific port

  1. nmap -p 4000 your_droplet_ip

Hope this helps,

Sergio Turpín

Hi there,

In order for you to be able to access those services externally, besides allowing the ports via your firewall, you need to make sure that they bind on 0.0.0.0 rather than 127.0.0.1.

For example, with MongoDB you can do that by following the steps here:

https://www.digitalocean.com/community/tutorials/how-to-configure-remote-access-for-mongodb-on-ubuntu-20-04

For the service that is listening on 4000, can you confirm what type of service is it?

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.