# Problem with checking the connection to TCP/IP devices

**URL:** <https://forum.inductiveautomation.com/t/problem-with-checking-the-connection-to-tcp-ip-devices/83605>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [December 29, 2023, 3:07pm UTC](https://forum.inductiveautomation.com/t/problem-with-checking-the-connection-to-tcp-ip-devices/83605 "2023-12-29T15:07:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michal\_Goralczyk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michal_goralczyk/32/55564_2.png) [@Michal\_Goralczyk](https://forum.inductiveautomation.com/u/Michal_Goralczyk)\
**Post date:** [December 29, 2023, 3:07pm UTC](https://forum.inductiveautomation.com/t/problem-with-checking-the-connection-to-tcp-ip-devices/83605/1 "2023-12-29T15:07:37Z")

</div>

I use this code.

```auto
	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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 29, 2023, 3:15pm UTC](https://forum.inductiveautomation.com/t/problem-with-checking-the-connection-to-tcp-ip-devices/83605/2 "2023-12-29T15:15:43Z")

</div>

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:

> [@Script to ping computer](https://forum.inductiveautomation.com/t/script-to-ping-computer/16612/19):
>
> Here is a lengthy recap of the steps that lead to success in using java.net (InetAddress, isReachable) on a Linux server (Ubuntu 20.04.5 LTS) with Ignition running as a non-root system user account. Ran this command... sudo systemctl edit Ignition-Gateway.service Added this text... then saved changes. [Service] AmbientCapabilities=CAP\_NET\_RAW CAP\_NET\_BIND\_SERVICE Restarted the Ignition gateway... sudo /usr/local/bin/ignition/gwcmd.sh -r Confirmed the service was running without err…

{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:

> [@Docker image now defaults to non-root user](https://forum.inductiveautomation.com/t/docker-image-now-defaults-to-non-root-user/69784/5):
>
> I should clarify that the Docker image launches that gateway directly, no systemd involved (as is typical in most container images). The capabilities that a container gets when launched is controlled by the container runtime--see some info [here](https://docs.docker.com/engine/security/#linux-kernel-capabilities). There isn't a way to "request" default capabilities within the OCI image definition that I'm aware of.

---

<div class="post-metadata">

**Author:** ![Michal\_Goralczyk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michal_goralczyk/32/55564_2.png) [@Michal\_Goralczyk](https://forum.inductiveautomation.com/u/Michal_Goralczyk)\
**Post date:** [December 29, 2023, 4:21pm UTC](https://forum.inductiveautomation.com/t/problem-with-checking-the-connection-to-tcp-ip-devices/83605/3 "2023-12-29T16:21:33Z")

</div>

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