Home/Hands-on Labs

Hands-on Labs

Real tasks from real infrastructure, written up as repeatable labs. Each one explains the goal, walks through every step with screenshots and commands, and ends with how to verify it worked.

 labs OPNsense · IPv6 · Debian · RAID · Talos · Fleet · SSH

Publish a domain with OPNsense (Unbound + HAProxy)

Intermediate~20 minOPNsenseUnbound DNSHAProxy

Goal

  • Make apex.pride.improwised.dev reachable for users, served by an internal web server at 10.0.15.128:80.
  • Understand how DNS, a reverse proxy and host-based routing fit together.

How the request flows

Browser→Unbound DNS → firewall IP→HAProxy public service→Rule (Host matches)→Backend pool→Real server 10.0.15.128

The DNS override points the name at the firewall, not at the web server. HAProxy on the firewall then decides which backend gets the request by looking at the HTTP Host header — that's how many sites share one IP.

OPNsense Apply and Test syntax buttons
After every step click Apply — and in HAProxy, Test syntax first.
1

Add a DNS host override

Services › Unbound DNS › Overrides → + Add. Set Host apex, Domain pride.improwised.dev, Type A, and the firewall's IP as the address. Save, then Apply.

Edit Host Override dialog
Host override: the name resolves to the firewall (10.0.1.1).
2

Add the real server

Services › HAProxy › Settings › Real Servers → Add. Name apex.pride.improwised.dev, Type static, FQDN or IP 10.0.15.128, Port 80.

Edit Server dialog
The real server is where the application actually runs.
3

Create a backend pool

Virtual Services › Backend Pools → Add. Name apex, Mode HTTP (Layer 7), Balancing Source-IP Hash, Servers the real server from step 2.

Edit Backend Pool dialog
A pool can hold several servers; HAProxy balances across them.
4

Add a condition (ACL)

Rules & Checks › Conditions → Add. Name apex, Condition type Host matches, Host string apex.pride.improwised.dev.

Edit Condition dialog
The condition is true when the request is for this hostname.
5

Add a rule

Rules & Checks › Rules → Add. Name apex, Select conditions apex, Execute function Use specified Backend Pool, Use backend pool apex.

Edit Rule dialog
Rule = “if condition matches, send to this backend”.
6

Attach the rule to the public service

Virtual Services › Public Services → edit the public frontend (e.g. Musketeers) → add apex under Select Rules → Save → Test syntax → Apply.

Edit Public Service: select rules
The frontend evaluates its rules for every incoming request.
7

Verify

nslookup apex.pride.improwised.dev      # should return the firewall IP
curl -I http://apex.pride.improwised.dev # expect a response from the backend

Shortcut: when a gateway backend already exists

On a gateway such as musketeers3-gw, the backend and rule already exist — you only need the DNS override, a new condition, and to add that condition to the existing rule.

Gateway: add condition
Add the condition for the new host.
Gateway: add condition to existing rule
Add it to the existing gateway rule and save.

If you clone an existing server, pool, condition or rule, update every value before saving and always run Test syntax before Apply — a bad HAProxy config can take every published site offline.

IPv6 with NAT64 & DNS64 on OPNsense

Advanced~45 minOPNsenseTaygaUnbound

Goal

  • Give a VLAN IPv6 addresses (static gateway + DHCPv6).
  • Let IPv6 clients reach the IPv4 internet through NAT64 (Tayga) and DNS64 — even without IPv6 from your ISP.
Why IPv6?2¹²⁸ addresses instead of 2³², no NAT needed, and IPsec support built in.
Prefix delegationAsk your ISP for an IPv6 prefix (e.g. a /56) and split it into /64s per VLAN. Without one, use a Unique Local prefix such as fd4a:5c4b:23ab::/48.
NAT64Translates IPv6 packets addressed to 64:ff9b::/96 into IPv4 and back.
DNS64Builds fake AAAA records by embedding an IPv4 address in 64:ff9b::/96 so clients send traffic to NAT64.
1

Install the Tayga plugin

System › Firmware › Plugins → search tayga → install os-tayga.

os-tayga plugin installed
os-tayga provides NAT64 on OPNsense.
2

Give the VLAN a static IPv6 address

Interfaces › [vlan_12] → IPv6 Configuration Type Static IPv6 → address fd4a:5c4b:23ab:10::1 / 64.

VLAN interface settings
Interface general settings.
Static IPv6 configuration
Static IPv6 address and /64 prefix.
3

Hand out addresses with DHCPv6 (and/or Router Advertisements)

Services › ISC DHCPv6 › [vlan_12] → enable → range fd4a:5c4b:23ab:10::100 to ::200. Configure Services › Router Advertisements so clients learn the gateway (and can use SLAAC).

DHCPv6 settings for vlan_12
DHCPv6 range on the VLAN.
4

Firewall rules, normalisation and outbound NAT for Tayga

Allow traffic on the Tayga interface, add a normalisation (scrub) rule for it, and add an outbound NAT rule so Tayga's internal IPv4 pool is translated to your WAN address.

Firewall rules for Tayga
Firewall › Rules › Tayga.
Normalization rule
Firewall › Settings › Normalization.
Outbound NAT rule
Firewall › NAT › Outbound — NAT the Tayga pool out of WAN.
5

Enable DNS64 in Unbound

Services › Unbound DNS › General → enable DNS64 support.

Unbound DNS general settings with DNS64
Unbound with DNS64 enabled.

Without IPv6 from your ISP, sites that already have real AAAA records would fail (there is no IPv6 route out). Fix it by synthesising every answer through NAT64 — SSH into OPNsense and create:

vi /usr/local/etc/unbound.opnsense.d/dns64.conf
server:
    module-config: "dns64 validator iterator"
    dns64-prefix: 64:ff9b::/96
    dns64-synthall: yes
    dns64-ignore-aaaa: yes

Then restart Unbound.

6

Test

From an IPv6-only client, an IPv4-only site should resolve to a 64:ff9b::… address and be reachable.

dig AAAA ipv4only.arpa +short      # expect 64:ff9b::c000:aa / ::c000:ab
traceroute6 64:ff9b::8.8.8.8
curl -6 -I https://example.com
Trace route through NAT64
Interfaces › Diagnostics › Trace Route via 64:ff9b:: prefix.
Original: IPv6 PDF · Quiz: IPv6 questions

Minimal Debian desktop

Beginner~40 minDebianGNOME

Goal

  • Install Debian with no extra bloat — just standard system utilities.
  • Add a minimal GNOME desktop, working network management and sudo.
1

Prepare the installer

Download the ISO from debian.org/distrib, write it to a USB stick (Rufus, balenaEtcher or dd), and boot from it using the boot menu key (often F2, F12 or Del).

# Linux: write the ISO to a USB stick (check the device with lsblk first!)
sudo dd if=debian-*.iso of=/dev/sdX bs=4M status=progress oflag=sync
2

Start the installer and set the basics

Choose Install, set a hostname, a root password, then create your user account and its password.

Debian installer menu
Select Install.
Hostname
Give the machine a hostname.
Root password
Root password.
User account
Your user account.
3

Partition manually

Choose Manual partitioning. A simple UEFI layout: a small EFI System Partition and an ext4 root (/). Add swap if you have little RAM. Then Finish partitioning and write changes to disk.

Manual partitioning
Select manual partitioning.
Partition layout
ESP + ext4 root, then finish.
4

Package manager and software selection

Pick your country's mirror (e.g. India) with archive deb.debian.org. In Software selection, untick everything except standard system utilities.

Debian archive mirror
Mirror: deb.debian.org.
Software selection
Only “standard system utilities”.
5

Install a minimal GNOME desktop

Log in, become root with su -, and install just the pieces you need — --no-install-recommends keeps optional extras out:

su -
apt install --no-install-recommends gdm3 git sudo gnome-terminal gnome-session \
  gnome-control-center gnome-shell gnome-text-editor gnome-music nautilus \
  firmware-linux gnome-tweaks xdg-user-dirs evince totem firefox-esr network-manager-gnome
reboot
6

Let NetworkManager manage the network

The installer configured the NIC in /etc/network/interfaces, so NetworkManager ignores it. Set managed=true:

su -
nano /etc/NetworkManager/NetworkManager.conf
#   [ifupdown]
#   managed=true
systemctl restart NetworkManager
NetworkManager.conf managed=true
Change managed=false to true.
7

Configure sudo

Add your user to the sudo group and edit the policy with visudo (it checks syntax before saving). The original notes limit the group to package management only:

su -
usermod -aG sudo <your-user>
visudo
#   %sudo   ALL=(ALL:ALL) /bin/apt     # only apt allowed
#   %sudo   ALL=(ALL:ALL) ALL          # (default) full admin rights
sudoers file
Restricting the sudo group to /bin/apt — a nice least-privilege example.
Original: Word doc

Recover data from QNAP RAID 5 on a Linux PC

Advanced~30 min + copy timemdadmLVM

Scenario

  • A QNAP NAS has died. Its disks were a 3-disk RAID 5 (one member already missing — array state .AA).
  • QNAP uses Linux software RAID (md) with LVM on top, so any Linux PC can read the disks.

Golden rules: never run mdadm --create or mkfs on these disks, mount everything read-only, and if a disk is failing, clone it with ddrescue first and work on the copy.

1

Identify the disks and data partitions

QNAP keeps data on partition 3 of each disk (/dev/sda3, /dev/sdb3…).

sudo fdisk -l
lsblk -o NAME,SIZE,TYPE,FSTYPE
2

Examine the RAID superblocks

sudo mdadm --examine /dev/sda3 /dev/sdb3 /dev/sdc3
FieldExampleWhat it tells you
Raid Level / Devicesraid5 · 3RAID 5 across 3 members
Array UUID14c29707:…Must be identical on every member
Array State.AAA = active, . = missing → running degraded
Events6959926Members with the highest, matching count are the freshest
ChecksumcorrectSuperblock is intact
3

Assemble the array (degraded is OK)

--run starts the array even though a member is missing.

sudo mdadm --assemble --run /dev/md2 /dev/sda3 /dev/sdb3 /dev/sdd3
sudo mdadm --detail /dev/md2     # State: clean, degraded
4

Activate the LVM volumes

sudo vgscan
sudo vgchange -ay
sudo lvscan        # check which LVs are ACTIVE
sudo lvdisplay
sudo lvs vg2       # sizes and usage
5

Identify filesystems and mount read-only

sudo blkid /dev/vg2/lv2 /dev/vg2/lv3 /dev/vg2/lv4
sudo mkdir -p /mnt/lv2 /mnt/lv3 /mnt/lv4
sudo mount -t ext4 -o ro /dev/vg2/lv3 /mnt/lv3
6

Copy the data off

sudo rsync -aHAX --info=progress2 /mnt/lv3/ /backup/qnap-lv3/

When finished: sudo umount /mnt/lv3 && sudo vgchange -an vg2 && sudo mdadm --stop /dev/md2.

This is exactly why RAID is not a backup: a degraded RAID 5 has no redundancy left. Follow the 3-2-1 rule so a dead NAS is an inconvenience, not a disaster.

Original: Word doc

Kubernetes on Talos Linux

Advanced~2 hoursTalos v1.7ProxmoxFlux

Goal

  • Build a Kubernetes cluster on Talos VMs in Proxmox: control-plane nodes plus workers.
  • Bootstrap it, add GitOps with Flux, and know how to recover etcd.

Why Talos?

SecureNo passwords, no SSH, no shell. All traffic is mutually authenticated; certificates are short-lived and auto-rotated.
MinimalOnly what Kubernetes needs — a much smaller attack surface.
DeclarativeThe whole node is defined in one YAML machine config, applied through an API.
ImmutableRuns from a read-only SquashFS image; the OS itself is never modified.
Talos cluster architecture
Three control-plane VMs (apid, machined, etcd, API server) on Proxmox hosts plus two physical workers, all managed with talosctl.
1

Create the VMs

In Proxmox: Create VM → ISO talos-v1.7.4-metal-amd64.iso → disk 256 GB on local-lvm → 8 cores → 24 GB RAM → start. Physical machines boot the same ISO from USB.

2

Install talosctl and generate configs

sudo pacman -S talosctl          # Arch/Garuda; see docs for other OSes
talosctl gen config <cluster_name> https://<NODE_IP>:6443 --output-dir _out
# creates _out/controlplane.yaml, _out/worker.yaml and _out/talosconfig

Edit the YAML as needed: hostname, install disk, extra kernel modules and udev rules (e.g. for a Google Coral TPU).

3

Apply the control-plane config

talosctl apply-config --insecure --nodes <NODE_IP> --file _out/controlplane.yaml

export TALOSCONFIG="_out/talosconfig"
talosctl config endpoint <NODE_IP>
talosctl config node <NODE_IP>
4

Bootstrap etcd and get a kubeconfig

After 2–3 minutes the console asks you to bootstrap. Run it once, on the first control-plane node only:

talosctl bootstrap          # takes 4–5 minutes
talosctl kubeconfig .       # writes ./kubeconfig
kubectl get nodes
Talos console showing healthy node
Healthy node: stage Running, Kubelet and API server Healthy.
5

Join workers and extra control planes

talosctl -n <ANOTHER_NODE_IP> disks       # find the install disk first
talosctl apply-config --insecure --nodes <ANOTHER_NODE_IP> --file _out/worker.yaml
# extra masters: same controlplane.yaml, but change machine.network.hostname each time
6

Add system extensions (e.g. gasket driver)

Extensions are baked into a custom installer image from the Talos Image Factory:

talosctl upgrade --image factory.talos.dev/installer/<schematic-id>:v1.7.4 --preserve
talosctl -n <NODE_IP> read /proc/modules | grep -E "gasket|apex"
7

GitOps with Flux

flux install --components-extra="image-reflector-controller,image-automation-controller" --export > flux-crds.yaml
kubectl apply -f flux-crds.yaml

flux create secret git github-auth --url=ssh://git@github.com/<org>/<repo> \
  --ssh-key-algorithm=ed25519 --export > github-auth-sec.yaml
kubectl apply -f github-auth-sec.yaml

Then add the GitRepository, Kustomizations and HelmRepositories, followed by storage (NFS storage class), monitoring (Prometheus, Grafana, Loki, Robusta, Uptime Kuma) and finally the apps.

Repository layout

cluster/
├── action-runner-controller/   # GitHub Actions self-hosted runners + autoscaler
├── cert-manager/               # ClusterIssuers (prod / staging)
├── flux-system/                # GitRepository, HelmRepositories, Kustomizations
├── ingress-nginx/
├── kube-system/                # registry credentials
├── monitoring/                 # grafana, loki, prometheus, robusta
└── <app_name>/
    ├── _namespace.yaml
    ├── <app>-configmap.yaml  ·  <app>-secret.yaml
    ├── <app>-helmrelease.yaml ·  <app>-db-helmrelease.yaml
    └── README.md

Migrating apps from an old cluster

  1. Back up app data with restic (apps on NFS/local-path storage).
  2. In k9s, scale StatefulSets and Deployments to 0 (: sts → s), then delete the old nodes.
  3. Rebuild the nodes with Talos, bootstrap, install Flux and storage, then restore data with restic and re-apply the apps.

Recovery: reset a node and restore etcd

export TALOSCONFIG=~/Downloads/talosconfig
talosctl -n <NODE_IP> reset
talosctl -n <NODE_IP> apply-config -f controlplane.yaml --insecure
talosctl -n <NODE_IP> bootstrap --recover-from etcd/member/snap/<snapshot>.snap
talosctl -n <NODE_IP> reset --system-labels-to-wipe=EPHEMERAL --graceful=false   # reset etcd state

talosconfig is an admin credential for the whole cluster — store it in a password manager or vault, never in Git.

Original: Talos PDF · Background: Kubernetes essentials

Enroll a host in Fleet (osquery)

Beginner~10 minFleetosquery

Goal

  • Install the Fleet agent (fleetd / osquery) on a Linux host so it appears in Fleet for inventory, queries and policies.
1

Download fleetctl

curl -LO https://github.com/fleetdm/fleet/releases/download/fleet-v4.75.1/fleetctl_v4.75.1_linux_amd64.tar.gz
tar xzf fleetctl_v4.75.1_linux_amd64.tar.gz
cd fleetctl_v4.75.1_linux_amd64
2

Get the certificate and enroll secret

In Fleet: Hosts › Add hosts › Advanced → download fleet.pem. Find the right secret under Manage enroll secret.

The enroll secret lets any machine join your Fleet. Don't paste it into screenshots, chats or shell history — read it from a variable.

3

Build and install the package

read -rs FLEET_SECRET                # paste the enroll secret (not echoed)
./fleetctl package --type=pkg.tar.zst \
  --fleet-url=https://<fleet-server> \
  --enroll-secret="$FLEET_SECRET" \
  --fleet-certificate=./fleet.pem
sudo pacman -U fleet-osquery-*.pkg.tar.zst   # use --type=deb / rpm / msi / pkg on other systems
4

Verify

The host shows as Online in the host list within a minute or two.

Fleet hosts list showing online hosts
Enrolled hosts with OS and osquery version.
Original: fleetd PDF

Fix the “obsolete sss_ssh_knownhostsproxy” SSH error

Beginner~5 minSSHSSSD / FreeIPA

Symptom

Your system is configured to use the obsolete tool sss_ssh_knownhostsproxy.
Please read the sss_ssh_knownhosts(1) man page to learn about its replacement.

Cause

Hosts enrolled in FreeIPA get an SSH client config that uses SSSD to look up host keys. Newer SSSD versions replaced the ProxyCommand helper with KnownHostsCommand.

1

Edit the SSH client config

sudo -e /etc/ssh/ssh_config      # or the IPA drop-in in /etc/ssh/ssh_config.d/
2

Swap the directive

# ProxyCommand /usr/bin/sss_ssh_knownhostsproxy -p %p %h
KnownHostsCommand /usr/bin/sss_ssh_knownhosts %H
3

Verify

ssh -G <host> | grep -i knownhostscommand
ssh <user>@<host>
Original: SSH error PDF
Library

Original documents

The source files these labs were written from. Word files download; PDFs open in a new tab.