title: Iptables: forward request on different interfaces and port
body: <p>I have a machine with 2 interfaces:</p>
  
  <pre><code>eth0      inet addr:1.1.1.1
  eth1      inet addr:2.2.2.2
  </code></pre>
  
  <p>eth0 is a server, eth1 is the network on virtual machine.</p>
  
  <p>I have ssh on server, so 1.1.1.1:22 is busy.</p>
  
  <p>I need a rule for redirecting incoming connections on eth0 port 6000 to eth1, ip 2.2.2.100 on port 22 (virtual machine ip).</p>
  
  <p>In this mode if I did, on an external machine,</p>
  
  <pre><code>ssh -p 6000 root@1.1.1.1
  </code></pre>
  
  <p>I would login on the virtual machine.</p>
  
  <p>I tried this rule but it didn't work:</p>
  
  <pre><code>sudo iptables -P FORWARD ACCEPT
  sudo iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 6000 -j DNAT --to 2.2.2.100:22
  </code></pre>