socat 给出错误 (read(6, 0xf97acc0, 8192): Permission denied)

dev*_*ent 6 ipv6 openvpn socat

我正在尝试socat用作端口映射器,将 IPv4 连接映射到在 DS-Lite IPv6 电缆连接后面运行的 OpenVPN 服务器。

//编辑我尝试使用非 root 用户和root. 但是我对两个用户都得到了相同的结果。//编辑

目标是能够通过 OpenVPN 从我的手机连接到我的 (IPv4) 智能家居设备。

从正在运行的服务器,socat我可以ping6在家里使用我的路由器。IPv6 端口转发也已启用,并将 1194/udp 转发到在家中运行 OpenVPN 服务器的树莓派。

现在的问题是,socat当我尝试从我的手机连接 OpenVPN 时,我看到了一个错误。

root@scw-31f6c8:~/bin# socat -d -d UDP4-LISTEN:63530,fork UDP6:xxx.dynv6.net:1194
2017/12/27 13:53:01 socat[15428] N listening on UDP AF=2 0.0.0.0:63530
2017/12/27 13:53:07 socat[15428] N accepting UDP connection from AF=2 xx.xxx.xxx.xx:1319
2017/12/27 13:53:07 socat[15428] N forked off child process 15429
2017/12/27 13:53:07 socat[15428] N listening on UDP AF=2 0.0.0.0:63530
2017/12/27 13:53:07 socat[15429] N opening connection to AF=10 [2a02:810c:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:1194
2017/12/27 13:53:07 socat[15429] N successfully connected from local address AF=10 [2001:0bc8:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:41641
2017/12/27 13:53:07 socat[15429] N starting data transfer loop with FDs [5,5] and [6,6]
2017/12/27 13:53:07 socat[15429] E read(6, 0xf97acc0, 8192): Permission denied
2017/12/27 13:53:07 socat[15429] N exit(1)
2017/12/27 13:53:07 socat[15428] N childdied(): handling signal 17
2017/12/27 13:53:07 socat[15428] W waitpid(): child 15429 exited with status 1
Run Code Online (Sandbox Code Playgroud)

乍一看,一切看起来都不错,直到它击中read(6, 0xf97acc0, 8192): Permission denied

目前我无法确定这是否是socat运行它的服务器上的错误,或者是否与从socat我家中的 IPv6 端点的通信问题有关。

关于如何找出问题的任何指示?

//编辑

我也在不同的机器(uberspace,scaleway)上尝试过,以确保它与服务器端配置不正确有关。可能表明我这边出了点问题。但目前我没有看到它。

小智 0

有同样的问题。事实证明,由于某些原因,我的 Fritzbox 在端口映射中添加了错误的(或者可能是旧的)IPv6 地址,而该地址不是 VPN 服务器的端口映射。修复后它起作用了。

编辑:我可以通过在 fritzbox 的端口映射中将 IPv6 地址从 xx8d 更改为错误的 xxd8 来重现该日志。

$ socat -d -d UDP4-LISTEN:2194,fork UDP6:xxxxx.dynv6.net:2194
2021/07/14 22:30:14 socat[] N listening on UDP AF=2 0.0.0.0:2194
2021/07/14 22:30:28 socat[] N accepting UDP connection from AF=2 109.42.112.115:59217
2021/07/14 22:30:28 socat[] N forked off child process 10569
2021/07/14 22:30:28 socat[] N listening on UDP AF=2 0.0.0.0:2194
2021/07/14 22:30:28 socat[] N opening connection to AF=10 [2a00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xx8d]:2194
2021/07/14 22:30:28 socat[] N successfully connected from local address AF=10 [2a03:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxbf]:50334
2021/07/14 22:30:28 socat[] N starting data transfer loop with FDs [5,5] and [6,6]
2021/07/14 22:30:28 socat[] E read(6, 0x55d9a7c15da0, 8192): Permission denied
2021/07/14 22:30:28 socat[] N exit(1)
2021/07/14 22:30:28 socat[] N childdied(): handling signal 17 here
Run Code Online (Sandbox Code Playgroud)

改回正确的值 xx8d 后,它再次工作。