例如下面一个非常奇怪的现象,通过 python get 内网地址 遇到 No route to host
但是 curl 可以成功。
requests.exceptions.ConnectionError: HTTPConnectionPool(host='10.0.0.200', port=8000): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1061976f0>: Failed to establish a new connection: [Errno 65] No route to host'))
>>>
ZzdedeMac-mini.local ⛵ home-ha (traefik) in jfs/sdk/python on main took 51s496ms
➜ curl -v http://10.0.0.200:8000/ -o /dev/null
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 10.0.0.200:8000...
* Connected to 10.0.0.200 (10.0.0.200) port 8000
> GET / HTTP/1.1
> Host: 10.0.0.200:8000
> User-Agent: curl/8.7.1
> Accept: */*
python 代码非常简单
requests.get("http://10.0.0.200:8000")
可能是什么原因呢?