Configuring ethernet ip settings using dashboard ui

Hi all

I am desperately looking for a way to set my ethernet settings using the standard node red dashboard ui.

If i log into dashboard ui i would love to be able to set ethernet static ip addresses and gateways . I have found stuff for wifi but not ethernet . this is the one piece i need to complete my project. so far i have not found any thing the pi cant do and im sure i cant be the first person attempting to do this .

Secondly it would be awesome if i could modify modbus tcip nodes to also have a variable ip adress. this way i dont have to individually code every device that goes out. i know there have been lots of topics on this one.

the older versions of pi os we could simply change credentials using Raspi-config this was easy!!

Any pointers would be great .

kind regards
pat

running a pi 3b currently

Static IP and gateway are setup in /etc/dhcpcd.conf for both ethernet and wifi.

Hi colin i guess i would have to write a function node in order to to change or overwrite the dhcpcd file ?

i am trying to find a way that this could be done by any one by simply using a gui interface . Ie for the end user we cant have them editing files we all know how fast this can go wrong if they dont know what they are doing,

need to make this fool proof

The problem is that the file is owned by root and so is not adjustable by normal users without using sudo. So you will have to work out how to get round that.

Are you sure you want to allow the node red user to mess with the ip address and potentially break their system, and others on the network? That can happen if they use an address which another device on the network already has.

hmm so letting the user change the ip address to something that is then no longer on the network and boom - the device is no longer reachable... = not very fool proof... as fools are so darn ingenious.

1 Like

Let's assume your are able to access and overwrite the dhchp.conf file

First store the ip data in a flow variable via dashboard.

Make sure to:

  1. Make a popup displaying the information the user set and ask him to reconfirm.
  2. Do checks on the IP. For example make sure it is on the same subnet, otherwise you will loose it.

Now use file in node to load the file

Set to 1 msg per line.

Make a function node with some if functions like the one below. Do it for every line you want to change

var newIP = flow.get("ipsetbyuser");
var test1 = msg.payload.substr(0,13);
If (test == "#static ip_ad"){
msg.payload = "static ip_address=" + newIP;
return msg}

Write all lines to a temporary file all lines will be backwards (first line will be last)

Then use the 'file out' node to delete te old dhcphp file

Then read the temporary file line by line and write (append) it to /etc/dhcpcd.conf

In theory it might work. It is a hell of a workaround, and it it could go wrong in many steps :grimacing:

WiFiManageFlow.json (14.1 KB)

Here's a flow that I borrowed from someone that helps. I don't recall the post where this was shared with me, so I'm unable to credit the original author. I only made a few adjustments to it.

thanks colin

i am trying every ones suggestions one by one will revert if i win or fail

Agreed this is nasty stuff . if i can get i right "with some help" i might be able to make my first contrib. sounds exciting!! Stupid question but node red has 1000s of nodes for everything but this is a completly undiscussed topic. why?? if we allow access to debian front page then any one can copy our ip or sd card . a simple front end page by eternet or bt would make life easy for developers

This cant be that hard

Hi all

After many experiments the only way i found that really works and is user friendly, is to use remote desktop and to strip the standard pi desktop of all menus that are not necessary. however if the user knows what they are doing the can easily reinstate them can i prevent this and how ?? have been trying using different logon profiles but i can reinstate menus no matter what profile i setup.. I need to prevent copying of my card and ip . any suggestions?!?!?

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