All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jags <TheJags@protonmail.com>
To: Reindl Harald <h.reindl@thelounge.net>
Cc: zrm <zrm@trustiosity.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: Fri, 04 Oct 2019 10:44:46 +0000	[thread overview]
Message-ID: <lqTerZeIk1-StNEHFttel8WGdgNfa6b5P96z7iC6sT03SK29Q1_hc4KUlqd3R4f8Hdka3B_MJfQILp1Wa65JpA_cW7k2XGZtvfaN5ADlBzY=@protonmail.com> (raw)
In-Reply-To: <de499a93-2306-a681-6e2a-2c227250f8f3@thelounge.net>

Should I modify it to the following:

:::
chain output {
                type filter hook output priority 0; policy accept;

                ip daddr 123.0.0.0/8 counter reject  }
:::

and

:::
chain input {
                type filter hook input priority 0; policy drop;

                ip saddr 123.0.0.0/8 counter drop  }
:::


Many thanks.





‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, October 4, 2019 10:18 AM, Reindl Harald <h.reindl@thelounge.net> wrote:

> Am 04.10.19 um 11:45 schrieb Jags:
>
> > @zrm thank you so much for the reply.
> > (1) Would it be something like this:
> > :::::
> > chain output {
> > type filter hook output priority 0; policy accept;
> >
> >                 ip daddr 123.0.0.0/8 ct state established,related,new,invalid,untracked counter reject
> >     }
> >
> >
> > :::::
> > Because just last night I tried that, but I could still see IPs from the blocked range. Or am I missing something here.
> > Note: In this OUTPUT chain, if I change: "policy accept" to "policy drop", I lose the internet completely.
> > (2) In addition to the OUTPUT chain, I've added this into INPUT chain too:
> > :::::
> > chain input {
> > type filter hook input priority 0; policy drop;
> >
> >                 ip saddr 123.0.0.0/8 ct state established,related,new,invalid,untracked counter drop
> >     }
> >
> >
> > :::::
> > So how should I modify the either or both of the above please... many thanks
>
> it's the same as with iptables
>
> "established,related" allows responses and so when your client made a
> connection to a peer data from this peer is allowed back
>
> order matters and there is no point to change the outbound policy to DROP
>
> the policy is applied after all rules and the first mathcing action
> wins, everywhere



  reply	other threads:[~2019-10-04 10:44 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
2019-10-04  9:45   ` Jags
2019-10-04 10:18     ` Reindl Harald
2019-10-04 10:44       ` Jags [this message]
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='lqTerZeIk1-StNEHFttel8WGdgNfa6b5P96z7iC6sT03SK29Q1_hc4KUlqd3R4f8Hdka3B_MJfQILp1Wa65JpA_cW7k2XGZtvfaN5ADlBzY=@protonmail.com' \
    --to=thejags@protonmail.com \
    --cc=h.reindl@thelounge.net \
    --cc=netfilter@vger.kernel.org \
    --cc=zrm@trustiosity.com \
    /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.