Tcpdump filter does not apply

For some reason, my tcpdump filters are not functioning properly when using eth1. The same filters apply to eth0 without issues.
Nothing shows up in dmesg or /var/log/messages.
tcpdump version 3.9.4, libpcap version 0.9.4


/usr/sbin/tcpdump -i eth0 -n host 192.168.100.86
returns valid packets

/usr/sbin/tcpdump -i eth1 -n | grep 192.168.100.86
works, returns valid packets

/usr/sbin/tcpdump -i eth1 -n host 192.168.100.86
returns nothing, break gives
0 packets captured
"X" packets received by filter
0 packets dropped by kernel
LVL 1
timbrighamAsked:
Who is Participating?
 
timbrighamConnect With a Mentor Author Commented:
I found a workaround by defining pass rules for all TCP / UDP / ICMP for specific IP ranges. Not ideal, but it works.
Awarding points to giltjr for his extensive help.
0
 
timbrighamAuthor Commented:
Additional info, filtering by destination.
I *should* see the packets with the 192.168.100.86 address using the filter, right?
/usr/sbin/tcpdump -i eth1 -n | grep 4.2.2.2
12:00:09.839973 IP 192.168.100.86 > 4.2.2.2: ICMP echo request, id 768, seq 19712, length 40
12:00:09.840100 IP 65.167.121.106 > 4.2.2.2: ICMP echo request, id 11045, seq 19712, length 40
12:00:09.855686 IP 4.2.2.2 > 65.167.121.106: ICMP echo reply, id 11045, seq 19712, length 40
12:00:09.855752 IP 4.2.2.2 > 192.168.100.86: ICMP echo reply, id 768, seq 19712, length 40
 
/usr/sbin/tcpdump -i eth1 -n dst host 4.2.2.2
11:59:35.615753 IP 65.167.121.106 > 4.2.2.2: ICMP echo request, id 11044, seq 19456, length 40
11:59:35.631495 IP 4.2.2.2 > 65.167.121.106: ICMP echo reply, id 11044, seq 19456, length 40

Open in new window

0
 
giltjrCommented:
What distribution of Linux are you using?  Can you upgrade to a newer release of tcpdump?

Using dst host 4.2.2.2 you should see all packets leaving that interface going to that host.
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
timbrighamAuthor Commented:
I'm running CentOS 5.3. I'll run another yum update to see if it resolves the issue.
I haven't found any CentOS RPMs for 4.0 / 1.0,  and installing from source is against company policy.
0
 
giltjrCommented:
You may want to try capturing to a file and see what happens, you don't need the -n when going to a file.  Then you can use something like wireshark to decode the file.
0
 
timbrighamAuthor Commented:
I opened the dump file with an old copy of Ethereal. It only shows the packets from the public interfaces, same as tcpdump.
0
 
timbrighamAuthor Commented:
I updated and rebooted the machine running tcpdump, no change.
0
 
giltjrCommented:
What do you mean by "public" interfaces?

You may want to try using -i any see what you get and what interface (based on MAC address) it is going out on.
0
 
timbrighamAuthor Commented:
Sorry, public IPs, not interfaces. Everything comes in through eth1. I always use the -i argument assigned to eth1.
tcpdump is running behind a tap concentrator connected to eth1 which pulls in data from both the inside and outside interfaces of a firewall.
0
 
giltjrCommented:
Where is 192.168.100.86 on the network?  Is this PC on that subnet?  If so, which interface?
0
 
timbrighamAuthor Commented:
Internet-Tap-Firewall-Tap-Network Switch-192.168.100.86

eth1 on the tcpdump machine connects to both the taps listed here.
eth0 on the tcpdump machine is 192.168.100.30, for management.
0
 
giltjrConnect With a Mentor Commented:
I will assume that you are using a /24 subnet, so eth0 is on the 192.168.100.0/24 subnet.  That may have something to do with it.

Do you have the problem only with addresses in the 192.168.100.0/24 subnet?

I will see if I can setup a similar enviroment, but my guess is that something weird is happening with the filter because you have a interface within the subnet you are looking for, but it is not on the interface that you are capturing on.  I've never had that setup.
0
 
timbrighamAuthor Commented:
Yes, that is correct. The only problems I'm having are on the 192.168.100.0/24 subnet.
0
 
giltjrCommented:
I'll see if I can setup something similar, but not sure when I can.  My best guess right now is that because you have one interface on the subnet you are attempting to filter on something under the covers something is expecting that traffic on eth0 and will ignore it on eth1.
0
 
timbrighamAuthor Commented:
I'll try changing the management IP to a separate subnet so we can verify if this is indeed the case.
0
 
timbrighamAuthor Commented:
I configured the management interface in the 172.16.22.0/24 subnet without any change in filter behavior.
0
 
giltjrCommented:
Um, do you have a entry in your route table for the 192.168.100.0/24 subnet that points to eth0?
0
 
timbrighamAuthor Commented:
Not sure about when I changed the system to use the 172.16.22.0/24 range, but now that it is back in the 192.168.100.0/24 range yes, I do have an entry in the route table for that subnet.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.