【问题标题】:Routing by linux iptableslinux iptables 路由
【发布时间】:2013-08-28 12:37:23
【问题描述】:

我有 3 个虚拟机,分别称为 vm1 vm2 和 vm3。我想通过 vm2 从 vm1 ping 到 vm3。 vm1 有一个接口 eth0,其 IP 地址为 192.168.221.10。同样,vm3 的 eth0 的 IP 地址为 192.168.221.11。 vm2 有 2 个接口,即 eth1 (192.168.221.1) 和 eth2 (192.168.221.2)。我想控制 vm2 上的连接并使用以下命令路由它们

sudo iptables -t nat -A PREROUTING  -i eth2 -j DNAT --to 192.168.221.1        
sudo iptables -t nat -A PREROUTING  -i eth1 -j DNAT --to 192.168.221.11

但是我无法以这种方式从 vm1 到达 vm3。任何想法是什么问题。 非常感谢。

【问题讨论】:

    标签: linux routing virtual-machine iptables


    【解决方案1】:

    确保您已在 VM2 上启用 IP 转发,因为您的 VM2 充当路由器。

    我还在 How to configure Ubuntu as a router 上使用 IPTables 发布了一篇文章。

    【讨论】:

      猜你喜欢
      • 2016-12-08
      • 2012-10-16
      • 2013-11-10
      • 1970-01-01
      • 2012-01-04
      • 1970-01-01
      • 1970-01-01
      • 2010-09-12
      • 2011-06-24
      相关资源
      最近更新 更多