diff --git a/config/networkmanager/01-homelab.conf b/config/networkmanager/01-homelab.conf new file mode 100644 index 0000000..47376fe --- /dev/null +++ b/config/networkmanager/01-homelab.conf @@ -0,0 +1,22 @@ +# NetworkManager configuration for homelab server +# Deploy: sudo cp config/networkmanager/01-homelab.conf /etc/NetworkManager/conf.d/ + +[main] +# Use internal DHCP client for faster startup +dhcp=internal + +# Don't manage /etc/resolv.conf to avoid DNS issues +dns=none + +[logging] +# Reduce log verbosity +level=WARN + +[connection] +# Ensure ethernet has priority over WiFi +ethernet.cloned-mac-address=preserve + +[device] +# Disable WiFi power saving +wifi.powersave=2 +wifi.scan-rand-mac-address=no \ No newline at end of file diff --git a/config/networkmanager/99-disable-wifi-powersave.conf b/config/networkmanager/99-disable-wifi-powersave.conf new file mode 100644 index 0000000..8bcd58a --- /dev/null +++ b/config/networkmanager/99-disable-wifi-powersave.conf @@ -0,0 +1,15 @@ +# NetworkManager configuration to disable power management +# Prevents network from sleeping and causing SSH lockout +# Deploy: sudo cp config/networkmanager/99-disable-wifi-powersave.conf /etc/NetworkManager/conf.d/ + +[connection] +# Keep connections active during system sleep/suspend +connection.autoconnect-slaves=1 + +[device] +# Disable WiFi power saving to prevent connection drops +wifi.powersave=2 + +[main] +# Prevent NetworkManager from managing suspend/resume +no-auto-default=* \ No newline at end of file diff --git a/config/systemd/01-server-logind.conf b/config/systemd/01-server-logind.conf new file mode 100644 index 0000000..53d2fdc --- /dev/null +++ b/config/systemd/01-server-logind.conf @@ -0,0 +1,14 @@ +# systemd logind configuration for headless server operation +# Deploy: sudo cp config/systemd/01-server-logind.conf /etc/systemd/logind.conf.d/ + +[Login] +# Disable all power management triggers for headless server +HandleLidSwitch=ignore +HandleLidSwitchExternalPower=ignore +HandleLidSwitchDocked=ignore + +# Prevent automatic suspend/hibernate +IdleAction=ignore + +# Keep the system running even when no users are logged in +KillUserProcesses=no \ No newline at end of file diff --git a/docs/network-security.md b/docs/network-security.md index 958952d..e6d735a 100644 --- a/docs/network-security.md +++ b/docs/network-security.md @@ -443,6 +443,80 @@ ip link set wlp2s0 master br0 - External: ak-homelab.duckdns.org ✅ - SSH: Port 2222 ✅ +## Network Boot Issues Troubleshooting + +### Problem 1: Network not available after reboot until GUI login + +**Initial diagnosis**: Thought to be NetworkManager sleep behavior. + +**Actual root cause**: System auto-suspend due to closed laptop lid (`HandleLidSwitch=suspend`). + +**Symptoms**: +- SSH inaccessible after reboot +- Network comes up only when laptop lid is opened +- System logs show "Suspending..." followed by "Lid opened" + +**Solution Applied**: +1. **systemd-logind configuration**: Disable lid switch handling for headless server operation +2. **Static IP configuration**: Eliminate DHCP negotiation delays +3. **High connection priority**: Ensure ethernet connects first + +**Configuration files created**: + +`/etc/systemd/logind.conf.d/01-server-logind.conf`: +```ini +[Login] +# Disable all power management triggers for headless server +HandleLidSwitch=ignore +HandleLidSwitchExternalPower=ignore +HandleLidSwitchDocked=ignore + +# Prevent automatic suspend/hibernate +IdleAction=ignore + +# Keep system running even when no users logged in +KillUserProcesses=no +``` + +**NetworkManager commands**: +```bash +nmcli connection modify "Wired connection 2" connection.autoconnect-priority 10 +nmcli connection modify "Wired connection 2" ipv4.method manual ipv4.addresses 192.168.0.100/24 ipv4.gateway 192.168.0.1 ipv4.dns "84.2.44.8 84.2.46.8" +``` + +**Deployment**: +```bash +sudo cp config/systemd/01-server-logind.conf /etc/systemd/logind.conf.d/ +sudo systemctl restart systemd-logind +sudo cp config/networkmanager/01-homelab.conf /etc/NetworkManager/conf.d/ +sudo systemctl reload NetworkManager +``` + +### Diagnostic Commands + +**Check system power state**: +```bash +systemctl status systemd-logind # Check for suspend/lid events +loginctl show-session # Current power management settings +``` + +**Check network connectivity**: +```bash +systemctl status NetworkManager +nmcli device status +nmcli connection show "Wired connection 2" +ip addr show enp4s0 +``` + +**Monitor boot process**: +```bash +journalctl -b -u NetworkManager # Network startup logs +journalctl -b -u sshd # SSH service logs +journalctl -b -u systemd-logind # Power management events +``` + +**Result**: ✅ **RESOLVED** - SSH accessible immediately on boot, lid closure no longer suspends system. + **Network Interface Identification:** - **enp3s0f0**: First ethernet port (98:fa:9b:f1:06:d5) - **enp4s0**: Second ethernet port (98:fa:9b:f1:06:d4) ← **Use this one**