ipv6上传文件出现连接超时

近日有接到客户反馈上传出现超时问题,于是协助客户排查,首先确认了下路由和 ping 都没问题,说明网络应该是正常的,然后创建了一个1G 的大文件使用 curl 模拟上传

zencodex@localhost:~$ dd if=/dev/zero of=test bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.0929132 s, 1.1 GB/s

指定 ipv4地址上传完全没问题

zencodex@localhost:~$ curl -T test http://43.230.89.190/filesyncali/test -u awen:password -v -H"Host:v0.api.upyun.com"
* Hostname was NOT found in DNS cache
*   Trying 43.230.89.190...
* Connected to 43.230.89.190 (43.230.89.190) port 80 (#0)
* Server auth using Basic with user 'awen'
> PUT /filesyncali/test HTTP/1.1
> Authorization: Basic YXpasswd==
> User-Agent: curl/7.35.0
> Accept: */*
> Host:v0.api.upyun.com
> Content-Length: 104857600
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
* Server marco/1.7 is not blacklisted
< Server: marco/1.7
< Content-Type: application/octet-stream
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Request-Id: 84634fc437e5558238f7e49aa736ba02
< X-Request-Path: 403-zj-fud-205
< ETag: "2f282b84e7e608d5852449ed940bfc51"
< Date: Fri, 08 Sep 2017 03:11:48 GMT
< Access-Control-Allow-Origin: *
<
* Connection #0 to host 43.230.89.190 left intact

然后默认上传就出现500错误

zencodex@localhost:~$ curl -T test http://v0.api.upyun.com/filesyncali/test -u awen:password -v
* Hostname was NOT found in DNS cache
*   Trying 2405:fd80:110:0:d63d:7eff:fe73:c46...
* Connected to v0.api.upyun.com (2405:fd80:110:0:d63d:7eff:fe73:c46) port 80 (#0)
* Server auth using Basic with user 'awen'
> PUT /filesyncali/test HTTP/1.1
> Authorization: Basic YXpasswd==
> User-Agent: curl/7.35.0
> Host: v0.api.upyun.com
> Accept: */*
> Content-Length: 104857600
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
* Server marco/1.7 is not blacklisted
< Server: marco/1.7
< Date: Fri, 08 Sep 2017 03:13:35 GMT
< Content-Type: text/html
< Content-Length: 190
< Connection: close
< X-Request-Id: 938f4dba429d1b864a3df2e4f7d8963b
<
* Send failure: Connection reset by peer
* Closing connection 0
curl: (55) Send failure: Connection reset by peer

使用 ifconfig 看了下客户这个主机有 ipv6地址。 然后问了下内部的开发说是没开启 ipv6的支持。

所以遇到类似问题,可以在网卡禁止 ipv6的地址就可以了,另外也反馈运维那边尽快支持就可以。