05 Port forwarding
A web server in a VM, published on the Mac's localhost:8080, with SSH on localhost:2222.
What you practice
portForwardingrules:hostPorton the Mac,guestPortin the VM- Why a forwarded address needs a DHCP reservation
Topology
| Node | Image | CPUs / memory | Addresses | Role |
|---|---|---|---|---|
web | debian-13 | 1 / 1GiB | mgmt 10.105.0.11 | nginx on port 80 |
Before you start
bash
vz image pull disk debian-13Run it
bash
cd examples/05-port-forwarding
vz validate
vz up
vz node ls
ssh lab@10.105.0.11 # password: labFirst boot installs packages; give it a minute or two after vz up returns.
Try it
bash
curl http://localhost:8080
ssh -p 2222 lab@localhostEdit /var/www/html/index.html in the VM and reload the page.
Clean up
bash
vz down
vz destroy --yes # deletes the overlays and state of this lab