1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
##
## Debian-Installer NetBoot Assistant: installbox
## ================================================
##
## This example shows how to set up a machine with two NICs as an 'installbox'.
## Interface wlp1s0 is connected to the internet, enp2s0 serves the installer:
## __
## __/ \__ ┌────────────────────┐
## / \ ┌────────┐ wlp1s0 │ installbox │
## ( Internet )──┤ router ├─··········─┤di-netboot-assistant│
## \__ __/ └────────┘ └─────────┬──────────┘
## \__/ │ enp2s0
## │
## ┌─────────┴─────────┐
## │ client computer │
## │ to be installed │
## └───────────────────┘
## Install packages, stop dnsmasq and prevent it from starting at boot:
# apt install di-netboot-assistant dnsmasq nftables debian-installer-netboot-amd64
# systemctl stop dnsmasq
# systemctl disable dnsmasq
# cp /usr/share/doc/di-netboot-assistant/examples/dnsmasq.conf.simple \
# /etc/dnsmasq.d/netboot-installer
## Prepare location for debian-installer-netboot-amd64 images:
# mkdir -p /var/lib/tftpboot/d-i/n-pkg/
## Customize the following interface variable, check all following commands, and
## finally execute this file like 'sudo bash README.installbox' for a quick start.
LAN_IF="${LAN_IF:-enp2s0}"
set -ex
## Make packaged installer files available:
mount -o bind,ro /usr/lib/debian-installer/ /var/lib/tftpboot/d-i/n-pkg/
di-netboot-assistant rebuild-menu
di-netboot-assistant install daily
## Configure the netboot interface:
ip address add 192.168.0.10/24 dev $LAN_IF
ip link set $LAN_IF up
## Enable forwarding:
sysctl -w net.ipv4.ip_forward=1
## Configure masquerading:
nft add table nat
nft add chain nat prerouting { type nat hook prerouting priority 0 \; }
nft add chain nat postrouting { type nat hook postrouting priority 100 \; }
#nft add rule nat postrouting oifname $WAN_IF masquerade
nft add rule nat postrouting masquerade
## Provide DNS, DHCP and a TFTP server for the netboot clients:
systemctl start dnsmasq
##### Hints for persistent configuration:
# echo '/usr/lib/debian-installer/ /var/lib/tftpboot/d-i/n-pkg/ none bind,ro 0 0' >> /etc/fstab
# cat >> /etc/network/interfaces.d/static <<EOF
#auto enp2s0
#iface enp2s0 inet static
# address 192.168.0.10/24
#EOF
# systemctl enable dnsmasq
# echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/netboot-installer.conf
# systemctl enable nftables.service
# cp /etc/nftables.conf /etc/nftables.conf.orig
# nft list ruleset > /etc/nftables.conf
|