Problem with checking the connection to TCP/IP devices

I use this code.

	from java.net import InetAddress
	
	host = '10.240.10.10'
	timeout = 1000
	ip = InetAddress.getByName(host)
	r =  ip.isReachable(timeout)
	return r

I have a problem with pinging some devices. I have 5 devices and they are all working and I manage to ping them with the ping command on the Linux server where the Ignition gateway is installed.

For some reason for some devices this script returns False even though the server has access to the devices. What could be the cause?

I have this hooked up to a wireless network and my local computer Windows with Ignition installed handles it without a problem while the gateway on the Linux production server is unable to read some devices.

Best regards,
Michał Góralczyk

Linux generally constrains non-internet-protocol packets to trusted users and trusted executables. The ping executable is one of them. For Ignition to be trusted with ICMP packets, you need to add to its privileges. The simplest solution is with a SystemD service override for AmbientCapabilities=CAP_NET_RAW. I recommend this:

{Note that CAP_NET_BIND_SERVICE is what allows a non-root process to use ports 80 and 443, if you are so inclined.}

If you are using Docker, the IA image doesn't use SystemD. See this topic:

1 Like

I will look into this, thank you for your involvement! Your contribution to this forum is significant.