myesn

myEsn2E9

hi
github

Wake up Mac Pro laptop (Ubuntu system) remotely from Windows system.

First, determine the network card device that is connected to the network. The following steps are for checking the hardware of a wired network card:

  1. Enter ifconfig to view the IP, name, and MAC address of the wired network card. My wired network card has an IP of 192.168.31.117, the name is enp2s0f0, and the MAC address is 3C-07-54-77-24-73.
  2. Enter sudo ethtool enp2s0f0 to print out the information of the network card and copy the output to a notepad.
  3. In the notepad, search for the following configuration:
    Supports Wake-on: g
    Wake-on: d
    

The value of Supports Wake-on is g, which means the network card supports remote wake-up. If it is d, it does not support.
The value of Wake-on is g, which means the network card has enabled the remote wake-up function. If it is d, enter the command sudo ethtool --change enp2s0f0 wol g to enable it (this command is temporary and will be invalid after restarting, there will be a solution later). enp2s0f0 is the name of my wired network card.
4. Enter sudo ethtool enp2s0f0 again to print out the information of the network card and check if the Wake-on value is g.
5. Enter sudo systemctl suspend to put the system into sleep mode. After the computer sleeps, it cannot be pinged.
6. Open https://www.nirsoft.net/utils/wake_on_lan.html#DownloadLinks in a browser on Windows and click on "Download WakeMeOnLan (64-bit)" to download the remote wake-up software for Windows.
7. After downloading, extract the files and enter the extracted directory. Double-click on WakeMeOnLan.exe and click on "File > Add New Computer" to add the IP and MAC address of the Ubuntu system. Fill in the other two items with a display name and click OK.
8. In the WakeMeOnLan software, right-click on the newly added computer and click on "Wake Up Selected Computers". A pop-up window will appear, click Yes. After a while, you will notice that the computer that was just asleep can now be pinged.
9. The following steps are to make the remote wake-up function persistent. They are all performed on the Ubuntu system that was just asleep. The principle is to create and enable a network wake-up service.
10. Enter which ethtool to get the disk path of the ethtool software. In my case, it is /usr/sbin/ethtool.
11. Create a file in the following path: sudo nano /etc/systemd/system/wol.service, then paste the following content into it:

[Unit]
Description=Enable Wake On Lan

[Service]
Type=oneshot
ExecStart = /sbin/ethtool --change enp4s0 wol g

[Install]
WantedBy=basic.target

Note: Replace the path of the ethtool software and the name of the enp4s0 network card in ExecStart = /sbin/ethtool --change enp4s0 wol g with the actual values. After replacing, it becomes ExecStart = /usr/sbin/ethtool --change enp2s0f0 wol g. Then save and exit.
12. Enable and check the service:

# enable
sudo systemctl daemon-reload
sudo systemctl enable wol.service

# check
sudo systemctl status wol

Repeat steps 5-8 to check the effect.

References:

Source: https://www.yuque.com/r/note/c6493c03-3a1d-47ab-a935-5fbc3ccd913c

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.