Quick Fix: Stabilizing Pi-hole USB NIC Flapping (Realtek r8152)

This is the TL;DR version.
For the full background and debugging steps, check out Fixing PiHole USB NIC Flapping.

If your Pi-hole + Tailscale box randomly drops off the network and you see this in dmesg:

r8152 1-1.4:1.0 eth0: carrier off
r8152 1-1.4:1.0 eth0: carrier on

…it means your Realtek r8152 USB NIC is flapping. These steps make it persistent and stable.


sudo nmcli connection modify "Wired connection 1" \
  ethernet.auto-negotiate no \
  ethernet.speed 100 \
  ethernet.duplex full

sudo nmcli connection down "Wired connection 1"
sudo nmcli connection up "Wired connection 1"

Check:

ethtool eth0 | grep -E 'Speed|Duplex|Auto-negotiation'

Step 2 — Disable Energy Efficient Ethernet (EEE)

sudo ethtool --set-eee eth0 eee off
ethtool --show-eee eth0

Make it permanent:

echo 'options r8152 eee_enable=0' | sudo tee /etc/modprobe.d/r8152.conf
sudo update-initramfs -u

Step 3 — Disable USB Autosuspend

printf '%s\n' 'ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8152", \
  TEST=="power/control", ATTR{power/control}="on"' | \
  sudo tee /etc/udev/rules.d/99-r8152-no-autosuspend.rules

sudo udevadm control --reload
sudo udevadm trigger

Step 4 — Monitor Stability

dmesg | grep -c "r8152 .* eth0: carrier"
sudo dmesg --follow | grep r8152

Summary

If you’re seeing random dropouts on a Pi-hole or Tailscale box with a Realtek r8152 USB NIC, the quick fix is:

  1. Force 100 Mbps full-duplex and disable autonegotiation.
  2. Disable EEE.
  3. Turn off USB autosuspend.

This stabilizes the NIC and keeps DNS + Tailscale online without random interruptions.