90 lines
4.0 KiB
HTML
90 lines
4.0 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<title>Konsthol</title>
|
||
<meta charset="utf-8">
|
||
<meta name="robots" content="noindex">
|
||
<link rel="alternate" type="application/atom+xml" title="RSS Feed" href="/rss.xml">
|
||
<link rel="stylesheet" href="/css/style.css" >
|
||
<link rel="shortcut icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
|
||
|
||
<script>
|
||
(function(d,t) {
|
||
var BASE_URL="https://chat.konsthol.eu";
|
||
var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||
g.src=BASE_URL+"/packs/js/sdk.js";
|
||
g.defer = true;
|
||
g.async = true;
|
||
s.parentNode.insertBefore(g,s);
|
||
window.chatwootSettings = {
|
||
darkMode: "dark"
|
||
};
|
||
g.onload=function(){
|
||
window.chatwootSDK.run({
|
||
websiteToken: 'rYqPF7TtnospKkLhtjf5LkPy',
|
||
baseUrl: BASE_URL
|
||
})
|
||
}
|
||
})(document,"script");
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<section>
|
||
<blockquote>
|
||
<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. It’s hands down the most thoughtful gift
|
||
I’ve 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 laptop’s 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 wasn’t 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">Mascot</a><br /></p>
|
||
<p>I would suggest anyone to take a look at my project’s 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>
|
||
</footer>
|
||
|
||
</section>
|
||
</body>
|
||
</html>
|