HTTP Request ENETUNREACH with IPv6

I am going through the following situation: I am using a 4G chip that provides only IPv6, and because of this, I am unable to make any HTTP requests in Node-RED. It always returns ENETUNREACH. In the case of an IPv4 connection, it works fine. I am using Node-RED that comes with Siemens IOT2050 (v2.2.2). I've tried updating it, but it didn't work, and I also lost the GPIO nodes and couldn't reinstall them. It's worth noting that I tested with an IPv6 connection on my Node-RED installed on my Windows, and it worked perfectly. I believe the issue is not with the IOT because I can make an HTTP request in its terminal. Does anyone have any idea what might be happening?
Captura de tela 2023-10-19 081025

Hi @fabio.amorim,

I'm not great at the internals,

But, how is Node RED actually running? in a container of some sort? if so - it likely doesn't have an IPv6 interface, or the Node process is only using the IPv4 interface (in your case, the network between you and the kit presumably).

Some understanding on how Node RED is actually running will help.

EDIT
Also, what version of Node are you running?

If you look at the error you will see that it is trying to use an IPV4 address, not ipv6.
What do you see if you try to ping the url?

Hi @Marcus-J-Davies,

It is running on an IoT device with Debian. Node-RED works with other cellular chips that provide only IPv4. The error occurs when it offers only IPv6.

I'm using Node version 12.22.12 with Node-RED 2.2.2; however, I previously updated it to Node version v14.21.3 and Node-RED version 3.1.0, but the same error occurs.

Hi @Colin,

I don't know why Node-RED is trying to use an IPv4 address. From the terminal screenshot, it's evident that the IoT device itself can make this request. When pinging Google, I get a valid response indicating internet connectivity. I don't know what's happening; the error persists when trying to make a request to Google as well.

What do you see when you try to ping the url? Show us the response. Also what does
ip a
show?

I don't know if this will affect the Request Node - but maybe try to set the following to :: in settings.js

    /** By default, the Node-RED UI accepts connections on all IPv4 interfaces.
     * To listen on all IPv6 addresses, set uiHost to "::",
     * The following property can be used to listen on a specific interface. For
     * example, the following would only allow connections from the local machine.
     */
    uiHost: "::"

@Colin



It didn't work.

I missed a comma, the settings file is an object

Should be

uiHost:”::”,

That all looks ok.

My apologies @marcus-j-davies, it was my mistake as well for not realizing that the comma was missing when copying your code line. Unfortunately, the change didn't have any effect, and the request still returns the same error.

The node runtime seems to default to IPv4 - I don’t know enough about it, or the got library that the request node uses.

@Steve-Mcl ?

Node JS < 16 (or maybe 18, I forgot and don't have time to look ATM, but it is findable on this forum and around the web) is what favours ipv4.

If the op is running IPV6 only and Node-RED 3.1.0, I would recommend node JS v18LTS

2 Likes

Hello @Steve-Mc, I had previously tried to update only to version 14, but by using the following commands, I was able to update to the latest version, node v21.0.0 (npm v10.2.0):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc
nvm install node

To be able to install it on the IOT, it was necessary to first uninstall the version that comes with it, as it would revert to the previous version every time it was restarted. Unfortunately, as you can imagine, I lost the iot2050 gpio, and it is not possible to install it in this new version. Additionally, every time I restart the IOT, I have to use the commands to start Node-RED:

nvm use node
node-red

The important thing is that the problem has been identified; now, it's about seeking solutions to be able to use the digital inputs and outputs of the IOT after the Node-RED update.

Don't use 21, that is the release that is worked on day to day. Use 18. 20 should also be ok but there may still be nodes that don't support it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.