View Full Version : [ubuntu] port forwarding to virtual host

December 4th, 2008, 12:27 PM
Dear Colleagues,

I have created a VMware based XP virtual host on Ubuntu 8.10. I would like to dedicate a port for an application, what is running on the virtual XP.
The network topology is the following:

external connection - public IP from ISP
internal connection -
port forward - enabled

external connection, eth0 -
internal connection, vmnet8 -

XP IP (virtual) -

I have inserted the following entries into the iptables script below, unfortunately with no success. The port is closed from the application.
iptables -A INPUT -p tcp --dport 19897 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 19897 -j ACCEPT
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 19897 -j DNAT --to-destination
iptables -t nat -A POSTROUTING -o vmnet8 -p tcp --dport 19897 -j SNAT --to-source

As I know in the POSTROUTING rule I have to define the source as a gateway. In my read in this case the gateway is the vmnet8, but I am not sure. Please correct me if I wrong.

Thank you all,

December 4th, 2008, 04:18 PM
here is the answer, maybe one of you can use it....
edit the "/etc/vmware/vmnet8/nat/nat.conf" file

insert this entry into the [incomingtcp] section:
19897 =

thank you,