THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

Wireshark capture packets after or before firewall

Hi Does Wireshark capture packets after or before my firewall (iptables) filter the traffic?

TatnocGL's avatar
3
TatnocGL
asked 2023-04-05 06:31:59 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

Does Wireshark capture packets after or before my firewall (iptables) filter the traffic?

Wireshark uses libpcap on UN*Xes, and WinPcap/Npcap on Windows, to capture packets.

Given the "iptables", this is presumably Linux, which is a UN*X, so Wireshark uses libpcap; libpcap, on UN*X, uses PF_PACKET sockets to capture traffic.

So the questions are:

  1. Are copies of incoming packets delivered to PF_PACKET sockets before they are processed by iptables or after they are processed by iptables?
  2. Are copies of outgoing packets delivered to PF_PACKET sockets before they are processed by iptables or after they are processed by iptables?

This question on the old Wireshark Q&A site has some discussion of those questions, but not a full-blown deep dive into the Linux networking stack.

I have enough on my plate already to keep me from making such a deep dive at this point, but I suspect that the answer to the first question is "copies of incoming packets are delivered to PF_PACKET sockets before they are processed by iptables", i.e. fairly close to the point at which the packet is delivered to the networking stack by the network adapter driver, and the answer to the second question is "copies of outgoing packets are delivered to PF_PACKET sockets after they are processed by iptables", i.e. fairly close to the point at which the packet is delivered by the networking stack to the network adapter driver.

If you want a more authoritative answer, it'd probably be best to ask on a mailing list that discusses the Linux networking stack (and that has people on it familiar with both the point at which PF_PACKET sockets reside in the stack and the point at which iptables resides in the stack), or on a Q&A site that discusses the Linux networking stack (same parenthetical note).

Guy Harris's avatar
19.9k
Guy Harris
answered 2023-04-06 07:57:01 +0000
edit flag offensive 0 remove flag delete link

Comments

Thank you for your answer. That is everything what i need to know at this point.

TatnocGL's avatar TatnocGL (2023-04-06 09:59:21 +0000) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer