Closed heiher closed 1 year ago
安装试了下,用 tproxy
尝试请求 Google 失败了,连接 Baidu 是成功的。
tproxy curl --verbose https://www.google.com
* Rebuilt URL to: https://www.google.com/
* Hostname was NOT found in DNS cache
* Trying 172.217.20.100...
* connect to 172.217.20.100 port 443 failed: Connection timed out
* Failed to connect to www.google.com port 443: Connection timed out
* Closing connection 0
curl: (7) Failed to connect to www.google.com port 443: Connection timed out
看了下是流量没有重定向,没有生效。
使用 iptables
的话也可以参考依云的使用 cgroups net_cls 来让 docker 走代理。
安装试了下,用
tproxy
尝试请求 Google 失败了,连接 Baidu 是成功的。tproxy curl --verbose https://www.google.com * Rebuilt URL to: https://www.google.com/ * Hostname was NOT found in DNS cache * Trying 172.217.20.100... * connect to 172.217.20.100 port 443 failed: Connection timed out * Failed to connect to www.google.com port 443: Connection timed out * Closing connection 0 curl: (7) Failed to connect to www.google.com port 443: Connection timed out
看了下是流量没有重定向,没有生效。
确认两个点:
看了下是我本机的 iptables
版本太低,还不支持 cgroup
。
基于iptables + network classifier cgroup的,用于实现per app的TCP、DNS重定向,支持子进程自动继承,实现更简单。
具体实现:https://hev.cc/2813.html