LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-22-2005, 05:16 PM   #1
JMakar
LQ Newbie
 
Registered: Mar 2005
Posts: 6

Rep: Reputation: 0
tcpdump not filtering on switch


OK, I'm a newbie & have a question...

When I hook up to the monitoring port on the HP Procurve switch and run tcpdump, I can see all the traffic. BUT, if I filter (ex: tcpdump -n tcp) nothing shows up at all. No arp, no ip, no tcp....

Have hooked this same box up to a hub and had no problems at all with filtering the packets. Does anyone know what is causing the packets not to filter when hooked up to the switch & know how to get this to work?

Thanks
 
Old 03-22-2005, 07:02 PM   #2
pfunk
Member
 
Registered: Jun 2002
Distribution: Suse, Redhat, Knoppix
Posts: 104

Rep: Reputation: 15
I'm not positive but I think some switches do ARP and IP layer filtering ....
 
Old 03-22-2005, 08:58 PM   #3
scowles
Member
 
Registered: Sep 2004
Location: Texas, USA
Distribution: Fedora
Posts: 620

Rep: Reputation: 31
The tcpdump command you posted should just print tcp based packets. Since its not, then I would think the packets being sent out the monitoring port are probably still tagged or encapsulated (like dot1q vlan trunks, qos, etc...). If thats the case, then you will probably have to add a tcpdump offset into the captured frame to get at the protocol header to properly filter when using the monitoring port.

BTW: tcpdump supports specifying vlan ID's as a command line argument. Check the tcpdump man page.
 
Old 03-29-2005, 06:51 AM   #4
jarod
LQ Newbie
 
Registered: Jul 2003
Location: .ro
Posts: 10

Rep: Reputation: 0
I have a similar problem the difference being that I'm running tcpdump on a linux router. I'm trying to capture tcp packets that have the destination port in a specific range. I've read the manual and searched the net and this came up. So i tried
Code:
tcpdump -xs 1500 -i eth0 "tcp[2:2]>=1000 and tcp[2:2]<=2000"
but it didn't capture anything (i sent packets with the destination port in the specified range, so it should have captured them). On the other hand,
Code:
tcpdump -xs 1500 -i eth0 tcp[2:2]=1000
works (it captures packets with dst port = 1000). I can't figure it out. What am I doing wrong here?
 
Old 03-31-2005, 11:37 AM   #5
jeickal
Member
 
Registered: Oct 2004
Distribution: Mandrake, DSL, SuSE, RedHat
Posts: 71

Rep: Reputation: 15
Quote:
if I filter (ex: tcpdump -n tcp) nothing shows up at all. No arp, no ip, no tcp...
This is normal. ARP is a layer-2 protocol. You won't see if you filter TCP traffic. Most of the traffic you see by typing only
Code:
tcpdump
is layer-2 traffic.
TCP is a layer-4 protocol, so If you wanna see something when you filter the TCP traffic, try generating some traffic using a one of the TCP protocol (HTTP, FTP, telnet, SSH, ...)
Then you will see sth
 
Old 03-31-2005, 05:15 PM   #6
jarod
LQ Newbie
 
Registered: Jul 2003
Location: .ro
Posts: 10

Rep: Reputation: 0
Regarding my problem, I've been told to use the -O option so the packet-matching code optimizer won't be run. The syntax that does what I want would look something like this:
Code:
tcpdump -O -xs 1500 -i eth0 "tcp[2:2]>=1000 and tcp[2:2]<=2000"

Last edited by jarod; 03-31-2005 at 05:17 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tcpdump Tihi Linux - Security 3 06-01-2005 05:54 AM
thread switch results in kernel stack switch superstition Linux - General 1 05-17-2005 11:48 PM
set up DSL thru SWITCH - winXp connected to SWITCH too husz Linux - Newbie 5 04-22-2004 12:08 AM
Sendmail Spam filtering and Virus filtering MrJoshua Linux - General 2 04-03-2003 10:12 AM
tcpdump filtering g_goblin Linux - Networking 0 03-10-2003 09:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration