04 Static addressing
A NAT switch with its DHCP server turned off. Every VM gets a static address, gateway and DNS from cloud-init.
What you practice
dhcp: falseon a switch- Static addresses, routes and DNS in a cloud-init
network-config - The Mac's first address is the NAT gateway and DNS proxy
Topology
| Node | Image | CPUs / memory | Addresses | Role |
|---|---|---|---|---|
web | debian-13 | 1 / 1GiB | lan 10.104.0.11/24 | Static 10.104.0.11 |
db | debian-13 | 1 / 1GiB | lan 10.104.0.12/24 | Static 10.104.0.12 |
Before you start
bash
vz image pull disk debian-13Run it
bash
cd examples/04-static-addressing
vz validate
vz up
vz node ls
vz node console web # login: lab / labTry it
bash
ssh lab@10.104.0.11 'ip -br addr; ip route; resolvectl status | head -20'
ssh lab@10.104.0.11 'sudo ip addr add 10.104.0.50/24 dev lan && ip -br addr show lan'
ping -c 2 10.104.0.50 # the new address answers right awaySee init/web/network-config for the static configuration.
Clean up
bash
vz down
vz destroy --yes # deletes the overlays and state of this lab