How do I change the IP address that Node-RED is hosted on? - iot

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.

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

Related

Azeroth-Core/Docker - LAN Setup

I am looking to setup AzerothCore for LAN only use.
I am using an ESXi install with an Ubuntu 20.4.3 instance with latest Docker and Portainer for management. I am able to walk through the install process and it works great.
I switched the realmlist in the database to the LAN IP via HeidiSQL, setting both address and localaddress to LAN IP. I have tried just address and localaddress, leaving the other at 127.0.0.1.
I am using a fresh client install and set realmlist there too. I have tried both the dns and the IP, currently set to LAN IP.
I have not touched the compose file or modified authserver or worldserver config files. I am not certain where to look or what to change.
I am able to login with the ID I created all the way to see the Realm, which I select and hit enter. After a short pause the client screen returns to the realm selection screen. Not knowing the backend, I am not sure what is missing now.

What is the correct way to do Port Forwarding using VMWare

I have created a VM which has a server running at localhost:8675/ which I had wanted to connect to my host machine at the same port for ease of understanding. I was following these to documents for information:
https://www.virtualbox.org/manual/ch06.html
http://www.howtogeek.com/122641/how-to-forward-ports-to-a-virtual-machine-and-use-it-as-a-server/
When I was in my VMWare Workstation, I clicked on my VM, then did: Edit > Virtual Network Editor. After that, enabled Change Settings which relaunched the window in admin mode. I clicked on the Row with Type NAT and external Connection NAT and in the VMNet Information with the NAT radio button pressed, I clicked the NAT Settings Button.
I said: Add... and then did:
Host: 8675
Type: TCP
VMIP: 127.0.0.1:8675
Description: Port Foward of 8675 from Host to VM.
It looks like everything is good. I say Ok and Apply in succession. It looked like it shut down nat and restarted some services.
I confirmed in the VM, the 127.0.0.1:8675 is correct.
In the HOST, I tried to go to: http://localhost:8675/ and it says: ERR_CONNECTION_REFUSED
I figured this was all I needed to do.
I was looking up some additional information and noticed that some people have had to configure firewalls. I wasnt sure if i needed to though, as I was thinking that the HOST and VM are all in 1 actual machine, it might be entirely self contained.
Is there a critical task I am missing?
I saw this post: https://superuser.com/questions/571196/port-forwarding-to-a-vmware-workstation-virtual-machine
which told me to just adjust it to bridged and use it that way. Does this solve the issue of connecting HOST / VM Issue.
I don't want to say this is the correct answer though as the question itself is particular to NAT, but this is a valid alternative answer that does work.
This is solves the base issue at hand, but not the question.
When you use NAT, the host system and the guest boxes have completely different IP addresses on their virtual subnet, so my guess is that when from the host system you try to connect to localhost:8675 you are actually trying to connect to port 8675 of the host and not of the guest. So don't use the localhost or 127.0.0.1 syntax, but discover the real IP address of the guest and use it.
If your guest is Windows use the ipconfig command, if Linux use ifconfig.
Probably you will also have to configure the firewall on the guest side.
EDIT:
Commenting the sentence "NAT: Used to share the host's IP address.": it probably refers to the IP address of the real ethernet adapter you have on your host and that is shared by host and guests to access the internet. That's not related to the way your host and guests communicate together. For example I use VMware Workstation to run a virtual Linux box in Windows. Selecting NAT, VMware creates a virtual subnet called VMnet8. In this subnet the virtual router has address 192.168.120.0, my Windows host is assigned a virtual ethernet adapter with address 192.168.120.1 and my Linux guest has got address 192.168.120.128. So when I want to access a Samba shared folder from Windows I type "net use * \192.168.120.128" in a Windows command prompt. When I want to access a Windows shared folder from Linux I type "sudo mount.cifs //192.168.120.1/path_to_shared_folder target_folder".
I believe you actually answered your question correctly as I was following it and achieved desired outcome.
IMHO, the error: ERR_CONNECTION_REFUSED indicates that a firewall on your host OS or guest OS (your VM) or on both doesn't allow the communication through the given ports.
The easiest thing would be to try to disable firewalls on boths, your HOST and GUEST OS.
Not sure what are your OSes, but here is just a good guide for setting up firewall rules on Ubuntu

How do you host a Ruby on Rails application on a local network, so multiple people can access it?

I'm brand new to RoR and have pretty much 0 experience with it. I have been handed down somebody else's project and I need to find a way to host the application, so people can just access it locally. The application is a spider script/walker script/web scraper whatever you call it. Basically it connects to a website, logs in, retrieves certain data each day and maps it with the previous data. While on the local machine, you use it, go to localhost:3000, and you get the webpage the previous person designed. I was just wondering how I could get that page to be public for the people on our local network, so they could connect to some arbitrary IP and see the same page (it updates daily)?
What I tried doing is making the folder containing the application public to the network, but in order to use it, I would have to make everybody on the network allowed to write to it and each person would have to install RoR to use it. I want to avoid that since it doesn't seem logical, nor is it what I'm trying to do.
Looking at the code, I can reverse engineer and understand what it does, but when it comes to hosting web apps locally or something of that sort, I have never done this before. Please help!
Thanks in advance!
**EDIT
-This is all being done on a Windows 7 machine.
Since you're on Windows, open up a command line and run ipconfig to find out your local IP. It will be listed under 'IP Address'.
Tell people in your LAN to access http://192.168.x.x:3000 replacing 192.168.x.x by your IP address from step 1.
EDIT: One major thing that I missed, you are windows. On windows u could use thin and put it behind a load balancer. Although i would suggest hosting it on a UNIX machine :)
Although Running it in webrick(webrick is the application server for development i.e when u run rails s) will let other users access the website NEVER do the same for a production application. If you want to run this application in production, u need more powerful application servers like passenger. I would suggest you use it with Apache or Nginx instead of stand alone passenger. Once all this is setup others can use your application by entering the IP(xx.xx.xx.xx) also u can ask your system admin to setup a local DNS so your users need not remember the IP address always.
Description:
While starting Rails Server, we can also setup some options to configure the IP address and also the port number of the site under development environment to host the website in local network. So if we want to change the IP from http://127.0.0.1:3000 to http://192.168.x.x:port (x= 0 to 255 any one number), we can set that in Rails server command! But for this, we will need to find out our current IP address at our current network which will help us to serve the website in local network.
So at first step:
We will open our terminal on our PC. For Android user, we need to open Termux app. Then simply type ifconfig to get the IP address of our device in the current network. We will get an output like this one (Here I'm using Android device for development. So output might be something different than this one on your PC terminal but the process is same):
$ ifconfig
Warning: cannot open /proc/net/dev (Permission denied). Limited output.
lo: flags=XX<UP,LOOPBACK,RUNNING> mtu XXXXX
inet 127.0.0.1 netmask 255.XXX.XXX.XXX
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen XXXX (UNSPEC)
wlan0: flags=XXXX<UP,BROADCAST,RUNNING,MULTICAST> mtu XXXX
inet 192.168.1.103 netmask 255.XXX.XXX.XXX broadcast 192.168.1.255
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen XXXX (UNSPEC)
X= some numbers with our device credentials which is dummied with this variable
If you are using a WiFi router then we will need the wlan0 part to get our device IP. Under wlan0 section there is a subsection of inet showing our current IP! YUP, we need that IP address 192.168.1.103! This might be different for your device and network. This is the key of this mission! Now we're going to the second important step.
So the Second Step is:
That required input command to configure the IP address.
rails s -b 192.168.1.103 -p 8080
Here:
rails s for rails server
-b 192.168.1.103 for bidding the IP address for customisation from the default IP http://127.0.0.1 which is our localhost address.
-p 8080 for port setup. This part is optional. Default port is 3000.
This is the process of changing the localhost IP (http://127.0.0.1) to local network IP which will be available for other device of the same network user.
Now our rails app is available in our local network! Other users in the same network will also be able to visit the website while the server command is running. And the link will be http://192.168.1.103:8080 if you also configure the port number. Otherwise if you have used the command rails s -b 192.168.1.103 without port configuration the link will be: http://192.168.1.103:3000
Again: 192.168.1.103 was for my case, your IP address will be different for your device. That will be needed to use for your server and link address.

Turn my local app public

When I up some app on my machine at localhost:3000/somecontroller. Is possible to turn public to world if I try mymachineip:3000/somecontroller ? Sorry if is a dumb question...
Rails apps default to listen on 0.0.0.0:3000, which really just means "listen on all interfaces, on port 3000". So yes, you should be able to access it from another machine via its IP address. (If you run a firewall or anything on your machine, though, you may need to open up the port).
You have to configure the firewall to allow access to your machine. Your router has a public IP. You can figure the public IP out, if you go to http://whatismyipaddress.com/, or so similar site.
Then you can configure your firewall to allow access to your machine. Open your router settings, and open a port to your local machine IP.
http://www.wikihow.com/Set-up-Port-Forwarding-on-a-Router
It's also a good idea to give the machine a static IP, bc the IP can change when the machine restarts.

Virtualbox access webservices on guest via a url

im running windows 7 as host and ubuntu 11.04 as guest.
Which would be the best way to access a webserver on a guest from host via a defined url
(and vise versa)
e.g http://myvirtualbox and http://myhost
For now i have configured a network bridge, but the guest is gets a different ip assigned everytime. A simple solution would be to assign a staic ip and configure a name resolution localy on each machine, but maybe there is an other way (internal netwok perhaps?)
You can modify the hosts file on machines to map the hostname to the IP addresses of the machines (and change their IP addresses to static).
Or another more flexible (more hosts, faster integration for new machines) option: you're going to want to set up a DNS service, configure the machines to work with it, then add the IP of the DNS as a name server in your network adapter for the hosts to use.
That will be a more flexible, maintainable and scalable solution.
From the looks of it though, if you want a 10 minute fix, go for the first option. There are lots of tutorials on it.

Resources