> For the complete documentation index, see [llms.txt](https://notes.lcsrg.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.lcsrg.me/home-setup/remote-access/turn-on-off-remote-computer.md).

# Turn on a remote computer

I have a machine that I use to do lot of work. However, I want to avoid having it on 24/7. Hence, sometiems I need to turn it on remotely to start working

#### Guide

To turn on your computer remotely, you need to be in the same network and then use the protocol "Wake-on-Lan." Read below for a step-by-step guide.

1. **Be in the same network**. I recommend having a Raspberry Pi on 24/7, which you can SSH into anytime. Alternatively, you can use a VPN to connect to your network (also via a Raspberry Pi).
2. **SSH into the Raspberry**
3. **Create a directory for managing this operation**. &#x20;

```bash
# use wake on lan
mkdir remote_on
```

4. **Find out the MAC address of your computer.** You can do it. Then save it in file `MAC_ADDR`:

```bash
# use wake on lan
cd remote_on
echo "..." > MAC_ADDR
```

5. **If not available, install a client to use Wake-on-Lan**. I use [etherwake](https://linux.die.net/man/8/ether-wake).
6. **Draft a script to do the job**

```bash
# use wake on lan
MAC_FILE="$(dirname "$0")/MAC_ADDR"
etherwake -i eth0 "$(cat "$MAC_FILE")"
```

7. Make the script executable

```bash
chmod +x /home/pi/remote_on/script.sh
```

8. Add an alias to your `.bashrc` like:

```bash
alias turnon='sudo /home/pi/remote_on/script.sh'
```

***

{% hint style="info" %}
[Main reference](https://serverfault.com/questions/266118/turn-on-a-linux-machine-remotely/266181#266181)

\
Wake on Lan:

* [Arch guide](https://wiki.archlinux.org/index.php/Wake-on-LAN#Enable_WoL_on_the_network_adapter) (**Note**: on TUF B550M ASUS bios ([manual](https://dlcdnets.asus.com/pub/ASUS/misc/Manual/PRIME_TUF_GAMING_B550_Series_BIOS_EM_WEB_EN.pdf), pg. 31), enable option “Power On By PCI-E”)
* [Problem solving](mailto:undefined)
  {% endhint %}
