guest: virtual machine like Ubantu
host: physical machine where virtual machine is running on, e.g. Windows 7
virtual machine app: VMware, Virtual Box etc.
with NAT configuration:
guest lives in a private network virtual machine app created. host and other guest can't access the service it exposes. use port forwarding will let virtual machine app listens to the certain ports on the host and forward to guest. we will utilize it to expose same port on both host and guest
- create a rule in the virtual machine application, set Host IP: 127.0.0.1, set HostPort: 3000, set Guest Port: 3000
- in guest, listen to port 3000.
- in host, open a web browser, type: localhost:3000. it will send get request to guest