Search code examples
routesdnsportmqttnat

Public dns:port Redirection


We are currently using a MQTT-Broker where devices are connected over a DNS name on Port 8883. We want to migrate to something like EMQX Cloud. However the standard deployment of EMQX does not support custom port numbers and gives us the port 15384 (The professional deployment isn't affordable for us at the moment). The problem is that there are a couple of devices out there we don't have access to and where we cannot change the connection url. So I'm searching for a simple Service

that redirects the traffic from "mqtts://hostname1:8883" to "mqtts://hostname2:15384".

By googling I only found NAT solution that route the traffic into a local VPC, but here I want this to be a routing from a public to an other public address with a certain port. It would be great if there is something like a simple dns service provider or something for this where I dont have to orchestrate my own Linux server.

Thanks, Lukas


Solution

  • This isn't possible, (Normal1) DNS only maps hostnames to IP addresses.

    The only way to do a port remapping is to use NAT.

    1 DNS SRV records can include port numbers but this requires the client to be already using SRV records to look up the MQTT broker for a given domain and then using the response to that to build a valid hostname/port name pair to then connect to. Unless all your devices are already using DNS SRV this will not help you.