小编svo*_*l13的帖子

Docker debian 慢速 dns 解析

ubuntu当使用wget或 、curlapt-get...时,我的 dns 解析速度非常慢

root@815340a37f0e:/# time curl www.google.com
...
real    0m5.132s
user    0m0.006s
sys     0m0.003s
Run Code Online (Sandbox Code Playgroud)

当我做的时候nslookup速度非常快。

root@815340a37f0e:/# time nslookup google.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   google.com
Address: 173.194.78.101
...
real    0m0.024s
user    0m0.010s
sys     0m0.005s
Run Code Online (Sandbox Code Playgroud)

networking domain-name-system ubuntu debian response-time

5
推荐指数
1
解决办法
3298
查看次数

使用 iptables 进行端口转发

我得到了lo127.0.0.1)和eth0172.17.0.8)。我想将登陆的数据包重定向127.0.0.1:80172.17.42.1:80(从 路由eth0)。

我试过

iptables -t nat -A OUTPUT -p tcp --dport 80 -d 127.0.0.1 -j DNAT --to 172.17.42.1:80
Run Code Online (Sandbox Code Playgroud)

但是当我这样做时我没有curl localhost:80得到任何回应,当我这样做时curl 172.17.42.1:80它就起作用了。

networking iptables port-forwarding linux-networking dnat

1
推荐指数
1
解决办法
5436
查看次数