diff --git a/configs/build_iso.sh b/configs/build_iso.sh
index 9cbc530d04e81921d110ba5677a6feb370139fdc..8e282d371fbb4e8194b7745887bb141762ef1930 100755
--- a/configs/build_iso.sh
+++ b/configs/build_iso.sh
@@ -2,6 +2,7 @@
 
 set -ex
 
+DEFAULT_DISTRIBUTION=bookworm
 BASEDIR=$(readlink -f "$(dirname "$0")/..")
 HOSTNAME=$1
 # Allow to define the intermediary IPXE_TARGET folder. This can pose problem
@@ -26,7 +27,10 @@ cp ${BASEDIR}/configs/template.ipxe.j2 $TEMPLATE_IPXE_TMP
 
 # Set optional value IPXE_NET directly if not provided in the yaml
 # (missing templating variable will make the j2 call fail otherwise)
-grep "IPXE_NET" $CONFIG >/dev/null || sed -i s'/{{IPXE_NET}}/net0/g' "${TEMPLATE_IPXE_TMP}"
+grep "IPXE_NET" $CONFIG >/dev/null || \
+    sed -i s'/{{IPXE_NET}}/net0/g' "${TEMPLATE_IPXE_TMP}"
+grep "DISTRIBUTION" $CONFIG >/dev/null || \
+    sed -i s"/{{DISTRIBUTION}}/${DEFAULT_DISTRIBUTION}/g" "${TEMPLATE_IPXE_TMP}"
 
 j2 -f yaml "${TEMPLATE_IPXE_TMP}" "${CONFIG}" > "${IPXE_SCRIPT}"
 
diff --git a/configs/template.ipxe.j2 b/configs/template.ipxe.j2
index 046d68f2665223f0c06c833a290a2eace095140f..69dccbf7f1068954c8e03e94655d778a9bcc9366 100644
--- a/configs/template.ipxe.j2
+++ b/configs/template.ipxe.j2
@@ -34,7 +34,7 @@ prompt --key 0x02 --timeout 2000 Installer failed... press Ctrl-B for the iPXE c
 # with today's very large certificate sizes, ipxe can't really do a TLS handshake anymore)
 
 set mirror http://deb.debian.org
-set base_path ${mirror}/debian/dists/bookworm/main/installer-amd64/current/images/netboot/debian-installer/amd64
+set base_path ${mirror}/debian/dists/{{DISTRIBUTION}}/main/installer-amd64/current/images/netboot/debian-installer/amd64
 
 set preseed_host http://preseed.internal.softwareheritage.org