Many gateways on one network

Hi everyone. I would really appreciate it if anyone know if we can have more than one gateways in the same local network. At the moment if i put a second gw, there doesnt seem to be a way to change the default port 1880 to something else. I need the gateways to have different ports since i m sending commands to them. Any ideas anyone would be extremely appreciated.
Thanks,
Sotiris

Hi

If you edit the settings.js file you will see the line

uiPort: process.env.PORT || 1880,

change the port number and then save the file. You will need to restart Node Red

Hi @mtoko and thank you for the reply. I ll give it a try.

What do you mean by a 'gateway'. If they are separate devices they will have different IP addresses so they can all use the port 1880 without problems.

Hi Colin,
by gateway i m referring to the device that hosts node red. I think you are right that since each device has a different ip i don't really need to create a separate port forward. How didn't i think of this?? Thank you!

Hi Colin,
The problem with this approach is that i need to access the gateway from the outside, that is from the internet so your solution on second thought doesn't work.

Sounds like you have multiple Node-Red systems (why?), then look at a reverse proxy like NGINX if you want to connect to them from the Internet. Also look at the guide here for securing Node-Red for Internet use.

You need to think very carefully about the security implications of opening node-red to the internet, however if you do open ports the router will allow you to specify a different external port to an internal one, so you could route port 2880 to port 1880 of device 1, port 3880 to port 1880 of device 2, etc.

  • You mentioned you send commands to Node.RED. It would be interesting to know what protocol you use and for what purpose? Perhaps MQTT data? Admin HTTP to Node-RED? TCP connections?

  • The answers in the forum (this post many others), as well as the documentation, shows that changing the port number for Node-RED is quite easy but then you hit another issue: you would need to do some port forwarding in your router. Is this a big issue or perhaps there is some constraint that prevents you from doing so?

If the solution: change Node-RED + configure port forward in the router is the issue then you may want to have a look on ngrok. It comes with pros and const as usual for everything.

You don't even need to do that. Simply pass the PORT environment variable as you start Node-RED.

Only if you need to access the systems from outside the router.

There is also another option if you do need to do this. Put your microserver instances (multiple Node-RED instances in this case) behind a reverse proxy. NGINX or HAproxy for example.

In doing so, you get a number of benefits. You can get better performance, better security and you can rewrite the different ports to a single, standard port with different paths.

If he doesn't need to access them outside the router then he doesn't need to change the ports, as they will have different IP addresses.

You are correct of course. I was thinking about multiple instances on a single device.