-1

I've been trying to configure Node-RED running locally at http://localhost:1880 to run on a static IP address that I would configured via my router's "DHCP Static IP Configuration" so that Node-RED could be accessible within the entire LAN.

How would I go about changing the IP address that Node-RED is hosted on, cause I haven't seemed to find any resources for it.

Would love to know the exact approach of running Node-RED on a LAN via a router; like should the static IP address be assigned to a particular device with a specific MAC address or can Node-RED reside on the router itself.

1 Answers1

0

By default Node-RED binds to 0.0.0.0 which is the shortcut to say bind to all available interfaces (the log says to access via http://localhost:1880 because this will always be available). You should find that if you know the IP address of the machine running Node-RED and you enter http://ip-address:1880 from another machine on your LAN it should connect to the Node-RED editor.

You can change this bind address in the settings.js file (found in the userDir which is logged early on when Node-RED starts and is by default in ~/.node-red on a Linux/Unix machine). You can uncomment the uiHost line and change the IP address to what ever the static IP address of your host machine is. Under 99.9% of circumstances you should not do this and just leave it as the default 0.0.0.0

As for how you set your device that is hosting Node-RED to have a fixed IP address, that will be entirely dependent on the type of router you have, but usual approach would be to set the routers built in DHCP server to just asign a static IP address to that device as identified by it's MAC address. This means that you do not need to change anything on the device.

It is unlikely you will be able (or want) to to run Node-RED actually on your router, most home (or enterprise) routers are specialist devices and running a programming environment like Node-RED on them is really not a good idea from a security point of view unless you 110% know what you are doing.

Speaking of security, make sure you enable adminAuth in your settings.js before setting up any port forwarding on the router to expose Node-RED to the outside world. An unsecured Node-RED editor is likely to be quickly scanned by something like Shodan and promptly ushttps://nodered.org/docs/user-guide/runtime/securing-node-reded to host Crypto mining or much worse. Read the following carefully https://nodered.org/docs/user-guide/runtime/securing-node-red

hardillb
  • 54,545
  • 11
  • 67
  • 105
  • Hey thanks alot! I did manage to access the editor via http://ip-address:1880 through a different device on the LAN! Was wondering if it would be a good approach to for example have a Raspberry Pi running Node-RED locally so it would be accessible over the network, or would there be any alternative means; ideal for production. – Savindu Liyanage Jan 05 '22 at 06:59
  • Also I would ideally want the Node-RED dashboard I've built to be accessible over the internet. IBM Cloudinary, DigitalOcean and most other platforms requires you to enter a credit card to register or create a Node-Red instance. And since its for work I'm unable to add mine and the managers seem skeptical on getting a credit card for work any time soon. Any suggestions for free alternatives? Either hosting services or alternative approaches maybe. Would it be possible to run Node-RED locally on like a Raspberry Pi and access it over the internet, via a static IP address. – Savindu Liyanage Jan 05 '22 at 07:17
  • None of those questions are suitable for Stack Overflow – hardillb Jan 05 '22 at 07:52