DevToolsmith

Port 8883: MQTT over TLS

Port 8883 (TCP) is the port for MQTT secured with TLS. It is a registered port (1024–49151), so any user can listen on it.

Service
MQTT over TLS
Protocol
TCP
Range
Registered (1024–49151)
Official
IANA-registered
Exposure
Meant to be public
Category
Messaging and queues

What uses port 8883

MQTT clients connecting over untrusted networks should use 8883, where the broker presents a TLS certificate and can require client certificates. AWS IoT Core, Azure IoT Hub and HiveMQ Cloud all use 8883 for device connections.

Should port 8883 be open to the internet?

Meant to be public. This port is meant to be reachable by clients on the internet when you run this service publicly.

Check what is listening on port 8883

Linux
sudo ss -ltnp 'sport = :8883'
macOS
sudo lsof -nP -iTCP:8883 -sTCP:LISTEN
Windows (PowerShell)
Get-NetTCPConnection -LocalPort 8883 -State Listen
netstat -ano | findstr :8883

No output means nothing is listening. If a service should be, check that it is running and which address it binds to: 127.0.0.1 only accepts local connections, 0.0.0.0 or :: accepts them on every interface.

Fix “address already in use” on port 8883

Another process already holds the port. Find it with the commands above, then stop that service properly, or end the process:

macOS / Linux
sudo kill $(sudo lsof -t -iTCP:8883 -sTCP:LISTEN)
Windows (PowerShell)
Stop-Process -Id (Get-NetTCPConnection -LocalPort 8883 -State Listen).OwningProcess

Open port 8883 in the firewall

Ubuntu / Debian (ufw)
sudo ufw allow 8883/tcp
# Close it again:
sudo ufw delete allow 8883/tcp
RHEL / Fedora / Rocky (firewalld)
sudo firewall-cmd --permanent --add-port=8883/tcp
sudo firewall-cmd --reload
Windows (PowerShell, as administrator)
New-NetFirewallRule -DisplayName "MQTT over TLS 8883/TCP" -Direction Inbound -Protocol TCP -LocalPort 8883 -Action Allow

On AWS, Google Cloud and Azure, also allow the port in the security group or network firewall rules; host firewalls and cloud firewalls are separate.

Port 8883 with Docker

Docker
docker run -d -p 8883:8883 eclipse-mosquitto

The format is -p host_port:container_port. Containers on the same Docker network reach each other on the container port directly, without publishing it. Convert a long docker run command into a Compose file with docker run to compose.

Test port 8883 from another machine

macOS / Linux
nc -zv example.com 8883
Windows (PowerShell)
Test-NetConnection example.com -Port 8883

Related ports

  • Port 1883 (MQTT): the default port for MQTT, the publish/subscribe protocol for IoT.
  • Port 443 (HTTPS): the default port for HTTPS, encrypted web traffic.

More messaging and queues ports

4222 (NATS) , 4369 (Erlang Port Mapper (epmd)) , 5060 (SIP) , 5222 (XMPP client) , 5672 (AMQP (RabbitMQ)) , 9092 (Apache Kafka) , 15672 (RabbitMQ management) . See all ports in the port lookup.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is port 8883 used for?

Port 8883 is the port for MQTT secured with TLS. MQTT clients connecting over untrusted networks should use 8883, where the broker presents a TLS certificate and can require client certificates. AWS IoT Core, Azure IoT Hub and HiveMQ Cloud all use 8883 for device connections.

Is it safe to open port 8883?

This port is meant to be reachable by clients on the internet when you run this service publicly. Keep the service behind it up to date and require authentication where it applies.

How do I check if port 8883 is open?

On the server, list listening sockets with "sudo ss -ltnp 'sport = :8883'" on Linux or "sudo lsof -nP -i :8883" on macOS. From another machine, run "nc -zv host 8883" or, on Windows, "Test-NetConnection host -Port 8883". Connection refused means nothing is listening; a timeout means a firewall is dropping the traffic.