First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

Filter RFC1918 prefixes

  • retag add tags

I need a little help to build a display filter to exclude the traffic based on RFC1918 (Source and Destination).

moraist's avatar
9
moraist
asked 2022-12-01 23:20:01 +0000
edit flag offensive 0 remove flag close merge delete

Comments

Wireshark version?

Jaap's avatar Jaap (2022-12-02 06:51:51 +0000) edit
add a comment see more comments

3 Answers

1
!(ip.addr == 10.0.0.0/8 || ip.addr == 172.16.0.0/12 || ip.addr == 192.168.0.0/16)

comes to mind.

hugo.vanderkooij's avatar
76
hugo.vanderkooij
answered 2022-12-02 07:22:15 +0000
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

You might want to use one of the default display filter macros:

Either source or destination in the RFC1918 ranges: ${private_ipv4:ip.src} or ${private_ipv4:ip.dst} Both source and destination in the RFC1918 ranges: (${private_ipv4:ip.src}) and (${private_ipv4:ip.dst})

NB: The parentices in the 2nd one are needed as the macro has an "or" in it and does not have parantices in the macro itself, I think this should be changed :-)

SYN-bit's avatar
18.5k
SYN-bit
answered 2022-12-14 14:13:29 +0000
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

!(ip.src in {10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16} || ip.dst in {10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16})

If using Wireshark version 4.0+, the above display filter will eliminate the packets with RFC1918 addresses in EITHER the ip.src or ip.dst fields. Keep in mind you will still see broadcast/multicast, L2 protocols, and IPv6 traffic. You'll need to add those to the negated statement if you don't wish to see that traffic.

If you are wanting to only eliminate traffic that contains RFC1918 address in BOTH the ip.src and ip.dst fields, then the following display filter will accomplish that request.

!(ip.src in {10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16} && ip.dst in {10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16})
Rooster_50's avatar
254
Rooster_50
answered 2022-12-13 23:04:57 +0000, updated 2022-12-13 23:16:09 +0000
edit flag offensive 0 remove flag delete link

Comments

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