@Murphy5156 @mr_ggg dn @everybody else who is a victim of the Big Sur ethernet bug. Below is not a fix but rather an automated workaround. The first script will install a launchDaemon and a watchdog script that probes the ethernet interface every 45 seconds and restarts it if it's unresponsive. The second script will uninstall the watchdog script and launchDaemon in case Apple ever gets their stuff together and the workaround is no longer needed. You will know everything works if the file /tmp/restart_en0.log is current and ends in "en0 alive".
Please note that the scripts will require your normal login password so that it can install the system-level launchDaemon and watchdog script, as the ethernet interface can only be restarted at system-level. (the sudo command is what will prompt for the password, and should only happen once per Terminal session)
To use:
1. Open Terminal (Applications - Utilities - Terminal.app)
2. Select and copy the content of the first script below
3. Enter the following command in Terminal (you can copy and paste from here):
cat > install_en0_watchdog_service.sh
4. Paste in the terminal window the just copied script
5. Press control-D (press and hold the key control, then briefly press D and release both keys)
6. Enter the following command in Terminal (you can copy and paste from here):
chmod 755 install_en0_watchdog_service.sh
7. Select and copy the content of the second script below
8. Enter the following command in Terminal (you can copy and paste from here):
cat > uninstall_en0_watchdog_service.sh
9. Paste in the terminal window the just copied script
10. Press control-D (press and hold the key control, then briefly press D and release both keys)
11. Enter the following command in Terminal (you can copy and paste from here):
chmod 755 uninstall_en0_watchdog_service.sh
12. Execute the installation script by entering the following command in Terminal (you can copy and paste from here):
./install_en0_watchdog_service.sh
13. If you ever want to uninstall the watchdog script and launchDaemon, open Terminal and enter the following command (you can copy and paste from here):
./uninstall_en0_watchdog_service.sh
First script: install_en0_watchdog_service.sh -- copy starting with # symbol below
#!/bin/bash
#### creating watchdog script
script="/Users/`whoami`/bin/restart_en0.sh"
mkdir "/Users/`whoami`/bin" 2> /dev/null
sudo chown `whoami` $script 2> /dev/null
cat <<TAG2 > $script
#!/bin/bash
(
gw=\`/sbin/route -n get 8.8.4.4 | /usr/bin/grep gateway | /usr/bin/awk '{print \$2}'\`
/sbin/ping -c 1 -t 5 -b en0 \$gw && /bin/echo en0 alive || ( /sbin/ifconfig en0 down && /sbin/ifconfig en0 up )
) &> /tmp/restart_en0.log
TAG2
chmod 755 $script
sudo chown root:wheel $script
### creating launchdaemon that will run watchdog script every 45 seconds
cat <<TAG1 > com.example.restart_en0.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.restart_en0</string>
<key>ProgramArguments</key>
<array>
<string>$script</string>
</array>
<key>StartInterval</key>
<integer>45</integer>
</dict>
</plist>
TAG1
sudo mv com.example.restart_en0.plist /Library/LaunchDaemons/
sudo chown root:wheel /Library/LaunchDaemons/com.example.restart_en0.plist
### (re)starting launchdaemon that was just created
sudo launchctl unload /Library/LaunchDaemons/com.example.restart_en0.plist
sudo launchctl load /Library/Launchdaemons/com.example.restart_en0.plist
### stop your selection above this line
Second script: uninstall_en0_watchdog_service.sh -- copy starting with # symbol below
#!/bin/bash
### unloading launchdaemon
sudo launchctl unload /Library/LaunchDaemons/com.example.restart_en0.plist
### deleting launchdaemon
sudo rm /Library/LaunchDaemons/com.example.restart_en0.plist
### deleting watchdog script
sudo rm /Users/`whoami`/bin/restart_en0.sh
### stop your selection above this line