All of lore.kernel.org
 help / color / mirror / Atom feed
From: zrm <zrm@trustiosity.com>
To: Jags <TheJags@protonmail.com>,
	"netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: How can I block all traffic from an IP range, irrespective of origin, going to, or coming from, using nftables in Debian 10
Date: Thu, 3 Oct 2019 15:00:57 -0400	[thread overview]
Message-ID: <f9f3c860-5b3f-a09a-ff25-375378c3715b@trustiosity.com> (raw)
In-Reply-To: <NQw8Zn-Cr6DOqlayaUmuautcCgywjg96aFaMt1t0b-YRpyo0_DvByE3-RTNVC5S80qFIYbSNVGesY3XCvGxrLlYG__BFEBaDJ_XvIa0hREI=@protonmail.com>

On 10/1/19 19:22, Jags wrote:
> hello everyone,
> 
> I would like to block all traffic from an IP range (e.g.: 123.0.0.0/8), irrespective of its origin, going to, or coming from, using nftables firewall in Debian 10.
> 
> If I understand correctly, the following will block traffic originating from that IP range.
> 
> nft insert rule ip filter INPUT ip saddr 123.0.0.0/8 counter drop
> 
> 
> But it will still allow traffic if it's in response to (or associated with) an application on my Debian machine.
> 
> The problem: When I run a torrent client and add any torrent, be it Debian/Ubuntu ISO or any other torrent, I can see a bunch of IPs from my ISP connects to the torrent.
> 
> Even if I add a torrent that have only 1 seed and no peer at all, I can see a lot of IPs from my ISP (with zero percent of torrent availability) in qBittorrent client. In fact, I have blocked like 100+ in qBittorrent but the new IPs still keep popping up under "peers".
> 
> So I'd like to block an IP range, irrespective of traffic origin, going to, or coming from, using nftables.
> 
> 
> Thanks a lot in advance.

A torrent client could try to connect to a peer in either direction, so 
if you don't want communication with that IP range at all then you would 
also want a rule to drop packets in the OUTPUT chain with that address 
range as the daddr. You may also want to use reject rather than drop in 
that case because the then the client will figure out that the peer is 
not available faster.

  reply	other threads:[~2019-10-03 19:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 23:22 How can I block all traffic from an IP range, irrespective of origin, going to, or coming from, using nftables in Debian 10 Jags
2019-10-03 19:00 ` zrm [this message]
2019-10-04  9:45   ` Jags
2019-10-04 10:18     ` Reindl Harald
2019-10-04 10:44       ` Jags
2019-10-04 11:05         ` Reindl Harald
2019-10-04 12:21           ` Jags
2019-10-04 13:06             ` Reindl Harald
2019-10-04 14:28               ` Jags
2019-10-04 15:10                 ` Reindl Harald
2019-10-04 15:47                   ` Neal P. Murphy
2019-10-04 16:25                   ` Jags
2019-10-04 20:30                     ` Anton Rieger
2019-10-04 21:27                       ` Jags
2019-10-06 17:26                         ` sean darcy
2019-10-06 23:00                           ` Jags

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9f3c860-5b3f-a09a-ff25-375378c3715b@trustiosity.com \
    --to=zrm@trustiosity.com \
    --cc=TheJags@protonmail.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.