Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I currently have a Server (Debian 7.3 , Kernel 3.2.0-4-amd64) with VMware Player 6 installed which is hosting a guest OS(Ubuntu Server) with Nginx running on it. I want the NGINX to serve webcontent to the outside instead of hosting the content on the Host OS (Debian) via NGINX installed on the host OS. The Network connection for the guest OS is hosted via a NAT.

Now i (think) understand that I will need to configure two components here. One being the NAT itself which I think i have done by editing the /etc/vmware/vmnet8/nat/nat.conf file and adding this: 80 = 172.16.147.129:80 under the [incomingtcp] header. If i understand correctly I will also need to add a portforward on the Host OS side, problem is I am not quite clear on how to achieve this.

If i perform sudo ifconfig on the host os i will see that eth0 has my normal i.p address with which i usually access the server there is also vmnet1: which shows an address of 192.168.87.1 and vmnet8 (the NAT) which has an inet address of 172.16.147.1 If i perform ifconfig on the guestOS i will see an inet address of 172.16.147.129.

Also i made sure to enable port forwarding in the sysctl by doing "sysctl -w ipv4.ip_forward=1" and checked with cat /proc/sys/net/ipv4/ip_forward and it returns a 1. Not sure if there are any other checks i need to perform

To summarize: Host Server i.p(eth0 public address): x.x.x.x Host Server Vmnet8(NAT): 172.16.147.129 Host Server Vmnet1: 192.168.87.1 Guest Server i.p(eth0): 172.16.147.1

So what i will need to do is setup the iptables and if i am not mistaken to route traffic incoming on port 80 of the host OS to the IP i will need to do something along these lines:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT ---destination 172.16.147.129:80

iptables -t nat -A POSTROUTING -o vmnet8 -p tcp --dport 80 -j SNAT --source 172.16.147.1

Or am i completely wrong? I checked if the Internal VM IP is pingable from within the host, but i need stable input/output connections from and to the VMs webserver. So if anybody could help out I'd appreciate it

EDIT:

Well i just restarted the entire vmwareplayer with sudo /etc/init.d/vmware restart and it appears that the server is reachable... weird enough.. but fine with me right now

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.