<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Kévin Brault</title>
    <link>https://braultkevin.fr/</link>
    <description>Recent content on Kévin Brault</description>
    <generator>Hugo</generator>
    <language>en</language>
    <managingEditor>contact@braultkevin.fr (BRAULT Kévin)</managingEditor>
    <webMaster>contact@braultkevin.fr (BRAULT Kévin)</webMaster>
    <lastBuildDate>Sun, 05 Apr 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://braultkevin.fr/index.xml" rel="self" type="application/rss+xml" />
    <image>
      <url>https://braultkevin.fr/favicon/favicon-512.png</url>
      <title>Kévin Brault</title>
      <link>https://braultkevin.fr/</link>
    </image>
    <item>
      <title>Installing FreeBSD 15 and CTWM on a ThinkPad x61s, because why not ?</title>
      <link>https://braultkevin.fr/microblog/2026-04-05-installing-freebsd-15-ctwm-thinkpad-x61s-because-why-not/</link>
      <pubDate>Sun, 05 Apr 2026 00:00:00 +0000</pubDate><author>contact@braultkevin.fr (BRAULT Kévin)</author>
      <guid>https://braultkevin.fr/microblog/2026-04-05-installing-freebsd-15-ctwm-thinkpad-x61s-because-why-not/</guid>
      <description><![CDATA[<blockquote>
<p><strong>TL;DR</strong> : Everything works fine out of the box except backlight and HD resolution. The fix : <code>pkg install drm_kmod</code>, enable it <code>sysctl kld_list=i915ms</code> and set <code>backlight 100</code></p></blockquote>
<p><img src="/freebsd_x61s.webp" loading="lazy" decoding="async" alt="freebsd_x61s.webp"></p>
<p>I had the opportunity to buy the famous <strong>ThinkPad x61s</strong> for just a few euros. I’ve owned many different ThinkPads because I find them well-built and particularly compatible with operating systems other than Windows. But I’ve never owned a model as old as this x61s.</p>]]></description>
      <content:encoded><![CDATA[<blockquote>
<p><strong>TL;DR</strong> : Everything works fine out of the box except backlight and HD resolution. The fix : <code>pkg install drm_kmod</code>, enable it <code>sysctl kld_list=i915ms</code> and set <code>backlight 100</code></p></blockquote>
<p><img src="/freebsd_x61s.webp" loading="lazy" decoding="async" alt="freebsd_x61s.webp"></p>
<p>I had the opportunity to buy the famous <strong>ThinkPad x61s</strong> for just a few euros. I’ve owned many different ThinkPads because I find them well-built and particularly compatible with operating systems other than Windows. But I’ve never owned a model as old as this x61s.</p>
<p>Released in May 2007, it’s just under 20 years old. Many models would have given up the ghost by now, but not this behemoth, which, despite the transition to Lenovo, still carries its IBM DNA. Even though its reputation of tank, the weight of the years and a reputation for overheating had me a little skeptical. It’s the smallest model, with its Intel Core 2 Duo L7300 CPU @ 1.40 GHz and 3 GB of RAM &hellip; not exactly a powerhouse. And yet, it came with Windows 10 and turned out to be surprisingly fast and cool &hellip; until I opened a 1080p YouTube video, at which point it nearly took off like a helicopter because the fan was spinning so fast. Final note for the awesome 3/2 ratio, yet the screen quality is far from modern standards.</p>
<h2 id="the-installation">
    <a class="heading-anchor" href="#the-installation" aria-label="Link to this section">#</a>The installation
</h2>
<p>The Intel Core 2 Duo L7300 is one of the first 64-bit CPUs for the consumer market. Great, FreeBSD seems to have dropped 32-bit support in its latest version, 15. After downloading an <code>AMD64</code> ISO and copying it to a bootable USB drive, I immediately configured the BIOS to set the USB port as the boot priority. I was expecting a complicated installation, but not at all. Yes, the interface is a far cry from Ubuntu, but everything is very easy to do.</p>
<ul>
<li>First, select the &ldquo;Distribution Sets&rdquo; installation type to select the minimum options and remove <code>kernel-dbg</code>and <code>lib32</code>components.</li>
<li>Set up the network. I had read a few tutorials beforehand that explained the post-installation method using <code>/etc/wpa_supplicant.conf</code>. But that wasn&rsquo;t the case at all, everything is done within the installation interface, including scanning for networks, selecting the <code>SSID</code>, and entering the <code>WEP</code> key. Everything worked perfectly the first time.</li>
<li>Select the <code>UNIX</code> file system. <code>UFS</code> is lightweight and uses fewer system resources than more advanced file systems like <code>ZFS</code>. Since the x31s has limited RAM and CPU power, <code>UFS</code> helps keep the system faster, more stable, and easier to manage. I don&rsquo;t need the advanced features of <code>ZFS</code>. Use the entire disk since the machine will be dedicated to this purpose, and choose the <code>GPT</code> partition scheme (which replaces <code>MBR</code> I wasn&rsquo;t able to test this for the exercise).</li>
<li>The <code>root</code> user is created by default; all that&rsquo;s left is to set a password.</li>
<li>After going through a few steps to select the HTTP mirror, choose the keyboard layout, and set the date and time, I’m prompted to add a few components. I select <code>powerd</code> for CPU frequency scaling and <code>moused</code> to start the mouse driver.</li>
<li>I&rsquo;m adding a user and adding it to the group <code>wheel</code>.</li>
</ul>
<h2 id="the-optimization">
    <a class="heading-anchor" href="#the-optimization" aria-label="Link to this section">#</a>The optimization
</h2>
<p>Right out of the box, FreeBSD on my x61s required very little tweaking :</p>
<ul>
<li>I limit the power consumption of the Wi-Fi chip (which is known to be a power hog) :  <code>vi /etc/system.conf</code> and set <code>dev.iwm.0.twpower = 50</code>.</li>
<li>Since powerd was set on during the install, I set configure the CPU with high speed when AC on and power-save on battery : <code>vi /etc/rc.conf</code>and set <code>powerd_flags=&quot;-a hiadaptive -b adaptive&quot;</code>.</li>
<li>A very obvious system update <code>freebsd-update fetch install</code> and the same for packages <code>pkg update</code>and <code>pkg upgrade</code>.</li>
<li>The backlight was very low and the resolution was limited to 800x600. So I installed the Direct Rendering Manager GPU driver <code>pkg install drm_kmod</code> and enable it <code>sysctl kld_list=i915ms</code>, after a reboot, the HD resolution was on and a simple <code>backlight 100</code> was enough to set a full screen brightness (yet quit low but never mind).</li>
</ul>
<h2 id="claudes-tab-window-manager">
    <a class="heading-anchor" href="#claudes-tab-window-manager" aria-label="Link to this section">#</a>Claude&rsquo;s Tab Window Manager
</h2>
<p><code>CTWM</code> is a very light window manager and yet very configurable. When idle, it uses almost no RAM or CPU. It&rsquo;s even easier to install :</p>
<ul>
<li>First, I installed the graphical environment components: the <code>Xorg</code> X server along with the lightweight window manager CTWM using: <code>pkg install xorg ctwm</code></li>
<li>Then, using the regular (non-root) user account I created during installation, I set up a <code>~/.xinitrc</code> file to tell X what session to start. For now, I kept it very simple: <code>exec ctwm &amp;</code></li>
<li>After that, I launched the graphical session with: <code>startx</code></li>
<li>And &hellip; yeah, the default CTWM look is pretty rough, very retro in the not immediately lovable sense. So I decided to customize it by creating a <code>~/.ctwmrc</code> configuration file with my own settings. <a href="https://www.ctwm.org/themes.html"><code>You can find some themes in the officiel site</code></a>.</li>
</ul>
<h2 id="final-words">
    <a class="heading-anchor" href="#final-words" aria-label="Link to this section">#</a>Final words
</h2>
<p>The screen&rsquo;s 3/2 aspect ratio is great, and everything works almost out of the box with FreeBSD. The machine is fast, quiet, and stays cool. The keyboard is high-quality, a nice change from the ultra-flat keys on a MacBook. I hope to achieve my goals with this setup. See you in a few weeks to talk more about it.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Why bootstrapping a peer-to-peer network without a directory is a mathematical utopia</title>
      <link>https://braultkevin.fr/blog/2025-12-29-why-bootstrapping-a-peer-to-peer-network-without-a-directory-is-a-mathematical-utopia/</link>
      <pubDate>Mon, 29 Dec 2025 00:00:00 +0000</pubDate><author>contact@braultkevin.fr (BRAULT Kévin)</author>
      <guid>https://braultkevin.fr/blog/2025-12-29-why-bootstrapping-a-peer-to-peer-network-without-a-directory-is-a-mathematical-utopia/</guid>
      <description><![CDATA[<p>I&rsquo;ve spent the last few weeks testing mesh LoRa hardware (Meshtastic nodes mostly).</p>
<p>On a Meshtastic mesh, discovery is almost free. Radio is a broadcast medium : a node transmits once and every other node within range hears it. There&rsquo;s nothing to guess, no address space to search. The only constraint is the proximity of each node.</p>
<p>At the same time, I&rsquo;m interested in peer-to-peer networks over the Internet and the transposition does impose quite a few constraints. There&rsquo;s no &ldquo;radio range&rdquo; on IP : two hosts a few meters apart and two hosts on opposite sides of the planet are equally reachable (or equally invisible actually) to each other. Reachability over the Internet is not a physical proximity constraint, it&rsquo;s a function of knowing an address that could be almost anything. Discovery becomes more about random guessing than a search within the area.</p>]]></description>
      <content:encoded><![CDATA[<p>I&rsquo;ve spent the last few weeks testing mesh LoRa hardware (Meshtastic nodes mostly).</p>
<p>On a Meshtastic mesh, discovery is almost free. Radio is a broadcast medium : a node transmits once and every other node within range hears it. There&rsquo;s nothing to guess, no address space to search. The only constraint is the proximity of each node.</p>
<p>At the same time, I&rsquo;m interested in peer-to-peer networks over the Internet and the transposition does impose quite a few constraints. There&rsquo;s no &ldquo;radio range&rdquo; on IP : two hosts a few meters apart and two hosts on opposite sides of the planet are equally reachable (or equally invisible actually) to each other. Reachability over the Internet is not a physical proximity constraint, it&rsquo;s a function of knowing an address that could be almost anything. Discovery becomes more about random guessing than a search within the area.</p>
<p>In a centralized network, peer discovery is easy : a directory, a tracker or a central authority tells where the network nodes are. But that comes at a cost : a single point of failure. For a network whose purpose is to resist censorship, a central server is an obvious target : block the directory&rsquo;s IP address and the entire network disappears. The promise of total decentralization is that peer discovery becomes as resilient as the network itself. A fully decentralized network has no central authority and delegates peer discovery to the peers themselves. But a node&rsquo;s ability to find another node with no intermediary is limited by two basic constraints : the size of the address space (the IP adress space) and how long nodes stay reachable. On the Internet, none of these constraints can be guaranteed.</p>
<p>Let&rsquo;s dig into it.</p>
<h2 id="the-address-space">
    <a class="heading-anchor" href="#the-address-space" aria-label="Link to this section">#</a>The address space
</h2>
<p>For an IPv4 network, the global address space is the set of all 32-bit binary vectors :</p>
$$A = \{0, 1\}^{32}$$<p>The total number of addressable addresses is:</p>
$$\lvert A \rvert = 2^{32} = 4\,294\,967\,296$$<p>Let $n$ be the number of active nodes belonging to the peer-to-peer network at a given time $t$. Define the network&rsquo;s density $\delta$ as the probability that a uniformly randomly sampled address belongs to the set of active peers:</p>
$$\delta = \frac{n}{\lvert A \rvert}$$<p>This is a simplified model : it assumes that peers are uniformly distributed across the IPv4 address space and that any address belonging to a peer is directly reachable. In practice, NAT, firewalls, ports, routing and service availability make the real situation even more complex.</p>
<p>Searching for a peer by random sampling can be modeled as a geometric distribution, where each query is an independent Bernoulli trial with success probability $p = \delta$. The expected number $E[X]$ of queries needed to make first contact is :</p>
$$E[X] = \frac{1}{\delta} = \frac{\lvert A \rvert}{n}$$<p>For a network starting up with $n = 100$ peers :</p>
$$E[X] = \frac{4\,294\,967\,296}{100} \approx 4.29 \times 10^{7} \text{ requests}$$<p>Now let $v$ be the scan rate (queries on the address space per second). The average discovery time $T$ is:</p>
$$T = \frac{E[X]}{v} = \frac{\lvert A \rvert}{n \cdot v}$$<p>Assuming a (very) optimistic scan rate of $v = 10^3$ requests per second :</p>
$$T = \frac{4\,294\,967\,296}{1000 \cdot 100} \approx 42\,950 \text{ seconds} \approx 11.93 \text{ hours}$$<p>So, brute-force discovery of a single node on an authority-free network takes close to 12 hours. For a network that already has 100 peers running.</p>
<p>For a very new network of just $n = 2$ peers, the theoretical discovery time increases to roughly &hellip; 24.9 days ! And on a IPv6 adress space, it completely stops being a practical number at all : $\approx 5.4 \times 10^{27}$ years (390 quadrillion times the current age of the universe).</p>
<h2 id="the-problem--addresses-change">
    <a class="heading-anchor" href="#the-problem--addresses-change" aria-label="Link to this section">#</a>The problem : addresses change
</h2>
<p>The scale of the address space alone would be a solvable engineering problem (well, you could, in principle, scan forever). But peers can&rsquo;t scan forever, because the addresses they&rsquo;re scanning for don&rsquo;t stay put. DHCP lease duration isn&rsquo;t fixed : it varies by router vendor, ISP and network type, but a reasonable working approximation would be between 7 to 14 days.</p>
<p>Take $T = 14$ days (1,209,600 seconds) as an upper bound. The total number of scan attempts a peer can realistically make in that window is :</p>
$$S = v \times T = 10^3 \times 1\,209\,600 = 1.2096 \times 10^{9} \text{ attempts}$$<p>Each discovery attempt is a Bernoulli trial with two outcomes : hit or miss. The probability of exactly $k$ hits is :</p>
$$P(X = k) = \binom{S}{k} p^{k} (1-p)^{S-k}$$<p>with :</p>
<ul>
<li>$S = 1.2096 \times 10^{9}$ trials,</li>
<li>$p = \dfrac{1}{4\,294\,967\,296} \approx 2.33 \times 10^{-10}$, the probability of a hit on any given attempt.
<br><br></li>
</ul>
<p>By the Poisson limit theorem ($S \to \infty$, $p \to 0$), the binomial distribution $B(S,p)$ converges to a Poisson distribution $P(\lambda)$ with $\lambda = Sp$ :</p>
$$\lambda = S \times p = 1.2096 \times 10^{9} \times 2.33 \times 10^{-10} \approx 0.2816$$<p>The probability of finding at least one peer ($X \ge 1$) over the whole lease window is :</p>
$$P(X \ge 1) = 1 - e^{-\lambda} = 1 - e^{-0.2816} \approx 0.245 \text{ (i.e. } 24.5\%\text{)}$$<p>A peer has roughly a 1-in-4 chance of ever finding another peer on IPv4 over an entire DHCP lease and that&rsquo;s the very best case, assuming :</p>
<ul>
<li>the searching peer dedicates 100% of its time and bandwidth to scanning, continuously, for the full 14 days, at $v = 10^3$ requests/second</li>
<li>nodes being searched for keep their IP for at least 14 days.</li>
</ul>
<p>None of these assumptions are realistic.</p>
<p>That&rsquo;s why fully decentralized networks aren&rsquo;t really fully decentralized. Bitcoin comes with hardcoded seed nodes and DNS seeds. BitTorrent leans on trackers. Tor has directory authorities. I2P has reseed servers. Pure peer-to-peer discovery is almost impossible when the address space is so large and constantly changing. These authorities, trackers and hardcoded nodes are needed for decentralization to work at all.</p>
<p>So, a fully peer-to-peer network with no authority, as sexy as it is, would be almost utopian over the Internet.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>