Access NR using Hostname

I have multiple RPI 4 collecting and controlling different things. I want to access NR with hostname because of dynamic IP. I don't have any control over the router and IP selection so I want to know if there is any other solution.

not strictly a node-red question but...

  • You could set a static IP on the RPi
  • You could do a reservation in your router so it always gets the same address

I am unable to set static-ip since I want to ping PLCs and I cannot access router settings. I tried setting static-ip, but then I was not able to ping other devices

http://hostname:1880

That doesnt really make sense?!

If DHCP gives you 192.168.1.2 & you can ping your PLC, then set that as the static address.

I tried exactly as you said multiple times before, but it doesn't work. Also, the VNC cloud server also stops working.

This only works within the PI browser

I'm not sure we have the full picture here. Are you trying to access the device(s) over the Internet? Also, where does the VNC server come into this?

One way or another, if your network device doesn't have a fixed IP address on the LAN, you will struggle to connect to it locally or remotely.

If your Internet connection doesn't have a fixed IP, then again, you are going to struggle to connect to anything on your local network. However Dynamic IP services exist for that part - they still need a local service to publish the IP address to a DNS server though. Your router can do that but if, as you say, you don't have access to that, then you could run a service on a device inside your LAN.

But if the device doesn't have a fixed IP and you can't give it one then you are stuffed.

This may depend on your router. I can set up the NAT on mine to use hostname, rather than IP, and then connect using no-ip.com.

@dpatel2016 - would this be a possible solution for you, i.e. set up a local mapping on your router then use a dynamic DNS service to connect remotely?

The solution I am looking for is something I can change within pi because any changes on the router side are not accessible for me.

You can still fix the local LAN IP address on the Pi. You only need to make sure you choose an address that the router won't give out.

But you still haven't clarified whether you are trying to access this from the Internet or only from the local LAN?

You can certainly run something that will update a dynamic DNS service from the Pi - assuming the router/firewall allows it - it might not if it is an enterprise setup - again, you've only given us a small part of what is going on so we really can't give you a proper answer.

Hi,

If you are on a local network then setting the hostname on the pi should allow you to then access the pi with ping hostname.local

if mdns is running on the pi (and i think it does by default) you may be able to access the pi through newhostname.local

be ware mdns is not a silver bullet and it may/maynot work for you

I am only accessing Node-red from Local LAN. The network is setup for enterprise. I tried avahi on pi, but it did not do anything unless what I did was incorrect

If you have more than one Pi and they haven't had their hostname changed then there will be a conflict. You'll need to change the hostnames. Then reboot. Once the hostnames have been corrected then you can ping newhostname.local

Right, well now that we finally know that it is only the LAN you are worried about, there are more options.

For example, are you able to change the settings on your laptop/desktop? If so, you can simply edit the HOSTS file and give names to the Pi IP addresses.

We've already said that IP addresses on the Pi's can be fixed locally - you just need an address on the same subnet that your local DHCP server doesn't serve up. Make the change in the Pi's network configuration and reboot the Pi.

A more extreme change would be to run a DNS service on one of the Pi's or another device and point your PC to that instead of your normal DNS. This is not a trivial configuration though if you don't want to break other things.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.