Skip to content

Instantly share code, notes, and snippets.

@jodoherty
Created February 8, 2024 03:56
Show Gist options
  • Select an option

  • Save jodoherty/0a858526527d267dd65813d207e9238e to your computer and use it in GitHub Desktop.

Select an option

Save jodoherty/0a858526527d267dd65813d207e9238e to your computer and use it in GitHub Desktop.
nftables.conf
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
chain input {
type filter hook input priority 0;
# accept any localhost traffic
iif lo accept
iifname "virbr*" accept
# accept traffic originated from us
ct state established,related accept
tcp dport 5355 accept
udp dport {5353, 5355} accept
# ICMPv6 packets which must not be dropped, see https://tools.ietf.org/html/rfc4890#section-4.4.1
meta nfproto ipv6 icmpv6 type { destination-unreachable, packet-too-big, time-exceeded, parameter-problem, echo-reply, echo-request, nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert, 148, 149 } accept
ip6 saddr fe80::/10 icmpv6 type { 130, 131, 132, 143, 151, 152, 153 } accept
# count and drop any other traffic
counter drop
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment