In Terminal, the ip address and other information are displayed with the following command:
ip a
root@home-media:/# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 64:00:6a:c9:c9:2d brd ff:ff:ff:ff:ff:ff altname enp0s25 inet 192.168.1.94/24 brd 192.168.1.255 scope global dynamic noprefixroute eno1 valid_lft 85480sec preferred_lft 85480sec inet6 2c02:2c08:ec1c:2c00:84fc:bac:8f23:f560/64 scope global temporary dynamic valid_lft 594sec preferred_lft 594sec inet6 2a02:2f08:8b1c:c700:6600:6aff:fe56:c92d/64 scope global dynamic mngtmpaddr valid_lft 594sec preferred_lft 594sec inet6 fe80::2c00:6aff:fe56:c92d/64 scope link valid_lft forever preferred_lft forever root@home-media:/#
Mac address: 64:00:6a:c9:c9:2d and eno1 is the computer’s network interface name. To view and change the Wake-On-Lan settings, the „ethtool” package must be installed:
sudo apt install ethtool -y
Next, find out if the network card supports wake-on-LAN:
sudo ethtool eno1
Settings for eno1: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Auto-negotiation: on Port: Twisted Pair PHYAD: 1 Transceiver: internal MDI-X: on (auto) Supports Wake-on: pumbg Wake-on: d Current message level: 0x00000007 (7) drv probe link Link detected: yes root@home-media:/#
The expression Wake-on: d indicates that the wake-on-lan feature of the network card is supported but deactivated.
Run the following commands to enable wake-on-lan on your network card:
sudo ethtool -s eno1 wol g
Settings for eno1: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Auto-negotiation: on Port: Twisted Pair PHYAD: 1 Transceiver: internal MDI-X: on (auto) Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000007 (7) drv probe link Link detected: yes root@home-media:/#
To identify path of ethtool run
which ethtool
Create systemd service:
sudo --preserve-env systemctl edit --force --full wol.service
[Unit] Description=Enable Wake-up on LAN [Service] Type=oneshot ExecStart=/usr/sbin/ethtool -s eno1 wol g [Install] WantedBy=basic.target
Replace the eno1 value with your own network interface value. Then reload and enable the service:
sudo systemctl daemon-reload sudo systemctl enable wol.service
NOTE: In my case on Ubuntu 23.04 work only with script. To make this persistent I created a script in /etc/network/if-up.d
#!/bin/sh usr/sbin/ethtool -s eno1 wol g
OTHER METHOD:
Using cron
To run a script on startup using cron, you will need to do the following:
Open a terminal and type
crontab -e
Add a new line at the bottom of the file in the following format
@reboot /usr/sbin/ethtool -s eno1 wol g
eno1 is name of network card. Must be replaced with your network card name. To do this type
ip a
Save and exit the cron table.
Restart your system to test that the script is being run on startup.