aboutsummaryrefslogtreecommitdiff
path: root/tftp
diff options
context:
space:
mode:
authorAleksa Vuckovic <aleksa@vuckovic.cc>2023-12-13 01:38:14 +0100
committerAleksa Vuckovic <aleksa@vuckovic.cc>2024-04-02 23:17:31 +0200
commit36137438446c1754a522c5b3cc3aff92c43ac1ee (patch)
treef7358ef0aec7023321e52e116f94fba95e52611f /tftp
Initial commitHEADmaster
X86/X86_64 debug/release WORKING riscv64 WORKING uart idk
Diffstat (limited to 'tftp')
-rw-r--r--tftp/dnsmasq.conf20
-rw-r--r--tftp/dnsmasq.service20
-rwxr-xr-xtftp/setup.sh15
3 files changed, 55 insertions, 0 deletions
diff --git a/tftp/dnsmasq.conf b/tftp/dnsmasq.conf
new file mode 100644
index 0000000..01a1782
--- /dev/null
+++ b/tftp/dnsmasq.conf
@@ -0,0 +1,20 @@
+interface=enp7s0
+bind-interfaces
+domain=example.org
+dhcp-option=3,0.0.0.0
+dhcp-option=6,0.0.0.0
+dhcp-option=121,192.168.111.0/24,192.168.111.1
+dhcp-range=192.168.111.50,192.168.111.100,5m
+dhcp-range=::f,::ff,constructor:enp7s0
+dhcp-host=30:85:a9:88:61:0e,192.168.111.69
+
+enable-tftp
+tftp-root=/srv/tftp
+
+dhcp-match=set:efi-x86_64,option:client-arch,7
+dhcp-match=set:efi-x86_64,option:client-arch,9
+dhcp-match=set:efi-x86,option:client-arch,6
+dhcp-match=set:bios,option:client-arch,0
+dhcp-boot=tag:efi-x86_64,boot/grub/x86_64-efi/core.efi
+dhcp-boot=tag:efi-x86,boot/grub/i386-efi/core.efi
+dhcp-boot=tag:bios,boot/grub/i386-pc/core.0
diff --git a/tftp/dnsmasq.service b/tftp/dnsmasq.service
new file mode 100644
index 0000000..c30c334
--- /dev/null
+++ b/tftp/dnsmasq.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=dnsmasq - A lightweight DHCP and caching DNS server
+Documentation=man:dnsmasq(8)
+After=network.target
+Before=network-online.target nss-lookup.target
+Wants=nss-lookup.target
+
+[Service]
+Type=dbus
+BusName=uk.org.thekelleys.dnsmasq
+ExecStartPre=/usr/bin/dnsmasq --test
+ExecStartPre=/home/aleksa/mygit/myrustkernel/tftp/setup.sh
+ExecStart=/usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file
+ExecReload=/bin/kill -HUP $MAINPID
+Restart=on-failure
+PrivateDevices=true
+ProtectSystem=full
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tftp/setup.sh b/tftp/setup.sh
new file mode 100755
index 0000000..7e1737c
--- /dev/null
+++ b/tftp/setup.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+INTERFACE="enp7s0"
+IP_ADDRESS="192.168.111.1/24"
+
+if ! ip addr show dev $INTERFACE | grep -q "$IP_ADDRESS"; then
+ sudo nmcli dev set $INTERFACE managed no
+ sudo ip link set $INTERFACE up
+ sudo ip addr add $IP_ADDRESS dev $INTERFACE
+ sudo systemctl restart dnsmasq
+ echo "Configuration applied successfully."
+else
+ echo "IP address $IP_ADDRESS is already assigned to $INTERFACE."
+ echo "No changes made."
+fi