Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows, IPv4 ICMP fails but IPv6 ICMP succeeds #314

Closed
avonwyss opened this issue Apr 24, 2018 · 13 comments
Closed

On Windows, IPv4 ICMP fails but IPv6 ICMP succeeds #314

avonwyss opened this issue Apr 24, 2018 · 13 comments

Comments

@avonwyss
Copy link
Contributor

avonwyss commented Apr 24, 2018

Host operating system

Windows 2016 Datacenter, Version 1607, Build 14393.2189

blackbox_exporter version

version=0.12.0, branch=HEAD, revision=4a22506cf0cf139d9b2f9cde099f0012d9fcabde

What is the blackbox.yml module config.

Unchanged from release package.

What logging output did you get from adding &debug=true to the probe URL?

ts=2018-04-24T09:29:59.1632814Z caller=main.go:116 module=icmp target=172.21.100.2 level=info msg="Beginning probe" probe=icmp timeout_seconds=9.5
ts=2018-04-24T09:29:59.1632814Z caller=utils.go:42 module=icmp target=172.21.100.2 level=info msg="Resolving target address" preferred_ip_protocol=ip6
ts=2018-04-24T09:29:59.1632814Z caller=utils.go:52 module=icmp target=172.21.100.2 level=warn msg="Resolution with preferred IP protocol failed, attempting fallback protocol" fallback_protocol=ip4 err="address 172.21.100.2: no suitable address found"
ts=2018-04-24T09:29:59.1632814Z caller=utils.go:65 module=icmp target=172.21.100.2 level=info msg="Resolved target address" ip=172.21.100.2
ts=2018-04-24T09:29:59.1632814Z caller=icmp.go:71 module=icmp target=172.21.100.2 level=info msg="Creating socket"
ts=2018-04-24T09:29:59.1720999Z caller=icmp.go:117 module=icmp target=172.21.100.2 level=info msg="Creating ICMP packet" seq=24 id=2072
ts=2018-04-24T09:29:59.1720999Z caller=icmp.go:129 module=icmp target=172.21.100.2 level=info msg="Writing out packet"
ts=2018-04-24T09:29:59.1720999Z caller=icmp.go:139 module=icmp target=172.21.100.2 level=warn msg="Error writing to socket" err="write ip 0.0.0.0->172.21.100.2: raw-write ip4 0.0.0.0: not implemented"
ts=2018-04-24T09:29:59.1720999Z caller=main.go:129 module=icmp target=172.21.100.2 level=error msg="Probe failed" duration_seconds=0.0088184

What did you expect to see?

Probe successful

What did you see instead?

Probe failed

Additional info

Tried running the exporter as local service, network service, domain admin, the error is always the same. It even fails for the localhost address 127.0.0.1. The same exporter instance can, however, successfully ping IPv6 targets:

ts=2018-04-24T09:44:13.4871333Z caller=main.go:116 module=icmp target=2a00:1450:400a:806::2003 level=info msg="Beginning probe" probe=icmp timeout_seconds=9.5
ts=2018-04-24T09:44:13.4871333Z caller=utils.go:42 module=icmp target=2a00:1450:400a:806::2003 level=info msg="Resolving target address" preferred_ip_protocol=ip6
ts=2018-04-24T09:44:13.4871333Z caller=utils.go:65 module=icmp target=2a00:1450:400a:806::2003 level=info msg="Resolved target address" ip=2a00:1450:400a:806::2003
ts=2018-04-24T09:44:13.4871333Z caller=icmp.go:71 module=icmp target=2a00:1450:400a:806::2003 level=info msg="Creating socket"
ts=2018-04-24T09:44:13.4871333Z caller=icmp.go:117 module=icmp target=2a00:1450:400a:806::2003 level=info msg="Creating ICMP packet" seq=963 id=2072
ts=2018-04-24T09:44:13.4881269Z caller=icmp.go:129 module=icmp target=2a00:1450:400a:806::2003 level=info msg="Writing out packet"
ts=2018-04-24T09:44:13.4881269Z caller=icmp.go:157 module=icmp target=2a00:1450:400a:806::2003 level=info msg="Waiting for reply packets"
ts=2018-04-24T09:44:13.5049861Z caller=icmp.go:177 module=icmp target=2a00:1450:400a:806::2003 level=info msg="Found matching reply packet"
ts=2018-04-24T09:44:13.5049861Z caller=main.go:127 module=icmp target=2a00:1450:400a:806::2003 level=info msg="Probe succeeded" duration_seconds=0.0178529

This seems to be the same as/similar to issue #301 but that one was closed without additional information.

@avonwyss avonwyss changed the title On Windows 2016, IPv4 ICMP fails but IPv6 ICMP succeeds On Windows, IPv4 ICMP fails but IPv6 ICMP succeeds Apr 24, 2018
@avonwyss
Copy link
Contributor Author

I have no Go experience at all, but from Googling around to find ICMP samples I think that for IPv4 one should also use a IPv4PacketConn but right now the exporter code uses NewRawConn instead. Since IPv6 uses IPv6PacketConn it would also explain why IPv6 works fine.

@avonwyss
Copy link
Contributor Author

@brian-brazil I hope you don't mind me pinging you for this issue. This problem effectively prevents getting IPv4 ICMP to work on Windows, which seems like a major bug to me (and it is a killer since it prevents monitoring IPv4 device availability). Who could have a look at it?

@brian-brazil
Copy link
Contributor

I'm afraid I'm not a Windows person, so you'd need to find someone who has Go networking experience on Windows. I suspect this one will require work inside Go itself.

@avonwyss
Copy link
Contributor Author

Thank you for the reply. From my googling around I wonder if all that is needed may be to to replace the raw packet NewRawConn with a IPv4PacketConn (analogous to the IPv6 ICMP code), which would not really be a Windows-specific (or Go) code change. I'd be happy to test the result on Windows if that helps.

@SuperQ
Copy link
Member

SuperQ commented May 26, 2018

Using IPv4PacketConn makes sense to me. Somehow the windows compatibility concerns did not get addressed at the time0.

The down side is that we would lose the Don't Fragment config option.

@avonwyss
Copy link
Contributor Author

avonwyss commented Jun 1, 2018

I have tried to make code adjustments but I cannot get it to build locally (on Windows):
.\main.go:124:19: cannot use registry (type *"github.com/prometheus/client_golang/prometheus".Registry) as type *"github.com/prometheus/blackbox_exporter/vendor/github.com/prometheus/client_golang/pro metheus".Registry in argument to prober

Since there are no artifacts in the TravisCI and CircleCI builds I have no idea how I can actually try my changes. And having zero Go experience I'm also completely lost with that error message and vendoring stuff.

@brian-brazil
Copy link
Contributor

That sounds like your Go environment isn't setup correctly. See https://github.com/golang/go/wiki/SettingGOPATH#windows

@avonwyss
Copy link
Contributor Author

avonwyss commented Jun 1, 2018

@brian-brazil I did follow the instructions and do have a GOPATH pointing to a valid dir and go get did add a bunch of stuff into the pkg and src in that folder. What I did not get is how the workspace is related to the cloned repo folder which was outside the GOPATH folder. Building from inside the src folder seems to work, it's all pretty confusing for me...

@brian-brazil
Copy link
Contributor

You'll want to work entirely inside the GOPATH, so move the clone repo inside there to the appropriate directory.

@avonwyss
Copy link
Contributor Author

avonwyss commented Jun 1, 2018

Thanks, wish I'd known that before... ;) Created PR #329

@timlharrison
Copy link

Will this be in a release at some point soon? This is preventing me from using ICMP on Windows 2016.

@avonwyss
Copy link
Contributor Author

@timlharrison Here's my personal build if you're interested:
blackbox_exporter.zip

@timlharrison
Copy link

@avonwyss thanks very much. I'm using tcp_connect as a workaround, but I'm worried at some point that wont work for me. Is there any release schedule or anything for this project? I'm new to Prometheus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants