renambled dns thing

This commit is contained in:
Chris Frankland-Wright 2025-08-30 22:22:02 +01:00
parent 3c73a0487b
commit f2e2fa9c7f

View file

@ -121,12 +121,11 @@ echo "NTPD removed (if present). Chrony, NMTUI, and Adjtimex installed and confi
echo "📡 Installing and configuring WiFi hotspot and captive portal..."
if [ "$PKG_MANAGER" == "apt" ]; then
# Ensure dnsmasq is removed to prevent conflicts with nodogsplash's DHCP server.
echo "Removing dnsmasq to prevent conflicts..."
sudo apt-get remove --purge -y dnsmasq || true
# We will use dnsmasq for DHCP, as the compiled nodogsplash version may not support the internal DHCP server.
# sudo apt-get remove --purge -y dnsmasq || true # This line is no longer needed.
# Install dependencies for hotspot and for building nodogsplash. dnsmasq is no longer needed.
sudo apt install -y hostapd git libmicrohttpd-dev libjson-c-dev iptables
# Install dependencies for hotspot and for building nodogsplash.
sudo apt install -y hostapd dnsmasq git libmicrohttpd-dev libjson-c-dev iptables
# Force iptables-legacy for nodogsplash
echo "Setting iptables-legacy mode for nodogsplash..."
@ -170,7 +169,7 @@ fi
# Stop services to configure
# Ensure services exist before trying to stop them
sudo systemctl stop hostapd || true
# sudo systemctl stop dnsmasq || true # dnsmasq is no longer used
sudo systemctl stop dnsmasq || true
if command -v nodogsplash &> /dev/null; then
sudo systemctl stop nodogsplash || true
fi
@ -204,25 +203,21 @@ sudo nmcli c modify "$CON_NAME" 802-11-wireless-security.key-mgmt wpa-psk
sudo nmcli c modify "$CON_NAME" 802-11-wireless-security.psk "harry-ron-hermione"
sudo nmcli c modify "$CON_NAME" ipv4.method manual ipv4.addresses 10.0.252.1/24
# dnsmasq is no longer used. nodogsplash will handle DHCP.
# echo "Configuring dnsmasq..."
# sudo tee /etc/dnsmasq.conf > /dev/null <<EOF
# interface=wlan0
# dhcp-range=10.0.252.10,10.0.252.50,255.255.255.0,24h
# address=/#/10.0.252.1
# EOF
# Configure dnsmasq for DHCP
echo "Configuring dnsmasq..."
sudo tee /etc/dnsmasq.conf > /dev/null <<EOF
interface=wlan0
dhcp-range=10.0.252.10,10.0.252.50,255.255.255.0,24h
address=/#/10.0.252.1
EOF
# Configure nodogsplash for captive portal and DHCP
# Configure nodogsplash for captive portal
echo "Configuring nodogsplash..."
sudo tee /etc/nodogsplash/nodogsplash.conf > /dev/null <<EOF
GatewayInterface wlan0
GatewayAddress 10.0.252.1
MaxClients 250
AuthIdleTimeout 480
# Enable DHCP server in nodogsplash
DHCPInterface wlan0
DHCPStartAddress 10.0.252.10
DHCPEndAddress 10.0.252.50
FirewallRuleSet preauthenticated-users {
FirewallRule allow tcp port 80
FirewallRule allow tcp port 53
@ -253,6 +248,7 @@ done
# Check for the IP address before starting nodogsplash
if [ "$IP_CHECK" == "10.0.252.1" ]; then
echo "✅ wlan0 configured with IP $IP_CHECK."
sudo systemctl restart dnsmasq
if command -v nodogsplash &> /dev/null; then
echo "Attempting to start nodogsplash service..."
if ! sudo systemctl restart nodogsplash; then