<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: James4u</title>
    <description>The latest articles on DEV Community by James4u (@james4u).</description>
    <link>https://dev.to/james4u</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F904073%2F6c0a991b-2784-4609-8cd6-96a3ef1f448d.webp</url>
      <title>DEV Community: James4u</title>
      <link>https://dev.to/james4u</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/james4u"/>
    <language>en</language>
    <item>
      <title>How to protect your miners from DDOS attack</title>
      <dc:creator>James4u</dc:creator>
      <pubDate>Tue, 17 Mar 2026 04:25:28 +0000</pubDate>
      <link>https://dev.to/james4u/how-to-protect-your-miners-from-ddos-attack-5fg</link>
      <guid>https://dev.to/james4u/how-to-protect-your-miners-from-ddos-attack-5fg</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Transparency Note&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
This article was generated with the assistance of AI and carefully reviewed, edited, and validated by the author.  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Running a miner in the Bittensor ecosystem is exciting — you’re literally participating in a global, decentralized intelligence market. But there’s a harsh reality that many subnet operators are now facing:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Your Axon endpoint is exposed to the entire internet.&lt;/strong&gt;&lt;br&gt;
👉 &lt;strong&gt;And yes — it &lt;em&gt;will&lt;/em&gt; get attacked.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this post, I’ll show you a &lt;strong&gt;simple, practical, and effective way&lt;/strong&gt; to protect your miner using &lt;code&gt;ufw&lt;/code&gt; (Uncomplicated Firewall).&lt;/p&gt;

&lt;p&gt;No complex infrastructure. No expensive services. Just a clean idea:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Only allow validators. Block everyone else.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  ⚠️ The Problem
&lt;/h2&gt;

&lt;p&gt;If you’re running a miner, your Axon is public.&lt;/p&gt;

&lt;p&gt;That means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Anyone can send requests to your port&lt;/li&gt;
&lt;li&gt;Bots can spam your endpoint&lt;/li&gt;
&lt;li&gt;Attackers can flood your node (DDoS)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And recently, this has been happening across multiple subnets.&lt;/p&gt;

&lt;p&gt;The key insight is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;❌ You don’t need the whole internet&lt;br&gt;
✅ You only need validators&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  💡 The Solution (In One Sentence)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Whitelist validator IPs. Deny everything else.&lt;/strong&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  🔧 Why UFW?
&lt;/h2&gt;

&lt;p&gt;I chose &lt;code&gt;ufw&lt;/code&gt; because it’s:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple&lt;/li&gt;
&lt;li&gt;Already installed on most servers&lt;/li&gt;
&lt;li&gt;Built on top of iptables (so it’s powerful)&lt;/li&gt;
&lt;li&gt;Easy to audit and maintain&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  🚀 Step-by-Step Setup
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Install UFW
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;ufw &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Set Default Rules
&lt;/h3&gt;

&lt;p&gt;Block all incoming traffic by default:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw default deny incoming
&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw default allow outgoing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  3. Don’t Lock Yourself Out (Allow SSH!)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw allow ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  4. Allow Only Validators
&lt;/h3&gt;

&lt;p&gt;Let’s say your Axon runs on port &lt;code&gt;8091&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw allow from &amp;lt;VALIDATOR_IP&amp;gt; to any port 8091
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Repeat this for each validator in your subnet.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. Enable Firewall
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw &lt;span class="nb"&gt;enable
sudo &lt;/span&gt;ufw status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🧠 The Gotcha (Important!)
&lt;/h2&gt;

&lt;p&gt;This is where most people mess up:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Validator IPs are NOT static.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Validators can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Move to a new machine&lt;/li&gt;
&lt;li&gt;Change cloud providers&lt;/li&gt;
&lt;li&gt;Rotate IPs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you hardcode IPs and forget about it:&lt;/p&gt;

&lt;p&gt;💥 Your miner stops receiving requests&lt;br&gt;
💥 Your performance drops&lt;br&gt;
💥 Your rewards go down&lt;/p&gt;


&lt;h2&gt;
  
  
  🔄 How to Handle Validator Changes
&lt;/h2&gt;

&lt;p&gt;Here are a few practical strategies:&lt;/p&gt;
&lt;h3&gt;
  
  
  Option 1 — Manual Updates
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Check validator IPs periodically&lt;/li&gt;
&lt;li&gt;Update UFW rules when needed&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  Option 2 — Automate It (Recommended)
&lt;/h3&gt;

&lt;p&gt;Basic idea:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Pseudo logic&lt;/span&gt;
1. Fetch validator list &lt;span class="o"&gt;(&lt;/span&gt;metagraph&lt;span class="o"&gt;)&lt;/span&gt;
2. Extract IPs
3. Compare with UFW rules
4. Update rules automatically
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run this every few minutes with cron.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚖️ Trade-offs
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setup&lt;/th&gt;
&lt;th&gt;Security&lt;/th&gt;
&lt;th&gt;Reliability&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Open Axon&lt;/td&gt;
&lt;td&gt;❌ Low&lt;/td&gt;
&lt;td&gt;✅ High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strict Whitelist&lt;/td&gt;
&lt;td&gt;✅ High&lt;/td&gt;
&lt;td&gt;⚠️ Medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automated Whitelist&lt;/td&gt;
&lt;td&gt;✅ High&lt;/td&gt;
&lt;td&gt;✅ High&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🧭 Bigger Picture (Why This Matters)
&lt;/h2&gt;

&lt;p&gt;Bittensor is designed as an &lt;strong&gt;open and permissionless system&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That’s powerful — but it also means:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Security is your responsibility.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The protocol defines incentives.&lt;br&gt;
But &lt;em&gt;you&lt;/em&gt; define your infrastructure.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Final Takeaway
&lt;/h2&gt;

&lt;p&gt;You don’t need enterprise-grade defenses to survive DDoS.&lt;/p&gt;

&lt;p&gt;Sometimes the best solution is the simplest:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Only accept traffic from participants who matter.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Happy Mining - James4u&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Transparency Note&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
This article was generated with the assistance of AI and carefully reviewed, edited, and validated by the author.  &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>bittensor</category>
      <category>mining</category>
      <category>attack</category>
      <category>security</category>
    </item>
  </channel>
</rss>
