<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to Create a Simple IP Blocker Script Using iptables and Fail2Ban	</title>
	<atom:link href="https://www.tecmint.com/bash-script-to-block-ip-with-iptables/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.tecmint.com/bash-script-to-block-ip-with-iptables/</link>
	<description>Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks.</description>
	<lastBuildDate>Wed, 16 Jul 2025 04:25:02 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Ravi Saive		</title>
		<link>https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2325799</link>

		<dc:creator><![CDATA[Ravi Saive]]></dc:creator>
		<pubDate>Wed, 16 Jul 2025 04:25:02 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=60569#comment-2325799</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2325602&quot;&gt;Nick&lt;/a&gt;.

@Nick,

Hi there,

Thanks for the detailed explanation, your setup sounds solid overall, and it&#039;s great that you&#039;re thinking carefully about security!

Regarding your issue with Fail2ban banning your local IP (192.168.x.x) instead of the actual external IP during a failed login attempt: this usually happens when your server is behind a reverse proxy, in your case, Cloudflare.

By default, Nextcloud (and many web services) will log the IP address of the reverse proxy (Cloudflare) or even your internal gateway, instead of the real external visitor&#039;s IP. This causes Fail2ban to see and ban the wrong IP, often your own local address.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2325602">Nick</a>.</p>
<p>@Nick,</p>
<p>Hi there,</p>
<p>Thanks for the detailed explanation, your setup sounds solid overall, and it&#8217;s great that you&#8217;re thinking carefully about security!</p>
<p>Regarding your issue with Fail2ban banning your local IP (192.168.x.x) instead of the actual external IP during a failed login attempt: this usually happens when your server is behind a reverse proxy, in your case, Cloudflare.</p>
<p>By default, Nextcloud (and many web services) will log the IP address of the reverse proxy (Cloudflare) or even your internal gateway, instead of the real external visitor&#8217;s IP. This causes Fail2ban to see and ban the wrong IP, often your own local address.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nick		</title>
		<link>https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2325602</link>

		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Tue, 15 Jul 2025 14:13:11 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=60569#comment-2325602</guid>

					<description><![CDATA[It was a pleasure to come across this article, it&#039;s clearly written and covers all the essential points.

I’d like to share a small concern regarding my cloud setup.

I currently have a &lt;strong&gt;Nextcloud&lt;/strong&gt; instance running on my home lab. None of my router’s ports are open, so I assume it&#039;s not directly accessible from the outside. My server is tunneled through &lt;strong&gt;Cloudflare&lt;/strong&gt;, and my domain is properly pointed to &lt;strong&gt;Cloudflare&lt;/strong&gt; as well. I’ve also installed &lt;strong&gt;Fail2ban&lt;/strong&gt; to add an extra layer of security, and as far as I can tell, it’s working, but I noticed something strange.

From an external network (outside my home), I intentionally failed several login attempts on &lt;strong&gt;Nextcloud&lt;/strong&gt; to test &lt;strong&gt;Fail2ban&lt;/strong&gt;. As expected, the login was blocked after three failed tries. However, when I checked the status using the &lt;code&gt;fail2ban-client status&lt;/code&gt; command, I was surprised to see that the banned IP was from my local network (e.g., &lt;code&gt;192.168.1.xx&lt;/code&gt;).

This seems wrong. If someone tries a brute-force attack from the outside, my internal IP ends up getting banned. That doesn’t sound right, and I’m concerned that this could leave me locked out too often.

Do you have any advice or suggestions on how to fix or improve this setup?

Thanks in advance!]]></description>
			<content:encoded><![CDATA[<p>It was a pleasure to come across this article, it&#8217;s clearly written and covers all the essential points.</p>
<p>I’d like to share a small concern regarding my cloud setup.</p>
<p>I currently have a <strong>Nextcloud</strong> instance running on my home lab. None of my router’s ports are open, so I assume it&#8217;s not directly accessible from the outside. My server is tunneled through <strong>Cloudflare</strong>, and my domain is properly pointed to <strong>Cloudflare</strong> as well. I’ve also installed <strong>Fail2ban</strong> to add an extra layer of security, and as far as I can tell, it’s working, but I noticed something strange.</p>
<p>From an external network (outside my home), I intentionally failed several login attempts on <strong>Nextcloud</strong> to test <strong>Fail2ban</strong>. As expected, the login was blocked after three failed tries. However, when I checked the status using the <code>fail2ban-client status</code> command, I was surprised to see that the banned IP was from my local network (e.g., <code>192.168.1.xx</code>).</p>
<p>This seems wrong. If someone tries a brute-force attack from the outside, my internal IP ends up getting banned. That doesn’t sound right, and I’m concerned that this could leave me locked out too often.</p>
<p>Do you have any advice or suggestions on how to fix or improve this setup?</p>
<p>Thanks in advance!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ravi Saive		</title>
		<link>https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2321114</link>

		<dc:creator><![CDATA[Ravi Saive]]></dc:creator>
		<pubDate>Wed, 02 Jul 2025 04:34:26 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=60569#comment-2321114</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2320917&quot;&gt;cybernard&lt;/a&gt;.

@Cybernard,

Great points, thanks for sharing!

You&#039;re absolutely right: using &lt;code&gt;ipset&lt;/code&gt; or &lt;code&gt;nftables&lt;/code&gt; sets can make IP blocking much more efficient, especially when dealing with a large number of addresses. The ability to save and restore sets, and even automate them with &lt;strong&gt;systemd&lt;/strong&gt;, is super handy for production environments.

Fail2Ban’s integration with &lt;code&gt;ipset&lt;/code&gt; or &lt;code&gt;nftables&lt;/code&gt; (especially when paired with &lt;strong&gt;SQLite&lt;/strong&gt;) does simplify rule reloading a lot, assuming it&#039;s all properly configured.

That said, the script approach in the article is meant as a beginner-friendly intro, something simple and quick to get people started. For anyone scaling up or looking for performance and automation, your suggestions are definitely the way to go.

Appreciate the detailed input!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2320917">cybernard</a>.</p>
<p>@Cybernard,</p>
<p>Great points, thanks for sharing!</p>
<p>You&#8217;re absolutely right: using <code>ipset</code> or <code>nftables</code> sets can make IP blocking much more efficient, especially when dealing with a large number of addresses. The ability to save and restore sets, and even automate them with <strong>systemd</strong>, is super handy for production environments.</p>
<p>Fail2Ban’s integration with <code>ipset</code> or <code>nftables</code> (especially when paired with <strong>SQLite</strong>) does simplify rule reloading a lot, assuming it&#8217;s all properly configured.</p>
<p>That said, the script approach in the article is meant as a beginner-friendly intro, something simple and quick to get people started. For anyone scaling up or looking for performance and automation, your suggestions are definitely the way to go.</p>
<p>Appreciate the detailed input!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ravi Saive		</title>
		<link>https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2321113</link>

		<dc:creator><![CDATA[Ravi Saive]]></dc:creator>
		<pubDate>Wed, 02 Jul 2025 04:31:58 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=60569#comment-2321113</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2320945&quot;&gt;Bruce Ferrell&lt;/a&gt;.

@Bruce,

Thanks for the tip! 

You&#039;re right, using &lt;code&gt;ip route add blackhole&lt;/code&gt; is a neat and lightweight way to drop traffic without the overhead of iptables. It&#039;s especially handy for blocking IPs at the routing level, and can be a great fit for high-traffic environments or minimal setups.

That said, &lt;code&gt;iptables&lt;/code&gt; (along with tools like &lt;strong&gt;Fail2Ban&lt;/strong&gt;) shines when you need more dynamic, rule-based filtering, like detecting repeated failed logins and acting on them automatically. Both approaches have their place depending on the use case.

Appreciate the input!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2320945">Bruce Ferrell</a>.</p>
<p>@Bruce,</p>
<p>Thanks for the tip! </p>
<p>You&#8217;re right, using <code>ip route add blackhole</code> is a neat and lightweight way to drop traffic without the overhead of iptables. It&#8217;s especially handy for blocking IPs at the routing level, and can be a great fit for high-traffic environments or minimal setups.</p>
<p>That said, <code>iptables</code> (along with tools like <strong>Fail2Ban</strong>) shines when you need more dynamic, rule-based filtering, like detecting repeated failed logins and acting on them automatically. Both approaches have their place depending on the use case.</p>
<p>Appreciate the input!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Bruce Ferrell		</title>
		<link>https://www.tecmint.com/bash-script-to-block-ip-with-iptables/comment-page-1/#comment-2320945</link>

		<dc:creator><![CDATA[Bruce Ferrell]]></dc:creator>
		<pubDate>Tue, 01 Jul 2025 15:08:33 +0000</pubDate>
		<guid isPermaLink="false">https://www.tecmint.com/?p=60569#comment-2320945</guid>

					<description><![CDATA[I like to use:

&lt;code&gt;iproute2&lt;/code&gt; instead of &lt;code&gt;iptables&lt;/code&gt;

For example:
&lt;pre&gt;
ip route add blackhole $IP_ADDRESS
&lt;/pre&gt;
Where &lt;code&gt;$IP_ADDRESS&lt;/code&gt; is either the specific IP address or the entire netblock.

It&#039;s lighter on the system than using iptables.]]></description>
			<content:encoded><![CDATA[<p>I like to use:</p>
<p><code>iproute2</code> instead of <code>iptables</code></p>
<p>For example:</p>
<pre>
ip route add blackhole $IP_ADDRESS
</pre>
<p>Where <code>$IP_ADDRESS</code> is either the specific IP address or the entire netblock.</p>
<p>It&#8217;s lighter on the system than using iptables.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
