A network-services lab: DHCP, DNS, proxy, load balancer, time and failover
Build a small private network of virtual machines and run the real services from the Network Services and Linux in Production courses, so you can test them with real commands.
What you need
The service labs in the lessons check a configuration file. A real service also has to start, listen and answer, and the best way to learn that is to run it. You need three roles, which can be separate VMs or fewer VMs doing several jobs:
- server: runs the services you are practising (DHCP, DNS, time, a web server).
- client: a plain Ubuntu (or Windows) machine that asks the server for things.
- second node (optional): a second server for failover (keepalived) or a second web server behind a load balancer.
Set it up
- Build one Ubuntu Server VM, update it, then clone it to make the others (see the virtual machine lab guide).
- Give every VM two network adapters: NAT for downloading packages, and one internal network named
labfor the practice network. - On the internal adapter, set fixed addresses in one private range. For example, with Netplan on Ubuntu (
/etc/netplan/60-lab.yaml) give the server10.10.10.2/24, and leave the client’s adapter unconfigured so DHCP can configure it. Apply withsudo netplan apply. - Install the service you are practising only on the machine that needs it:
sudo apt install -y isc-dhcp-server # DHCP (or: dnsmasq)
sudo apt install -y unbound # DNS resolver
sudo apt install -y squid # forward proxy
sudo apt install -y haproxy # load balancer
sudo apt install -y keepalived # failover (VRRP)
sudo apt install -y chrony # time server
sudo apt install -y nginx bind9 # web server, authoritative DNS
- Put your configuration in place (the lessons’ model answers are a good start), then test the file before restarting:
sudo dhcpd -t -cf /etc/dhcp/dhcpd.conf,sudo haproxy -c -f /etc/haproxy/haproxy.cfg,sudo squid -k parse,sudo unbound-checkconf,sudo nginx -t,sudo keepalived -t -f /etc/keepalived/keepalived.conf. Thensudo systemctl restart <service>.
Check that it works
Check each service from the client, not from the server:
- DHCP:
sudo dhclient -v(or restart networking) shows an offer and a lease from your server;ip -br addrshows the address from your pool. - DNS:
dig @10.10.10.2 files.lab.example +shortreturns your internal address; the same query from outside the allowed network is refused. - Proxy:
curl -x http://10.10.10.2:3128 -I http://example.comworks; a blocked site returns 403. - Load balancer: repeated
curl http://10.10.10.2/shows both web servers answering; stop one and the other keeps answering. - Time:
chronyc trackingon the client shows a small offset from your server. - Failover:
ip -br addrshows the shared address on one node; stop the service and it moves.
Practise safely
- Keep the lab network internal. Never run a DHCP server on a bridged adapter: it will answer other devices on your real network and can knock them offline.
- Snapshot the clean clone before each service so you can return to it.
- Read logs rather than guessing:
sudo journalctl -u <service> -fwhile a client connects. - Keep services bound to the lab address; do not expose a lab resolver or time server to the internet.
Go further
- Break each service on purpose: a wrong netmask in DHCP, a deny placed after the allow in Squid, a mismatched virtual router id in keepalived. Find each fault in the logs.
- Capture the DHCP exchange on the client with
sudo tcpdump -i <interface> -n port 67 or port 68and read Discover, Offer, Request, ACK (see the Wireshark lab guide). - Add a second DHCP server on purpose, on the lab network only, and watch the clients take the first offer; then fix it.
- Automate the build with a shell script, then rebuild the lab from clean clones and time it.
Courses that use this lab
Other lab guides
- A virtual machine lab on your own computer
- A Linux practice machine
- A network lab with free simulators and virtual routers
- A packet-capture lab with Wireshark and tcpdump
- A Windows Server and Active Directory lab
- A developer workstation: editor, Git, Python and Node
- A container and Kubernetes lab
- A monitoring lab with Prometheus and Grafana
- A security operations (SOC) practice lab
- An isolated security lab for authorised practice
- A cloud lab that cannot surprise you with a bill
- An embedded and microcontroller lab: simulators first, hardware second
- An electronics lab: simulate first, then build on a breadboard
- A Raspberry Pi lab, with or without a Pi
- A home automation lab with Home Assistant and MQTT
- An audio, video, streaming and show-control lab
- A data lab: Python, pandas and Jupyter on your own computer
- A machine learning lab: scikit-learn, notebooks and honest experiments
- An LLM lab: a free local model, embeddings and a test harness
- A TypeScript lab: Node.js, the compiler and a test runner
- A web deployment lab: Git, a free host and environment settings
Software changes quickly. Menu names and version numbers may differ a little from what you see; the ideas and the check at the end of each section stay the same. Always download from the project's own website, and read the licence terms for your situation.