LPI · Free Practice Questions · Last reviewed May 2026
18 real exam-style questions organised by domain, each with the correct answer highlighted and a plain-English explanation of why it's right — and why the others are wrong.
Which THREE of the following are valid Libvirt storage pool types?
ram
iscsi
Libvirt provides an iscsi storage pool type that connects to an iSCSI target and exposes its LUNs as volumes. It is a recognised pool driver, distinct from dir, fs, netfs, logical, disk, scsi, mpath, rbd, gluster and zfs.
lvm
Libvirt supports an lvm storage pool type, which carves logical volumes from a volume group as individual storage volumes. It is one of the valid pool drivers alongside dir, fs, netfs, disk, iscsi, scsi, mpath, rbd, sheepdog, gluster and zfs.
usb
dir
The dir pool type stores volumes as ordinary files within a host directory, requiring no dedicated block device or daemon. It satisfies the stem's demand for a valid Libvirt pool type, since Libvirt supports directory-backed pools natively alongside disk, fs, netfs, logical, iscsi, scsi, mpath, rbd, sheepdog, gluster and vstorage.
Which command is used to list all defined virtual networks in Libvirt?
brctl show
virsh net-list --all
`virsh net-list --all` queries the libvirt daemon and returns every network defined in the hypervisor, including inactive ones. The `--all` flag satisfies the stem's requirement to list *all* defined virtual networks, whereas the bare `virsh net-list` shows only currently active networks.
virsh domiflist
virsh list-networks
You are configuring a Xen guest that requires direct hardware access to a specific network interface card. Which configuration parameter in the guest domain configuration file must be specified to enable PCI passthrough?
pci = [ '00:1f.1' ]
The pci parameter in the guest domain configuration file lists host PCI devices to assign via passthrough, using BDF notation such as '00:1f.1'. Specifying it binds that NIC exclusively to the guest, satisfying the direct hardware access requirement.
device_pass = 'eth0'
hw_access = '00:1f.1'
vif = [ 'type=pci, bus=00:1f.1' ]
You are configuring a QEMU-KVM guest to use VirtIO-net. Which parameter in the QEMU command line correctly enables the virtio-net-pci device with a tap interface named tap0?
-device virtio-net,backend=tap0
-netdev tap,id=net0,ifname=tap0 -device virtio-net-pci,netdev=net0
The `-netdev tap` backend binds the host tap0 interface, while `-device virtio-net-pci,netdev=net0` attaches the paravirtualised NIC and links it via the matching id. This two-part split satisfies the stem's requirement to enable virtio-net-pci with a tap interface named tap0.
-netdev tap,id=tap0 -device virtio-net-pci,id=tap0
-net tap,ifname=tap0,model=virtio
When managing storage pools using virsh, which command would you use to list all defined storage pools, including those that are inactive?
virsh list-pools --inactive
virsh pool-info --all
virsh pool-show --all
virsh pool-list --all
The --all flag overrides pool-list's default behaviour of showing only active pools, causing libvirt to enumerate every defined storage pool regardless of state. Without it, inactive pools remain hidden, so this satisfies the stem's requirement to include inactive entries.
Which hypervisor type is considered 'Type 1' virtualization?
VMware Workstation
VirtualBox
Xen
Xen is a bare-metal hypervisor that runs directly on host hardware beneath guest domains, which defines Type 1. It does not require a host operating system, unlike Type 2 products such as VirtualBox or VMware Workstation.
QEMU (user mode)
Want more Full Virtualization practice?
Practice this domainYou are optimizing a Dockerfile to reduce image size. Which THREE of the following practices are recommended?
Use the FROM latest tag for all base images
Always install recommended packages for security
Remove /var/lib/apt/lists/* after installing packages
APT leaves package index caches under /var/lib/apt/lists/* after installation; deleting them in the same layer prevents that metadata persisting into the final image. This directly satisfies the image-size reduction constraint, since those cached lists are otherwise retained in the layer.
Use multi-stage builds to discard build-time dependencies
Multi-stage builds let earlier stages compile code with full toolchains, while the final stage copies only runtime artefacts, so compilers and build dependencies never enter the shipped image. This satisfies the size-reduction constraint by excluding build-time packages entirely from the final layer set.
Use a single RUN command to chain multiple commands with &&
Each RUN instruction creates a separate image layer, so chaining commands with && in one RUN produces a single layer and lets temporary files be removed before that layer is committed. This satisfies the size-reduction constraint by avoiding retained intermediate layer content.
You are troubleshooting a Docker container that cannot reach the internet despite the host having connectivity. The container uses the default bridge network. Which iptables chain is most likely causing the block?
PREROUTING
POSTROUTING
FORWARD
Docker's default bridge network routes container traffic through the host's FORWARD chain, since packets are forwarded between the bridge and the external interface. A restrictive FORWARD policy (DROP) blocks that path even though the host itself has connectivity, making FORWARD the chain responsible for the container's failed internet access.
OUTPUT
A Docker container is failing to connect to an external database despite the host being able to ping it. You suspect a bridge networking issue. Which command allows you to inspect the current NAT rules created by Docker?
docker network inspect bridge
iptables -t nat -L -n
Docker adds rules to the NAT table for port forwarding and masquerading.
ip link show docker0
sysctl -a | grep net.bridge
You need to run a container that requires access to the host's network namespace directly to perform packet capture. Which Docker run flag should you use?
--cap-add NET_ADMIN
--privileged
--net bridge
--network host
`--network host` places the container directly in the host's network namespace, so its interfaces and packet-capture capabilities are the host's own. This satisfies the stem's requirement for direct namespace access, unlike bridge or overlay networks, which isolate the container behind NAT and a separate stack.
Which Docker command is used to display the resource usage (CPU, memory) of running containers?
docker stats
docker stats streams live CPU, memory, network and block I/O metrics for each running container, refreshed continuously. This directly satisfies the requirement to display resource usage of running containers, unlike docker ps, which only lists containers without consumption figures.
docker top
docker usage
docker info
When building a Dockerfile, which instruction should be used to define the user context for subsequent RUN, CMD, and ENTRYPOINT instructions?
USER
USER sets the runtime user for all subsequent RUN, CMD and ENTRYPOINT instructions in the Dockerfile, satisfying the stem's user-context constraint. It changes the UID/GID used during build and at container start, unlike WORKDIR, which only alters the working directory.
WORKDIR
RUN useradd
AS
Want more Container Virtualization practice?
Practice this domainIn a Packer build process for OpenStack, which 'post-processor' type is typically used to upload the resulting image to the Glance image service?
manifest
shell-local
openstack
The openstack post-processor authenticates to the OpenStack APIs and uploads the built artefact to Glance, registering it as an image. It is the only post-processor type that targets Glance directly, satisfying the requirement to publish the Packer output there.
compress
When using Vagrant to manage a libvirt-based provider, which command verifies that the virtual machine is currently running and identifies the provider in use?
vagrant up
vagrant status
`vagrant status` queries the active Vagrant environment and reports each machine's state, showing "running" for the libvirt-backed VM, while the provider in use is confirmed through the environment's configuration. It satisfies both constraints in the stem: verifying the running state and identifying the libvirt provider.
vagrant validate
vagrant box list
You are configuring cloud-init to inject an SSH key into a new VM. Which directive in the configuration metadata ensures the key is added to the correct user's authorized_keys file?
users.ssh_key
ssh_keys
ssh_authorized_keys
The ssh_authorized_keys directive under the users list injects the specified public keys into that user's authorized_keys file during first boot. It satisfies the requirement to target the correct account rather than a default or root user.
authorized_keys_file
Which file in a Vagrant project directory is processed by default to define the virtual environment configuration?
settings.json
Vagrantfile
Vagrant reads the Vagrantfile in the project root automatically on every vagrant command, using Ruby syntax to declare the box, provider, networking and provisioning. No other file is parsed by default, so this is the configuration entry point the stem asks for.
provision.sh
config.yml
When defining a Vagrant network configuration for a libvirt provider, which mode allows the VM to receive an IP address directly from the physical network's DHCP server?
nat
public_network
A public_network bridges the VM's virtual NIC onto the host's physical interface, so DHCP broadcasts reach the physical network's server and the VM obtains a routable address from that subnet. This satisfies the stem's requirement for an IP assigned directly by the external DHCP server rather than by libvirt's private NAT.
forwarded_port
private_network
A cloud-init configuration file is failing to apply the 'write_files' module. Which log file on the target instance should you examine to diagnose the parsing error?
/var/log/syslog
/var/log/messages
/var/log/cloud-init.log
The cloud-init log records each module's execution and any YAML parsing errors encountered while processing user-data, including write_files failures. Examining it reveals the exact syntax or schema fault, which the instance console output and syslog do not capture in equivalent detail.
/var/log/auth.log
Want more VM Deployment And Provisioning practice?
Practice this domainThe 305-300 exam has 60 questions and must be completed in 90 minutes. Always confirm current details on the vendor's official exam page.
CLI output interpretation, network topology analysis, routing behaviour, switching concepts, troubleshooting, and configuration questions.
The exam covers 3 domains: Full Virtualization, Container Virtualization, VM Deployment And Provisioning. Questions are weighted by domain — higher-weight domains appear more on your actual exam.
No. These are original exam-style practice questions written against the official LPI 305-300 exam objectives. They are not copied from the real exam. Courseiva focuses on genuine understanding, not memorisation of braindumps.
Courseiva tracks your accuracy per domain and routes you toward weak areas automatically. Free, no account required.