Skip to content

Lab · reference

What runs as root

Only one script of the lab uses sudo: lab/net.sh. QEMU, the simulated fleet and kind run as your user.

Script
lab/net.sh
Called by
mise run lab:up, mise run lab:down and mise run lab:collect (status only)
Commands as root
ip, iptables, sysctl, nft (read only), firewall-cmd
Mark
pk-metal-lab, as the alias of each interface and the comment of each rule.
Files in /etc
None.
After a reboot
No change stays.
Change Made by up Removed by down
Bridge pkbr0 with 10.77.0.1/24 Yes Yes, if it has the mark
One tap for each machine, owned by you Yes Yes, if it has the mark
net.ipv4.ip_forward=1 Only if it was off Only if up turned it on
iptables rules with the comment pk-metal-lab Yes Yes
pkbr0 in the firewalld zone trusted (runtime) Only with firewalld Yes

The rules are in firewall rules.

down removes only the things that have the mark. If a bridge or a tap with the same name has no mark, the script does not touch it. It tells you. The script records in /run/pk-metal-lab if it turned IPv4 forwarding on.

Part Runs as Reason
QEMU virtual machines You You own the taps, and /dev/kvm is usable by your user.
Simulated fleet You It listens on ports above 1024.
kind, kubectl, pk-metal You They speak to the Docker daemon and to the cluster.
Docker daemon root It is the service of the system. The lab does not start it.
  1. Read the script. It is short.

    Terminal window
    less lab/net.sh
  2. Show what exists now. This command changes nothing.

    Terminal window
    lab/net.sh status
  3. For sudo without a password, add only ip, iptables, sysctl, nft and firewall-cmd to the sudo rules.

The simulated BMCs and the media port listen on 10.77.0.1 only. The firewall rules accept input to that address from the lab bridge and from the Docker bridges only. The network of the workstation cannot get to them.