Skip to content

05 Port forwarding ​

A web server in a VM, published on the Mac's localhost:8080, with SSH on localhost:2222.

What you practice ​

  • portForwarding rules: hostPort on the Mac, guestPort in the VM
  • Why a forwarded address needs a DHCP reservation

Topology ​

NodeImageCPUs / memoryAddressesRole
webdebian-131 / 1GiBmgmt 10.105.0.11nginx on port 80

Before you start ​

bash
vz image pull disk debian-13

Run it ​

bash
cd examples/05-port-forwarding
vz validate
vz up
vz node ls
ssh lab@10.105.0.11        # password: lab

First boot installs packages; give it a minute or two after vz up returns.

Try it ​

bash
curl http://localhost:8080
ssh -p 2222 lab@localhost

Edit /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