127.0.0.1 is a virtual interface that is typically referenced as localhost and serves as loopback traffic. It's mainly used to diagnostic within the host itself since traffic can't go anywhere outside... listening (binding) to localhost would work across services if their traffic also originated from the same host.
If you want your service to listen on all interfaces, then you could listen on 0.0.0.0 instead.
In Linux, a good way of checking to see what services are listening to what ports is to use the following command lsof -i -P -n. In Windows, netstat -a.
π
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you tick the "bind to adapter" on the general tab of the modbus slave device, and you have selected 127.0.0.1 at the Ethernet adapter, it should only be available to the localhost.
to bind to all adapters (pre SP17 functionality), you should leave it unticked.
π
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All,
My question is fairly simple;
If I select 127.0.0.1 in RPi and bind port 502 to it,
will it automagically be available for ALL configured IP adresses on the RPi?
Eg: I bind to 127.0.0.1, in my example, port 502 will be exposed on 192.168.168.14 (eth0) AND 192.168.168.15 (wlan0)?
-> If I bind to 192.168.168.14 , in my example port 502 will be exposed on 192.168.168.14 (eth0) ONLY.
-> If I bind to 192.168.168.15 , in my example it will be exposed on 192.168.168.15 (wlan0) ONLY.
Is this assumption correct?
Many thanks.
Last edit: hermsen 2022-01-05
π @h-hermsen,
127.0.0.1 is a virtual interface that is typically referenced as localhost and serves as loopback traffic. It's mainly used to diagnostic within the host itself since traffic can't go anywhere outside... listening (binding) to localhost would work across services if their traffic also originated from the same host.
In Linux, a good way of checking to see what services are listening to what ports is to use the following command lsof -i -P -n. In Windows, netstat -a.
https://help.codesys.com/webapp/_mod_edt_slave_device_tcp;product=core_modbus_configuration_editor;version=3.5.17.0
If you tick the "bind to adapter" on the general tab of the modbus slave device, and you have selected 127.0.0.1 at the Ethernet adapter, it should only be available to the localhost.
to bind to all adapters (pre SP17 functionality), you should leave it unticked.
@i-campbell, @nothinrandom
Thank you all for the clear anwsers :-)
Last edit: hermsen 2022-01-05