Blame | Last modification | View Log | RSS feed
# Sample configuration for nftables service.# Load this by calling 'nft -f /etc/nftables/main.nft'.# Note about base chain priorities:# The priority values used in these sample configs are# offset by 20 in order to avoid ambiguity when firewalld# is also running which uses an offset of 10. This means# that packets will traverse firewalld first and if not# dropped/rejected there will hit the chains defined here.# Chains created by iptables, ebtables and arptables tools# do not use an offset, so those chains are traversed first# in any case.# drop any existing nftables rulesetflush ruleset# a common table for both IPv4 and IPv6table inet nftables_svc {# protocols to allowset allowed_protocols {type inet_protoelements = { icmp, icmpv6 }}# interfaces to accept any traffic onset allowed_interfaces {type ifnameelements = { "lo" }}# services to allowset allowed_tcp_dports {type inet_serviceelements = { ssh, 9090 }}# this chain gathers all accept conditionschain allow {ct state established,related acceptmeta l4proto @allowed_protocols acceptiifname @allowed_interfaces accepttcp dport @allowed_tcp_dports accept}# base-chain for traffic to this hostchain INPUT {type filter hook input priority filter + 20policy acceptjump allowreject with icmpx type port-unreachable}}# By default, any forwarding traffic is allowed.# Uncomment the following line to filter it based# on the same criteria as input traffic.#include "/etc/nftables/router.nft"# Uncomment the following line to enable masquerading of# forwarded traffic. May be used with or without router.nft.#include "/etc/nftables/nat.nft"