Guten Abend zusammen,
ich habe Debian 9 im Einsatz mit nftables und einem lxc container der über NAT und freigegebene Ports von Außen erreichbar ist.
Vorweg: Alles funktioniert einwandfrei.
Aber: Meine POSTROUTING chain wird anscheinend nie (!) aufgerufen.
Mein ruleset:
user@lxTest:/$ sudo nft list ruleset
table ip nat {
chain prerouting {
type nat hook prerouting priority 0; policy accept;
# ...
}
chain postrouting {
type nat hook postrouting priority 100; policy drop;
oifname { "ens33", "lxbr3"} masquerade
counter packets 0 bytes 0
log
}
}
table inet firewall4 {
chain input {
type filter hook input priority 0; policy drop;
# ...
}
chain output {
type filter hook output priority 0; policy accept;
}
chain forward {
# ...
}
}
Alles anzeigen
Im Netz habe ich die folgende Grafik gefunden (Quelle: https://www.karlrupp.net/en/computer/nat_tutorial)
"Just before our forwarded packet leaves the machine it passes the POSTROUTING chain and then leaves through the network interface. For locally generated packets there is a small difference: Instead of passing through the PREROUTING chain it passes the OUTPUT chain and then moves on to the POSTROUTING chain."
Wenn ich es doch nun richtig verstehe heißt es doch, egal ob ich das Packet weiterleite oder "selber nutze", es geht in jedem Fall in die POSTROUTING chain.
Kann mir jemand von Euch sagen was ich falsch mache? Denn egal wie lange ich meine Maschine laufen lasse, über die Postrouting chain werden keine Pakete gezählt.
Ebenfalls erscheint nichts im syslog (log-Befehl in der postrouting-chain).
Getestet habe ich es mit einem Ping auf 8.8.8.8 sowohl vom Host aus, als auch aus meinem lxc container.
Besten Dank.