Simple ruleset for a workstation: Difference between revisions

From nftables wiki
Jump to navigation Jump to search
(→‎fw.basic: not here)
No edit summary
Line 1: Line 1:
= fw.basic =
= fw.basic =
For IPv4 only workstation.


<source lang="bash">
<source lang="bash">
Line 19: Line 21:


= fw6.basic =
= fw6.basic =
For IPv6 only workstation.


<source lang="bash">
<source lang="bash">
Line 42: Line 46:
= fw.inet.basic =
= fw.inet.basic =


The inet table is available from Linux kernel 3.14 and allow to use a dual-stack IPv4/IPv6 table. There is mostly a
For dual-stack IPv4/IPv6 workstation.
single change compared to previous ruleset which is the ''inet'' keyword.


<source lang="bash">
<source lang="bash">
Line 56: Line 59:
                 ct state established,related accept
                 ct state established,related accept


                 # accept neighbour discovery otherwise connectivity breaks
                 # accept neighbour discovery otherwise IPv6 connectivity breaks
                 ip6 nexthdr icmpv6 icmpv6 type { nd-neighbor-solicit, echo-request, nd-router-advert, nd-neighbor-advert } accept
                 icmpv6 type { nd-neighbor-solicit, echo-request, nd-router-advert, nd-neighbor-advert } accept


                 # count and drop any other traffic
                 # count and drop any other traffic

Revision as of 06:08, 11 August 2021

fw.basic

For IPv4 only workstation.

table ip filter {
     chain input {
          type filter hook input priority 0;

          # accept traffic originated from us
          ct state established,related accept

          # accept any localhost traffic
          iif lo accept

          # count and drop any other traffic
          counter drop
     }
}

fw6.basic

For IPv6 only workstation.

table ip6 filter {
        chain input {
                 type filter hook input priority 0;

                 # accept any localhost traffic
                 iif lo accept

                 # accept traffic originated from us
                 ct state established,related accept

                 # accept neighbour discovery otherwise connectivity breaks
                 icmpv6 type { nd-neighbor-solicit, echo-request, nd-router-advert, nd-neighbor-advert } accept

                 # count and drop any other traffic
                 counter drop
        }
}

fw.inet.basic

For dual-stack IPv4/IPv6 workstation.

table inet filter {
        chain input {
                 type filter hook input priority 0;

                 # accept any localhost traffic
                 iif lo accept

                 # accept traffic originated from us
                 ct state established,related accept

                 # accept neighbour discovery otherwise IPv6 connectivity breaks
                 icmpv6 type { nd-neighbor-solicit, echo-request, nd-router-advert, nd-neighbor-advert } accept

                 # count and drop any other traffic
                 counter drop
        }
}