Commit 826c0673 authored by Lu Xu's avatar Lu Xu 👀

add dnsmasq_lille.sh

parent 7f78c954
#!/bin/sh
set -e
SCRIPT_DIR=$(realpath `dirname "$0"`)
. $SCRIPT_DIR/download_boot_systems.sh
download_debian_10_if_needed
#download_sysrescuecd_if_needed
#UPDATE THOSE VARIABLES DEPENDING ON YOUR SITE
MY_IF_NAME=eth0
MY_IP_ADDR=192.168.46.2
DHCP_RANGE=192.168.46.100,static
ROUTER_ADDR=192.168.46.2
DNS_SERVER=8.8.8.8
common=console=ttyS1,57600
(
cat <<EOF
if [ \$net_default_mac=7c:fe:90:43:80:a6 ];
then
set hostname=lille-edu-leopard-000
set interface=ens1
elif [ \$net_default_mac=00:22:4d:d9:0a:aa ];
then
set hostname=lille-edu-tiogapass-001
set interface=ens9
elif [ \$net_default_mac=00:22:4d:da:ca:87 ];
then
set hostname=lille-edu-capri-001
set interface=ens9
elif [ \$net_default_mac=00:22:4d:da:ca:a7 ];
then
set hostname=lille-edu-capri-002
set inteface=ens9
fi
unset timeout
menuentry 'Debian Installer' {
linux /debian-installer/amd64/linux vga=788 url=tftp://\$pxe_default_server/preseed_lille.cfg language=C country=FR keymap=fr hostname=\$hostname domain= interface=\$interface --- mitigations=off $common
initrd /debian-installer/amd64/initrd.gz
}
menuentry 'SystemRescueCd' {
linux /sysresccd/sysresccd/boot/x86_64/vmlinuz archisobasedir=sysresccd archiso_http_srv=http://\$pxe_default_server:69/sysresccd/ checksum ip=dhcp $common
initrd /sysresccd/sysresccd/boot/intel_ucode.img /sysresccd/sysresccd/boot/amd_ucode.img /sysresccd/sysresccd/boot/x86_64/sysresccd.img
}
menuentry 'Exit' {
exit
}
EOF
) >debian-installer/amd64/grub/grub.cfg
for hostname in lille-edu-leopard-000 lille-edu-tiogapass-001 lille-edu-capri-001 lille-edu-capri-002
do
mkdir -p $hostname
cat > $hostname/interfaces <<EOF
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eno1
iface eno1 inet dhcp
allow-hotplug ens9
iface ens9 inet dhcp
EOF
done
exec dnsmasq -d --port=0 --log-dhcp \
--interface=$MY_IF_NAME \
--bind-interfaces \
--except-interface=lo \
--listen-address=$MY_IP_ADDR \
--dhcp-range=$DHCP_RANGE \
--dhcp-option=option:router,$ROUTER_ADDR \
--dhcp-option=option:dns-server,$DNS_SERVER \
--dhcp-boot=debian-installer/amd64/grubx64.efi \
--enable-tftp --tftp-root=$(realpath `dirname "$0"`) \
--conf-file=/dev/null \
--dhcp-host=7c:fe:90:43:80:a8,192.168.46.100,1h \
--dhcp-host=7c:fe:90:43:80:a6,192.168.46.102,1h
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment