├── README.md └── enable_WoL_Proxmox.sh /README.md: -------------------------------------------------------------------------------- 1 | # Proxmox-WoL 2 | A script to enable Wake on LAN on Proxmox 3 | 4 | It use the packet "ethtool" for this. 5 | 6 | To directly launch the script, you can use this command in the Proxmox node shell : 7 | 8 | ``` 9 | bash -c "$(wget -qLO - https://raw.githubusercontent.com/Aizen-Barbaros/Proxmox-WoL/main/enable_WoL_Proxmox.sh)" 10 | ``` 11 | -------------------------------------------------------------------------------- /enable_WoL_Proxmox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install ethtool 4 | sudo apt install ethtool -y 5 | 6 | # List network devices 7 | ip addr 8 | 9 | # Select network device 10 | echo "Please enter the name of the network device to configure for Wake-on-LAN:" 11 | read device_name 12 | 13 | # Check if device supports WOL 14 | ethtool $device_name | grep "Wake-on:" 15 | 16 | # Enable WOL on the device 17 | ethtool -s $device_name wol g 18 | 19 | # Configure /etc/network/interfaces for WOL 20 | if grep -q "post-up /usr/sbin/ethtool -s $device_name wol g" /etc/network/interfaces; then 21 | echo "Wake-on-LAN is already configured for $device_name in /etc/network/interfaces" 22 | else 23 | sed -i "/iface $device_name inet/ a\ post-up /usr/sbin/ethtool -s $device_name wol g" /etc/network/interfaces 24 | echo "Wake-on-LAN has been configured for $device_name in /etc/network/interfaces" 25 | fi 26 | 27 | # Get the MAC address of the selected network devices 28 | mac_addr=$(ip addr show $device_name | awk '/ether/ {print $2}') 29 | 30 | # Set the MAC address to the node for WOL 31 | pvenode config set -wakeonlan $mac_addr 32 | --------------------------------------------------------------------------------