Questions tagged [nftables]
packet filtering framework, userspace utility and compatibility layer for {ip,ip6}tables, developed as consolidated replacement for existing {ip,ip6,arp,eb}tables frameworks
269 questions
-1 votes
1 answer
169 views
Port knocking in Almalinux 10?
(First, please excuse me. Not a professional sysadmin, just someone who has had to set up a VPS recently). I recently set up a new Almalinux 10 box, and I wanted to add port knocking to it to further ...
1 vote
1 answer
226 views
NF Tables : why this last check is failing?
I am trying to setup some very specific rules with NF tables, but I am stuck at some point. There is obviously something I am missing. Here is the script I am using: #!/usr/sbin/nft -f flush ruleset ...
3 votes
2 answers
468 views
Nftables default deny, but allow from separate tables
I'd like to use nftables to set up a firewall in the following way: a basic table with a default-deny policy custom tables (which I'd add per service running on a machine) which allow only relevant ...
0 votes
0 answers
45 views
iptables-legacy confusing error when used with CONNMARK target
I was following solution 1 from https://unix.stackexchange.com/a/693643/29529 but I get the following error in the 1st command ~# iptables -t mangle -A INPUT -i eth1 -j CONNMARK --set-mark 2 iptables ...
0 votes
0 answers
125 views
Can't ping to wireguard local IP within docker container
I have two VPSs (SERVER-A and SERVER-B) connected to a 10.252.1.0/24 WireGuard network. The WireGuard client config in SERVER-A has AllowedIPs=10.252.1.0/24 and SERVER-B has AllowedIPs = 0.0.0.0/0. ...
0 votes
1 answer
403 views
Setup port forwarding/nat with nftables
I have a proxmox server on 73.xx.xx.xx which I wanna do a port foward to. In this case its 51800/udp to 192.168.2.2 I have configured the firewall from proxmox and the vm itself. Both processes ...
0 votes
0 answers
86 views
unable to limit concurrent connection counts using nftables on amazon linux 2023
I've launched a new AWS EC2 instance running Amazon Linux 2023. I want to set up nftables with the nftables.conf file to limit the concurrent connections per source IP so that any one user cannot hog ...
0 votes
0 answers
80 views
Webserver not responding to requests through NAT firewall
I am setting up a firewall to guard a web server. I don't need it to be secure since it is not publicly available and will not be in the near future. But I need to set up the firewall so that the ...
0 votes
1 answer
252 views
nftables syntax for ipsec/xfrm policy matching
I have an IPtables matching as -m policy --dir out --pol ipsec --mode tunnel --tunnel-src 1.1.1.2 --tunnel-dst 1.1.1.1. I know that this matching works with nftables in compatible mode as xt "...
0 votes
1 answer
172 views
Mark traffic for policy based routing
i have a seemingly easy goal: there is a certain container. i want traffic originating from that container to be routed via custom routing table to vpn. i don't need ALL container traffic to be routed ...
0 votes
1 answer
106 views
NFTables not block IP captured Fail2Ban
Default nftables: nft list ruleset table inet filter { chain input { type filter hook input priority filter; policy accept; iif "lo" accept ...
0 votes
0 answers
144 views
Outgoing access blocked (DNS, ping) by firewalld/nftables/iptables
I have a setup where I'm attempting to restrict access to the server with iptables rules that specify allowed IP ranges, like this: -A INPUT -i lo -j ACCEPT -A INPUT -s 127.0.0.0/8 -j ACCEPT -A INPUT -...
2 votes
0 answers
89 views
Linux & NFT firewall: On big set, one element's interface is always malformed
I am in the middle of installing NFT-based firewalls on some routers. Routers run Slackware linux, kernel 6.12.21, nftables 1.1.1, libnftnl 1.2.8. The actual firewalls are generated from a list of ...
1 vote
1 answer
552 views
Podman, WireGuard and nftables
I am running WireGuard in a Podman container. I have a Hub and Spoke configuration like this Client A <--> Hub <--> Client B | | Internet This is ...
0 votes
0 answers
192 views
How to Forward TCP Packets to Multiple Destinations Using nftables?
I am looking for a solution where TCP packets need to be forwarded or broadcasted to multiple destinations. Using nftables, I managed to forward packets to another machine with the following rule: nft ...
0 votes
1 answer
115 views
Routing on double gateway depending on source interface or ip
So I have an internet setup with a BGP router that provides me with my own /24 IPv4 bloc. In order to have those same IPs on a disaster recovery site, I've built a server machine on the disaster site ...
1 vote
1 answer
178 views
Forwarding breaks when bridge interface is involved
I have a very simple setup that needs to forward traffic from a WireGuard interface (wg0) to hosts connected to a LAN interface (enp0s25). [ other LAN host ] <---> enp0s25 [ server ] wg0 <---&...
0 votes
0 answers
172 views
Captive Portal in Alpine Linux Container
I am new to Networking. I am working on a project where I need to implement a Captive Portal inside an Alpine Linux container, but there are some tricky parts to it. The system I am working on uses ...
1 vote
1 answer
262 views
Mark reply packets with same as incoming packets with nftables
Before We have a server which is also a vpn client. It has so 2 interfaces: eth0 (physical) and tun0 (vpn) The vpn is only there to serve external requests: it goes to another site which directs ...
2 votes
0 answers
458 views
How to check if a specific nftable rule exists
In iptables, you can use the following command to check if a rule exists in a specific chain: iptables -C INPUT -s 192.168.254.0 -j DROP The -C option verifies the existence of the rule in the ...
0 votes
1 answer
171 views
Xen guest with static IP and masquerading with nftables
Determined to turn an old computer into a server (NAS, Home assistant, ...), I decided to learn about Virtualization with Xen Project on Debian. The server is expected to be used on LAN only and it ...
0 votes
0 answers
145 views
Traffic forwarding works on TCP but fails on UDP
I wanted to expose an IPcam to Internet using WireGuard tunnel, diagram looks like this: Client --—> ServerA -—-(wireguard)---> ServerB ---(LAN)--—> Cam I've set proper DNAT and SNAT rules; ...
-1 votes
2 answers
1k views
How do I send all TCP and UDP traffic over tproxy without making a loop?
I'm running my proxy client on the same Linux machine I'm using the connection on. In the configuration I can tell it to tproxy to port 2500. The proxy runs on port 443, using TLS (although this part ...
0 votes
1 answer
760 views
nftables: oneliner to count, log (with limit) and drop
I am using nftables v0.9.6 and the geoip database to drop inbound traffic from specific countries. For example, I have in a chain: meta mark 0x0000033a drop comment "block traffic from GB" ...
0 votes
0 answers
70 views
dns works and nft http counters rise: no webpage shows :404
0.The main problem is the nft counters increase but no web page shows. Claims http 404 error. DNS and dig report valid results.From inet firewalld filter_INPUT: '''meta l4proto {tcp,udp} ct state ...
0 votes
0 answers
1k views
How to list all blocked IPs and the related nft rule?
Recent versions of Linux's have switched for iptables to nftables. However, I am newbie with the nft command. So, my question is: How do I list all specific IPs (IPv4 & IPv6) that are blocked &...
0 votes
1 answer
317 views
firewall not blocking even it should
I use AlmaLinux 9, I understand that there is new backend service nftables which can be managed by iptables-nft command, so I set some rules and my rule set looks like: # Warning: table ip nat is ...
0 votes
2 answers
655 views
My nftables firewall allows ipv6 input on specified ports for a short while, but then blocks
I have a moderately complex ruleset, running on Debian 12, but it includes simple rules to open e.g. ports 80 and 443 (implicitly for both ipv4 and ipv6). Immediately after running "systemctl ...
0 votes
1 answer
499 views
Accessing internet from Strongswan / IKE2 VPN with nftables
I have a Ubuntu 24.04.1 LTS server, running Strongswan. I have since learned that it's using nftables and not iptables for its firewall. In setting up the VPN, I am able to connect with the client, ...
0 votes
1 answer
771 views
nftables: access a host through a different IP address
I am currently trying to solve the following problem, but my google/SO searches have not yielded a matching scenario so far: From my linux host, I must reach the destination host 172.19.28.152. ...
-1 votes
1 answer
553 views
On linux, can I implement my own TCP stack while interoperating with other processes on same host?
I'm aware of two main ways to write and receive network packets from an existing network interface on linux. The first is with the classic sockets API, in which the linux kernel is responsible for ...
0 votes
1 answer
181 views
using multiple tables to route ips from TWO ISPs
I need to configure my router (Ubuntu Server 24/ NNFTables) so that computers connected to the lan1 and lan2 interfaces can browse the internet using the wan1 or wan2 interfaces, depending on the ...
1 vote
1 answer
256 views
why nftables prerouting chain make ssh connected failed
This is my nftables config file. #/bin/sbin/nft -f flush ruleset table inet my_fw_tables { chain input_filter { type filter hook input priority filter; policy drop; ct ...
1 vote
2 answers
1k views
libvirt port forwarding to guest: What changed with 10.4.0?
Network/Firewalls isn't my strong side, so there is the possibility that I'm making a very basic mistake. I need to access services running inside my qemu guest system from other devices in my network....
1 vote
1 answer
251 views
nftables restrict access between date and time
Documentation of nftables about match concept is too weak . nftables document I want accept all traffic from ip x.w.y.z with port 80 only between two Date & Time for example : start : 2024/01/12 ...
0 votes
1 answer
796 views
Debian NAT Gateway with dnsmasq DHCP, reachable via internal IP
I have setup a Debian 12 machine as an IPv4 NAT Gateway / Router by following the various tutorials on the internet (mostly following arch wiki) and tried to do it the most modern way possible. I use ...
0 votes
1 answer
753 views
kvm libvirt: Port Forwarding via nft not working
I use KVM to virtualize a Guest-Linux-Mint on my Host-Debian12. The Guest is obviously configured well with NAT: I can ssh into the Guest from the Host, I can reach the Internet from the Guest. But I ...
0 votes
1 answer
852 views
nftables + Almalinux (CPanel): Help creating rules
I need help creating rules. According to CPanel firewall-d broke migrating from CentOS > Alma Linux. They no longer supported CentOS so I bit the bullet finally and migrated. Everything went ...
0 votes
1 answer
2k views
Configuring destination NAT nftables entire subnet
Basically what I need is to change all packets destined to one subnet to a different subnet I need this because my router has 2 VPNs and both of them use the same ip range [out of my control] This is ...
1 vote
1 answer
1k views
Bypass nftables drop rule
tldr; bridge (see below) doesn't work if there is a matching drop in another table (like the default rules of firewalld). Hello, I'm building my own VM lib (kind of quickemu). I have a problem with ...
1 vote
2 answers
589 views
Pass web traffic to VPN endpoint other than the OpenVPN envelope through the VPN itself
I have a Linux server that is an OpenVPN endpoint, but also hosts a webserver. When my client connects to the server address for the webserver, the packets travel outside the VPN. Rightly so, since ...
2 votes
2 answers
5k views
nftables rules can't ping to other server
So I have a quick and dirty firewall that I plan to use on my vps using nftables. Here's the initial rule table inet filter { chain input { type filter hook input priority 0; # ...
0 votes
1 answer
2k views
nftables fails on boot with "Error: Could not process rule: No such file or directory chain ingress" but same nft conf works with manual nft start
Over one year I have had a working nft configuration. After updating NVM of my network cards and "apt update & upgrade" I encounter the following error on boot. But nftables starts ...
1 vote
2 answers
1k views
Looping forwarded and locally originating connections through port forwarding rules in firewalld
I have a Debian box running firewalld set up a as gateway NAT/router. This device has two NICS; wan --- public interface, assigned to the external firewalld zone, dynamically assigned IP address using ...
1 vote
1 answer
2k views
How to use nftables dnat and redirect without preceding match
I have table ip nat { chain Redirect_to_local { limit rate 3/minute burst 10 packets log prefix "[nft.ip.dnat.8080]: " redirect to :8080 } chain ...
2 votes
1 answer
470 views
Can I increase readility of nftables ruleset syntax and does it affect its function?
It is not clear to me from the manual if this commands are equal in their function: meta skuid == "root" counter accept skuid 0 counter accept also ct state == { established, related } ...
1 vote
0 answers
1k views
nftables : improve anti port scanning rules
I'm looking for ways to confuse port scanners. I do realize it is not that useful, but it is mostly to slow down attackers, and also to avoid ending up on websites like Shodan (or at least make the ...
0 votes
0 answers
152 views
Parsing TCP flag Data for IP Tables
I have input file which has data like below chain:VARIABLE_IN ip_version:v4 proto:tcp sport:5401 dst_ip:18.159.158.206 dport:5432 decision:a tcpflags:&syn!=syn My code reads above data to form ...
0 votes
0 answers
193 views
How to set TCP flags "&syn!=syn" in iptables?
I have requirement where am getting parameters to set in iptables as below: Rate Limit = 1/sec Source port = 5432 Source IP = 203.0.113.0 Protocol = tcp TCP flags = &syn!=syn iptables -A PRIO_IN -...
1 vote
1 answer
839 views
Applying nftables rules to macvtap interfaces
I'm trying to expose a libvirt (qemu) virtual machine to the open world on a separate address via a promiscuous device and attached macvtap, but at the same time protect the local network from ...