Files
scripts/quest/setup-network-noNetworkManager.sh
2026-07-09 19:05:48 -04:00

42 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Ensure the script is run as root
if [ "$EUID" -ne 0 ]; then
echo "[-] Please run as root (su)"
exit 1
fi
read -rp "Wireless interface (usually wlan0 or wlan1): " IFACE
# 1. Clean up old processes
echo "[*] Cleaning up old processes..."
killall hostapd 2>/dev/null
# 2. Hard reset the wireless interface
echo "[*] Resetting interface $IFACE..."
ip link set "$IFACE" down 2>/dev/null
ip addr flush dev "$IFACE" 2>/dev/null
rfkill unblock wifi 2>/dev/null # Clear any software blocks
sleep 1 # Give hardware a moment to settle
ip link set "$IFACE" up
ip addr add 192.168.38.1/24 dev "$IFACE"
# 3. Create an OPEN hostapd configuration (No WPA/encryption)
echo "[*] Creating OPEN hostapd configuration..."
cat <<EOF > /tmp/hostapd.conf
interface=$IFACE
driver=nl80211
ssid=pihotspot
hw_mode=g
channel=6
auth_algs=1
EOF
# 4. Start the Access Point
echo "[*] Starting hostapd in the background..."
hostapd -B /tmp/hostapd.conf
echo "[+] Open Hotspot 'pihotspot' is up and reset!"
echo "[+] NetHunter IP: 192.168.38.1"
echo "[*] Ensure your Quest 2 static IP is in the 192.168.38.X range (but not .1)"