我有一个为 提供服务的节点服务器localhost:90
,我们需要将所有来自机器内部的curl 调用定向168.92.168.92
到localhost:90
。
如何才能实现这一目标?这会使用 iptables 吗?
我尝试了 OUTPUT 和 PREROUTING 但请求无法连接。
Chain PREROUTING (policy ACCEPT 3339 packets, 200K bytes)
num pkts bytes target prot opt in out source destination
1 0 0 DNAT tcp -- 168.92.168.92 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 to:127.0.0.1:90
Chain INPUT (policy ACCEPT 3339 packets, 200K bytes)
num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 6220 packets, 652K bytes)
num pkts bytes target prot opt in out source destination
1 0 0 DOCKER all -- * * 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL
2 0 0 DNAT tcp -- * * 168.92.168.92 0.0.0.0/0 tcp dpt:80 to:127.0.0.1:90
输出:
# curl -v http://168.92.168.92/hello
* About to connect() to 168.92.168.92 80 (#0)
* Trying 168.92.168.92... Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
Curl directly to the server on localhost:90 works, but curl on 168.92.168.92 does not.
我缺少什么?