I'm trying to run a modbus server with an IP address that is not used by Node-Red but it keeps crashing and putting me this error. And this is valid for a large number of IP address. The problem is that I need to use this specific IP (that I can't share with you for security reasons ).
Firstly, a node should never crash node-red - so regardless of what you are doing to make it happen, you should raise this as an issue on the repository (in fact it may already be a raised issue)
For the short term, I would check that the IP is visible from within the node-red (for example, if you are running in docker, then it probably wont be or will be a different IP). Basically, as you are creating a modbus server, the IP and PORT it binds to must be available to the OS (be that a docker guest or a OS on the metal) where node-red is executing. That includes firewalls.
A modbus server serves (responds) to a client. For it to do that, it must bind to an existing IP - therefore this IP must be set and accessible from where node-red runs. You cannot simply invent an IP address - the OS where node-red is running needs to "LISTEN" on a specified port number on an actual/virtual Ethernet port
Question - why are you even creating a Modbus server? Do you have master/client devices out in the field that need to initiate a connection to your node-red server instance?
If you are simply trying to connect to modbus devices in the field, they are likely servers/slaves themselves and you simply need to setup a master/client to read from the devices.
In short, a master/client gives orders, the slave/server acts and responds
So here are the step if you want to have RPI as a modbus SERVER:
Run Node-Red on root ( the command line is : sudo node-red )
drop the modbus server on the flow
go on the terminal and type ifconfig
you will see the ip address of the RPI on the eth0 ( inet XXX.XXX.XXX.XXX ) and the port where it listens to ( mtu X ) note that down and keep it
go back to node-red and put in the modbus server, the IP address and the port you wrote down on step 5 and deploy the flow
Node-Red shouldn't crash and you will be able to access this modbus server from another RPI or other modbus client
PS: The IP address in the modbus server needs to be the same as the one of the RPI, other wise the clients won't be able to access it. So if you want to change the IP address of the modbus server in Node-red, you must first change the ip address of the RPI