title: How to do port forwarding properly with VirtualBox?
body: <p>I have a trouble connecting to a guest OS in VirtualBox.
  My environtment is as follows:</p>
  
  <ul>
  <li>Host: MacOSX (Lion)</li>
  <li>Guest: CentOS (5.7, 2.6.18-274.3.1.el5)</li>
  <li>VirtualBox: 4.1.4 r74291
  -- Network Adapter Type: NAT</li>
  </ul>
  
  <p>In the guest OS, I can see that the httpd is running properly like:</p>
  
  <pre><code>$ ps aux | grep httpd
  root      2571  0.0  3.5 258440  8824 ?        Ss   08:20   0:00 /usr/sbin/httpd
  apache    2573  0.0  2.2 258440  5780 ?        S    08:20   0:00 /usr/sbin/httpd
  apache    2574  0.0  2.0 258440  5184 ?        S    08:20   0:00 /usr/sbin/httpd
  apache    2575  0.0  2.0 258440  5180 ?        S    08:20   0:00 /usr/sbin/httpd
  apache    2576  0.0  2.0 258440  5180 ?        S    08:20   0:00 /usr/sbin/httpd
  apache    2577  0.0  2.0 258440  5180 ?        S    08:20   0:00 /usr/sbin/httpd
  apache    2578  0.0  2.0 258440  5180 ?        S    08:20   0:00 /usr/sbin/httpd
  apache    2579  0.0  2.0 258440  5180 ?        S    08:20   0:00 /usr/sbin/httpd
  apache    2580  0.0  2.0 258440  5180 ?        S    08:20   0:00 /usr/sbin/httpd
  $ curl localhost
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
  ...
  </code></pre>
  
  <p>In the host OS, I did a configuration to do port forwarding as follows:</p>
  
  <pre><code>$ VBoxManage showvminfo CentOS_3 | grep "NIC 1"
  NIC 1:           MAC: 080027B1FA87, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: Am79C973, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny
  NIC 1 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
  NIC 1 Rule(0):   name = http, protocol = tcp, host ip = , host port = 8003, guest ip = , guest port = 80
  NIC 1 Rule(1):   name = ssh, protocol = tcp, host ip = , host port = 2203, guest ip = , guest port = 22
  </code></pre>
  
  <p>As this information go, I'm trying to do port forwarding from 8003 to 80 and from 2203 to 22.
  In fact, I can make the ssh connection to the guest OS with "ssh -p 2203 localhost".
  However, when I try to see <a href="http://localhost:8003" rel="nofollow">http://localhost:8003</a>, the browser says
  "Unable to load the webpage because the server sent no data."</p>
  
  <p>When I try "telnet localhost 8003" in the host OS
  it seems the port is listening, but there
  appears no log in the access log of the guest OS.</p>
  
  <p>What should I do to solve this problem?  Thanks in advance!</p>
  
  <p><strong>(addition: Oct. 14 15:55)</strong></p>
  
  <pre><code>$ netstat -nl | grep tcp | grep 127.0.0.1 # Host OS
  tcp4       0      0  127.0.0.1.8003         127.0.0.1.64698        ESTABLISHED
  tcp4       0      0  127.0.0.1.64698        127.0.0.1.8003         ESTABLISHED
  tcp4       0      0  127.0.0.1.26164        127.0.0.1.53917        ESTABLISHED
  tcp4       0      0  127.0.0.1.53917        127.0.0.1.26164        ESTABLISHED
  tcp4       0      0  127.0.0.1.2203         127.0.0.1.53183        ESTABLISHED
  tcp4       0      0  127.0.0.1.53183        127.0.0.1.2203         ESTABLISHED
  
  $ netstat -nl | grep tcp # Guest OS
  tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN
  tcp        0      0 0.0.0.0:952                 0.0.0.0:*                   LISTEN
  tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
  tcp        0      0 :::80                       :::*                        LISTEN
  tcp        0      0 :::22                       :::*                        LISTEN
  tcp        0      0 :::443                      :::*                        LISTEN
  </code></pre>