我正在使用 redsocks 通过代理重定向。问题是,当我使用 wget 之类的工具时,它似乎正在连接但无法解析。可能是什么问题?我该如何解决?
执行 wget google.com
--2020-08-22 17:32:34-- http://google.com/
Resolving google.com (google.com)... 172.217.1.110, 2607:f8b0:4008:810::200e
Connecting to google.com (google.com)|172.217.1.110|:80... connected.
HTTP request sent, awaiting response...
执行 curl google.com
curl -v google.com -o 已保存
% 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 172.217.1.110:80...
* Connected to google.com (172.217.1.110) port 80 (#0)
> GET / HTTP/1.1
> Host: google.com
> User-Agent: curl/7.71.1
> Accept: */*
>
0 0 0 0 0 0 0 0 --:--:-- 0:00:14 --:--:-- 0^C
红袜
base {
log_debug = on;
log_info = on;
log = "file:/var/log/redsocks.log";
daemon = on;
redirector = iptables;
}
redsocks {
local_ip = 0.0.0.0;
local_port = 12345;
ip = my.proxy;
port = 3128;
type = http-connect;
login = "myUser";
password = "myPassword";
}
redsocks {
local_ip = 0.0.0.0;
local_port = 12346;
ip = my.proxy;
port = 3128;
type = http-relay;
login = "myUser";
password = "myPassword";
}
iptables
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
REDSOCKS tcp -- 0.0.0.0/0 0.0.0.0/0
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain REDSOCKS (1 references)
target prot opt source destination
RETURN all -- 0.0.0.0/0 0.0.0.0/8
RETURN all -- 0.0.0.0/0 10.0.0.0/8
RETURN all -- 0.0.0.0/0 100.64.0.0/10
RETURN all -- 0.0.0.0/0 127.0.0.0/8
RETURN all -- 0.0.0.0/0 169.254.0.0/16
RETURN all -- 0.0.0.0/0 172.16.0.0/12
RETURN all -- 0.0.0.0/0 192.168.0.0/16
RETURN all -- 0.0.0.0/0 198.18.0.0/15
RETURN all -- 0.0.0.0/0 224.0.0.0/4
RETURN all -- 0.0.0.0/0 240.0.0.0/4
REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 12346
REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 redir ports 12345
REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:11371 redir ports 12346
答案1
我用 transocks 替换了 redsocks,现在我可以使用一个配置来重定向“http”和“https”(在我的 IP 表中,我将所有流量重定向到 transocks)