Comment on nftables: Can't ping my own server
farcaller@fstab.sh 1 week ago
nftables offers a very decent debugging interface. First, you add a rule to trace the packet (a new chain with high priority works best). Usually I’d suggest to add those rules by hand instead of relying on declarative configs:
nft add table ip ping_trace nft 'add chain ip ping_trace prerouting { type filter hook prerouting priority -301; policy accept; }'
Then you add the actual tracing rule there with the shape to match the incoming traffic:
nft 'add rule ip ping_trace prerouting icmp type { echo-request, echo-reply } meta nftrace set 1'
now you can run nft monitor trace and see the decisions made for the matching packets. Remember to delete the ping_trace table afterwards to clean up.
confusedpuppy@lemmy.dbzer0.com 1 week ago
I tried what you said. I sent a ping from my computer to the server and this was the output of
nft monitor trace:I sort of get what’s happening and it looks like the ping request has been accepted.
From my computer when I send a ping it shows:
So even though it’s being accepted, I still get nothing going back to my computer, at least that’s how I understand it.
farcaller@fstab.sh 1 week ago
It is accepted just fine then. You might want to check the reverse, start in top of the output chain and trace the echo reply.
confusedpuppy@lemmy.dbzer0.com 1 week ago
How would trace the echo reply in the output chain? I tried adding
meta nftrace set 1directly to the ICMPv4 rule as well as making achain postroutingrule but I can’t seem to figure it out.farcaller@fstab.sh 1 week ago
I actually don’t remember off the top of my head, huh. The output chain is not the one I use often. I’d think
nft add rule tracing filter output ip protocol icmp icmp type echo-reply meta nftrace set 1would do it. Just make sure the priority is low enough again.