ホストからゲストへの iptables 転送は、VM 間の通信を妨げます。

ホストからゲストへの iptables 転送は、VM 間の通信を妨げます。

私のiptables -L:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             192.168.122.0/24     ctstate RELATED,ESTABLISHED
ACCEPT     all  --  192.168.122.0/24     anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             nginx                tcp dpt:http
ACCEPT     tcp  --  anywhere             nginx                tcp dpt:https

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootpc
ACCEPT     tcp  --  anywhere             anywhere

返品:

$ cat /proc/sys/net/ipv4/ip_forward
1

192.168.122.0/24に複数のVMがあり、その1つは80と443を受信するnginxです。 VM が互いに :80 と :443 を要求する場合を除き、すべてのネットワークはうまく機能します。 FQDN(nginxに属する必要がある)からの要求も同様です。

ベストアンサー1

これが「答え」に該当するかどうかはわかりませんが、私の問題を解決しました。私の/etc/hostsを編集し、パブリックIPを内部VM IPにオーバーライドすると、すべてが正常に動作し始めました。私の考えでは、パブリックIPを介した往復が切れているようですが、完全にはわかりません。

おすすめ記事