port forwarding not working

Discussions related to using VirtualBox on Linux hosts.
Post Reply
howlerbr
Posts: 2
Joined: 19. May 2009, 18:02
Primary OS: Ubuntu 8.04
VBox Version: OSE other
Guest OSses: Slackware12

port forwarding not working

Post by howlerbr »

Hi All,

This is my first post. I have the setup below:

Host: Ubuntu 8.04 32 bit (client)
Guest: Slackware 12.1 (server with apache, mysql, ...)

The host has 192.168.1.100 fixed and the Guest has 192.168.1.200

I'm trying to redirect all incoming tcp/ip requests to 192.168.1.100 to be redirect to my 192.168.1.200 that is my Guest operation system installed in virtualbox. I used the following commands:

iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.200
iptables -t nat -A POSTROUTING -p tcp -d 192.168.1.200 --dport 80 -j MASQUERADE

In VirtualBox the network is configured to host interface (eth0)

I'm able to ping 192.168.1.200 from 192.168.1.100 and I'm also able to open a browser and type http://192.168.1.200 so that apache welcome page is displayed.

But whenever I try to use http://192.168.1.100 it keeps trying to search and then gives timeout saying the page could not be displayed.

What I'm doing wrong?

Thanks howler
howlerbr
Posts: 2
Joined: 19. May 2009, 18:02
Primary OS: Ubuntu 8.04
VBox Version: OSE other
Guest OSses: Slackware12

Re: port forwarding not working

Post by howlerbr »

nobody :(?
dmcgraw
Volunteer
Posts: 808
Joined: 24. Jun 2008, 17:16
Primary OS: Ubuntu 8.10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Ubuntu 9.10
Location: St. Louis, MO, USA

Re: port forwarding not working

Post by dmcgraw »

This sounds more like an Ubuntu/iptables problem than a VBox problem.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: port forwarding not working

Post by Sasquatch »

Correct. Working with IPtables is NOT in the scope of this forum. Please go to Ubuntu Forums for more specialized help.
Why you want to route all traffic to port 80 from one machine on your network to another is beyond me. What's the difference in pointing to .200 directly?
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply