Error when using --local-ips to localhost

Hi,

I am trying to use --local-ips and it works perfectly when requesting public IPs. When trying to fetch data from an API running on localhost, it fails. The script also works fine when fetching data from localhost without using --local-ips. Shouldn’t it be the same, specifying the main NICs IP address in the parameter, and running without the parameter?

This works fine:

k6 run test.js

This does not work:

k6 run --local-ips=10.0.0.4 test.js

The script tries to access the API on 127.0.0.1:5000. 10.0.0.4 is the local IPv4 address.

The error is:

Request Failed error="Get \"http://127.0.0.1:5000/get\": dial tcp 10.0.0.4:0->127.0.0.1:5000: connectex: The requested address is not valid in its context."

Hi there,

I can’t reproduce this on Linux and k6 v0.29.0. Can you confirm your OS and k6 version?

Based on that error I would assume you’re using Windows. It seems to be related to the “strong host” networking model, see this issue, so it’s not a k6 or even a Go issue.

According to this documentation you can try enabling “weak host” mode on that interface, which would make it behave as on Linux.

HTH,

Ivan

1 Like

Hi,

I’m using v0.29.0, and Windows, yes.

I’ll look into your suggestion and come back with the result, thanks for the reply.