The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > Linux
Google UNIX.COM


Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
i would like to know about tcpdump chamnanpol Security 0 07-03-2008 02:17 AM
tcpdump on AIX nymus7 AIX 4 01-16-2008 05:51 PM
R-326: tcpdump iBot Security Advisories (RSS) 0 01-08-2008 09:50 AM
tcpdump ant04 UNIX for Dummies Questions & Answers 2 09-07-2004 03:36 PM
How To Use tcpdump chenhao_no1 High Level Programming 2 04-01-2003 05:15 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 07-31-2008
Registered User
 

Join Date: Jun 2008
Posts: 7
Capturing TCPDUMP

Hi,

I want to capture TCPDUMP of traffic, I tried doing this but did not find success..can anyone plz correct it.

[root@labdevice1 osuresh]# tcpdump -s0 -vv -w /home/osuresh/test_tcp_dump host 10.12.10.22 && port 161
bash: tcpdump: command not found

[root@labdevice1 osuresh]# tcpdump -s0 -vv -w /home/osuresh/test_tcp_dump host 10.12.10.22
bash: tcpdump: command not found

[root@labdevice1 osuresh]# tcpdump -s0 -vv -w /home/osuresh/test_tcp_dump port 161
bash: tcpdump: command not found

Appreciate all responses.
Reply With Quote
Forum Sponsor
  #2  
Old 07-31-2008
Ikon's Avatar
Registered User
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 350
appears tcpdump is not installed or not in the path.

try: /usr/sbin/tcpdump

or install it.
Reply With Quote
  #3  
Old 07-31-2008
Registered User
 

Join Date: Jun 2008
Posts: 7
I could observe tcpdump in /usr/sbin/
but not sure if I need to execute:
tcpdump -s0 -vv -w /usr/sbin/tcpdump host 10.12.10.22 && port 161


[root@labdevice1 sbin]# tcpdump -s0 -vv -w /home/osuresh/test_tcp_dump host 10.12.10.22 && port 161
bash: tcpdump: command not found
Reply With Quote
  #4  
Old 08-01-2008
Registered User
 

Join Date: May 2008
Posts: 75
Do you have permissions to use it? (execute)

Also, why not try the full path in your command?
Reply With Quote
  #5  
Old 08-04-2008
Registered User
 

Join Date: Aug 2008
Location: Portugal
Posts: 212
Code:
[root@labdevice1 sbin]# tcpdump -s0 -vv -w /home/osuresh/test_tcp_dump host 10.12.10.22 && port 161
bash: tcpdump: command not found
That would only work if you had "." in your environment variable PATH. Anyway, sbin is not in your PATH and it should be. Anyway, try doing ./tcpdump in your sbin directory, or use the full path /usr/sbin/tcpdump.
Reply With Quote
  #6  
Old 08-07-2008
Registered User
 

Join Date: Mar 2006
Posts: 141
There's another issue with your dump command
I would guess by merely looking at it.
Quote:
tcpdump -s0 -vv -w /home/osuresh/test_tcp_dump host 10.12.10.22 && port 161
If you insist on using && I would think you will have to escape each ampersand,
or single quote the entire tcpdump logical expression
to prevent the probably non-existing command port 161 from being tried to be executed by the shell after the preceding tcpdump has finished successfully.
If you are too lazy to escape you could as well replace && by and.
Also, as far as I remember tcpdump will grab the first NIC if you don't explicitly tell it
by -i ethN which one to use.
You could as well use -i any to let it sniff on every available NIC
but then it wouldn't set them into promiscuous mode,
which probably anyway would be wiser altogether because you are generally only interested in packets destined for your host.
So it's save to add -p.
Quote:
I could observe tcpdump in /usr/sbin/
but not sure if I need to execute:
tcpdump -s0 -vv -w /usr/sbin/tcpdump host 10.12.10.22 && port 161
Please no, (I'm not even sure if tcpdump would allow such stupid abuse)
but by that you would tell it to overwrite its own executable with the dump it filtered!
What the others meant was to give the full path to the command
in case your root user hadn't /usr/sbin in his $PATH
which seems quite unlikely anyway.
e.g.
Code:
# /usr/sbin/tcpdump -p -i eth0 -s0 -w /home/osuresh/test_tcp_dump 10.12.10.22 and port 161
Given the difficulties you already encounter properly executing the command
I am afraid I am a bit suspicious if you know what to do with the dump in the end?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0