node-red/node-red-nodes

node-red-node-ping always sends "false" in IPv4 Protocol setting

GnomiBerlin opened this issue · 9 comments

from nodered.org I was redirected to this github for node-red-node-ping ver0.3.3

Error:
when using NodeRed in timed mode and set it e.g. to 60 seconds, always a "false" is returned from the node if I use IP-v4 setting for the IP-address.
If I use automatic mode, all is working !

NodeRed: v4.0.2

Please fill out the template for new issues, it gathers the information we require to understand a problem.

Please supply the following:

  • What OS are you using (including versions)?
  • What version of NodeJS are you using
  • Can you provide a sample flow that shows the problem
  • Can you supply the Node-RED logs
  • Provide information about how the network is configured, e.g. is node-red running on a machine on the same subnet
  • Are you entering a hostname or an IP address

Are you pinging a .local address?

sorry, here are the details:
I'm using a local address: 192.168.x.x is entered into the NodeRed node

What OS are you using (including versions)? -- NodeRed runs in a lxc container with this OS - ping runs under OS level
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian

What version of NodeJS are you using
node -v
v20.15.1

Can you provide a sample flow that shows the problem
see also pictures below


[
    {
        "id": "6d5dafca7dc40cad",
        "type": "ping",
        "z": "59888a9e317a2ca9",
        "protocol": "IPv4",
        "mode": "timed",
        "name": "",
        "host": "192.168.170.1",
        "timer": "20",
        "inputs": 0,
        "x": 410,
        "y": 120,
        "wires": [
            [
                "7f368ae422525396"
            ]
        ]
    },
    {
        "id": "7f368ae422525396",
        "type": "debug",
        "z": "59888a9e317a2ca9",
        "name": "debug 11",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 600,
        "y": 120,
        "wires": []
    }
]

Can you supply the Node-RED logs
No

Provide information about how the network is configured, e.g. is node-red running on a machine on the same subnet

  • same home local subnet
  • in the command level on this machine , ping is working

Are you entering a hostname or an IP address
IP-address

configuration with IPv4:
Ping_Err3
error false:
Ping_Err1
only difference: IPv$ --> Automatic
Ping_Err2

In the lxc container (so with all the same constraints) can you run the following:

ping -n -4 -w 5 -c 1 192.168.170.1

The only difference between naming a specific protocol and Automatic mode is that the -4 is not included.

This should be the exact command that the node is spawning for your input. Can you share the output as well please as that gets parsed with a regex

yes, the -4 option is the problem.

ping -n -4 -w 5 -c 1 192.168.170.1
ping: invalid option -- '4'
Try 'ping --help' or 'ping --usage' for more information.

without -4
ping -n -w 5 -c 1 192.168.170.1
PING 192.168.170.1 (192.168.170.1): 56 data bytes
64 bytes from 192.168.170.1: icmp_seq=0 ttl=63 time=14.948 ms
--- 192.168.170.1 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 14.948/14.948/14.948/0.000 ms

So far I never had any problems in lxc containers on a Raspberry. Lots are running without problems. But in the host system the -4 option works

Host OS:
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian

Output:
ping -n -4 -w 5 -c 1 192.168.170.1
PING 192.168.170.1 (192.168.170.1) 56(84) bytes of data.
64 bytes from 192.168.170.1: icmp_seq=1 ttl=63 time=11.8 ms

--- 192.168.170.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 11.774/11.774/11.774/0.000 ms

You will need to work out what version of ping is in the container, is it using busybox ping?

Sorry, I only see with the help output, that it is another version.
But I do not know how to find out which exact ping version is installed.
And I will not install additional tools on this machine.

If this is required for more details, I have to clone the lxc container which costs more time.

You have a solution which is to use automatic mode

We know why it's failing, your environment is using a none standard version of ping.

I'll suggest that this is not a problem with the node and leave it up to you to decide if you want to debug/fix the container

Yes, analyzed, identified and workaround is working. Thank you.

Issue can be closed.