add actual words

This commit is contained in:
2024-12-26 21:46:01 +02:00
parent 09e64254c9
commit 2a87adfd63
11 changed files with 480 additions and 347 deletions

View File

@@ -31,58 +31,71 @@
<body>
<section>
<blockquote>
<p>DATE: Thu 19 Dec 2024 18:35 By: konsthol@pm.me</p>
<p>DATE: Thu 19 Dec 2024 18:35 By: konsthol@pm.me</p>
</blockquote>
<h1 id="the-magic-of-wake-on-lan">The magic of Wake-On-LAN</h1>
<p>Years ago, some good friends of mine gifted me a Raspberry Pi 4 with
2GB of RAM for my birthday. Its hands down the most thoughtful gift
Ive ever received, perfectly matching my hobbies. They were lucky to
even find one during the chip shortage! I initially used it as a VPN
server with WireGuard and played around with Pi-hole for network-wide ad
blocking.</p>
<p>Eventually, I got into cloud computing and started hosting multiple
services on a VPS I rent from MVPS. This VPS, with its 4GB of RAM,
currently runs several of my daily-use services like Gitea, Searx, NTFY,
and more. Although the Raspberry Pi could theoretically handle these
services, its 2GB of RAM limited simultaneous operations.</p>
<p>One day, it hit me: why not use the Raspberry Pi for a simpler
project like a Wake-On-LAN (WOL) server? It requires minimal resources
and just needs to stay on and send WOL packets. The Raspberry Pi is
connected via Wi-Fi to the same network as my laptop. Normally, waking
up my laptop with WOL would require an Ethernet cable connection to the
router, but I connected one end to the Pi and the other to the
laptop.</p>
<p>I started with a simple shell script using etherwake, a command-line
tool to send WOL packets. After enabling WOL in my laptops BIOS and
confirming it on the OS using ethtool, I could easily wake my laptop
remotely using a Termux shortcut on my phone, which SSHed into the
Raspberry Pi to execute the etherwake command.</p>
<p>Though this setup worked perfectly fine, I wanted to make it even
better. Initially, the Raspberry Pi only ran SSH and executed a command
to wake my laptop. So it wasnt really a WOL server. After some
research, I found Flask and created an actual WOL server. This server
had routes, authentication, logging, rate limits, and more to ensure
robustness and security.</p>
<p>What makes my Flask-based server so cool is its dynamic nature. I can
configure a .env file with multiple device MAC addresses, allowing
numerous routes for different devices. For instance, I have
LAPTOP_MAC=“itsmac” and DESKTOP_MAC=“itsmac”, enabling me to wake them
via HTTP requests at /wol/laptop and /wol/desktop, respectively.</p>
<p>One open-source application that fits my use case is HTTP Shortcuts
from F-Droid. After configuring a specific route, I can turn it into a
widget on my home screen. This way, I can wake my laptop up with just a
tap! Plus, I use dynamic DNS, so my Pi is accessible from anywhere.</p>
<p><img
src="/images/pic-selected-19-12-24_19-10-42.png">The projects
mascot</a><br /></p>
<p>I would suggest anyone to take a look at my projects repo and if
they find that it fits their needs, use the setupSingleBinary.sh script
to grab the latest executable. The repo is over at</p>
<p><a
href="https://git.konsthol.eu/konsthol/WOL-Ly">WOL-Ly</a><br /></p>
<p>
Years ago, some good friends of mine gifted me a Raspberry Pi 4 with 2GB of
RAM for my birthday. Its hands down the most thoughtful gift Ive ever
received, perfectly matching my hobbies. They were lucky to even find one
during the chip shortage! I initially used it as a VPN server with WireGuard
and played around with Pi-hole for network-wide ad blocking.
</p>
<p>
Eventually, I got into cloud computing and started hosting multiple services
on a VPS I rent from MVPS. This VPS, with its 4GB of RAM, currently runs
several of my daily-use services like Gitea, Searx, NTFY, and more. Although
the Raspberry Pi could theoretically handle these services, its 2GB of RAM
limited simultaneous operations.
</p>
<p>
One day, it hit me: why not use the Raspberry Pi for a simpler project like a
Wake-On-LAN (WOL) server? It requires minimal resources and just needs to stay
on and send WOL packets. The Raspberry Pi is connected via Wi-Fi to the same
network as my laptop. Normally, waking up my laptop with WOL would require an
Ethernet cable connection to the router, but I connected one end to the Pi and
the other to the laptop.
</p>
<p>
I started with a simple shell script using etherwake, a command-line tool to
send WOL packets. After enabling WOL in my laptops BIOS and confirming it on
the OS using ethtool, I could easily wake my laptop remotely using a Termux
shortcut on my phone, which SSHed into the Raspberry Pi to execute the
etherwake command.
</p>
<p>
Though this setup worked perfectly fine, I wanted to make it even better.
Initially, the Raspberry Pi only ran SSH and executed a command to wake my
laptop. So it wasnt really a WOL server. After some research, I found Flask
and created an actual WOL server. This server had routes, authentication,
logging, rate limits, and more to ensure robustness and security.
</p>
<p>
What makes my Flask-based server so cool is its dynamic nature. I can
configure a .env file with multiple device MAC addresses, allowing numerous
routes for different devices. For instance, I have LAPTOP_MAC=“itsmac” and
DESKTOP_MAC=“itsmac”, enabling me to wake them via HTTP requests at
/wol/laptop and /wol/desktop, respectively.
</p>
<p>
One open-source application that fits my use case is HTTP Shortcuts from
F-Droid. After configuring a specific route, I can turn it into a widget on my
home screen. This way, I can wake my laptop up with just a tap! Plus, I use
dynamic DNS, so my Pi is accessible from anywhere.
</p>
<p>
<img src="/images/pic-selected-19-12-24_19-10-42.png"><br />The projects mascot</a
><br />
</p>
<p>
I would suggest anyone to take a look at my projects repo and if they find
that it fits their needs, use the setupSingleBinary.sh script to grab the
latest executable. The repo is over at
</p>
<p><a href="https://git.konsthol.eu/konsthol/WOL-Ly">WOL-Ly</a><br /></p>
<p><a href="..">..</a></p>
<footer>
<a id="gemyo" href="gemini://konsthol.eu/"><img src="/images/best_viewed_on_gemini.png" /></a>
<a id="gemyo" href="gemini://konsthol.eu/"><img src="/images/best_viewed_on_gemini.png" /><br /></a>
</footer>
</section>