Kmaiti

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Wednesday, 12 January 2011

How to use tcpdump command to capture the network packet?

Posted on 21:30 by Unknown
1. Capture complete to tcp packets :


tcpdump -nnvXSs 1514 -c2 tcp


* host // look for traffic based on IP address (also works with hostname if you're not using -n)

# tcpdump host 1.2.3.4

* src, dst // find traffic from only a source or destination (eliminates one side of a host conversation)

# tcpdump src 2.3.4.5
# tcpdump dst 3.4.5.6

* net // capture an entire network using CIDR notation

# tcpdump net 1.2.3.0/24

* proto // works for tcp, udp, and icmp. Note that you don't have to type proto

# tcpdump icmp

* port // see only traffic to or from a certain port

# tcpdump port 3389
* src, dst port // filter based on the source or destination port

# tcpdump src port 1025
# tcpdump dst port 389

* src/dst, port, protocol // combine all three

# tcpdump src port 1025 and tcp
# tcpdump udp and src port 53

* Port Ranges // see traffic to any port in a range
tcpdump portrange 21-23

* Packet Size Filter // only see packets below or above a certain size (in bytes)
tcpdump less 32
tcpdump greater 128

[ You can use the symbols for less than, greater than, and less than or equal / greater than or equal signs as well. ]
// filtering for size using symbols
tcpdump > 32
tcpdump <= 128

Capture all Port 80 Traffic to a File

# tcpdump -s 1514 port 80 -w capture_file

Much important * :
--------------
Then, at some point in the future, you can then read the traffic back in like so:

Read Captured Traffic back into tcpdump

# tcpdump -r capture_file
-------------

Logical expression :
1. AND
and or &&
2. OR
or or ||
3. EXCEPT
not or !

TCP traffic from 10.5.2.3 destined for port 3389:

# tcpdump -nnvvS tcp and src 10.5.2.3 and dst port 3389

Traffic originating from the 192.168 network headed for the 10 or 172.16 networks:

# tcpdump -nvX src net 192.168.0.0/16 and dst net
10.0.0.0/8 or 172.16.0.0/16

Non-ICMP traffic destined for 192.168.0.2 from the 172.16 network:

# tcpdump -nvvXSs 1514 dst 192.168.0.2 and src net
172.16.0.0/16 and not icmp

Traffic originating from Mars or Pluto that isn't to the SSH port: // requires name resolution

# tcpdump -vv src mars or pluto and not dst port 22
=========

PS: Made it more available in the internet.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • [a fatal error or timeout occurred while processing this directive] + cpanel
    Guys, Just check the cpanel log file and you'll get the clue from there. I got following messages : execute : tail -f /usr/local/cpanel/...
  • How to access the webalizer from the outside of the cpanel?
    Guys, I don't want to post this type of article since you'll get it from the Google. But still I did. I followed following steps : E...
  • How to store sftp log messages in custom file on RHEL 6?
    How to setup chrooted sftp account on RHEL 6? $groupadd sftponly $$useradd user123 $usermod -d /myhome -g sftponly -s /bin/false user123 $mk...
  • How to verify UDP packet communication between two linux system?
    Guys, Today, I had to check UDP packet communication between linux and a windows system. Main purpose of the windows system was to capturing...
  • How to enable php in apache on RHEL ?
    1. In order to enable php engine in apache, you should make sure php is installed in the system first. Then refer following steps : locate l...
  • WHM + http showing failed ?
    Guys, Please check the log of the apache server like : 1. tail -f /usr/local/apache/logs/error_log 2. check the http port in /usr/local/apac...
  • Details about NFS timeout on Red Hat Enterprise Linux 5
    There are two mount options for timeouts of an NFS request. # timeo: a timeout value. the unit is 1/10 seconds. # retran...
  • How do I determine if my x86-compatible Intel system is multi-processor, multi-core or supports hyperthreading?
    Guys, We need to know about multi-processor, multi-core or supports hyperthreading. Here are the details : Physical ID (Physical processor o...
  • How to configure apache-tomcat on linux box?
    Environment : RHEL 5.8 Package version : JDk 1.7.0_03 Apache tomcat : 6.0.35 Reference : http://www.puschitz.com/InstallingTomcat.html JDK s...
  • make: *** [install-webconf] Error 1
    Guys, I got this error message during configuring the nagios : Here is the exact error message. ======= root@server [/usr/local/src/nagios-3...

Categories

  • ACL
  • ESX
  • Linux
  • Storage
  • UCS

Blog Archive

  • ►  2013 (5)
    • ►  May (1)
    • ►  April (3)
    • ►  February (1)
  • ►  2012 (10)
    • ►  July (1)
    • ►  June (1)
    • ►  April (1)
    • ►  March (3)
    • ►  February (3)
    • ►  January (1)
  • ▼  2011 (86)
    • ►  December (3)
    • ►  November (2)
    • ►  September (19)
    • ►  August (9)
    • ►  July (5)
    • ►  June (9)
    • ►  May (12)
    • ►  April (3)
    • ►  March (4)
    • ►  February (5)
    • ▼  January (15)
      • "Virtual Memory is NOT Virtual"...kamal maiti
      • How to allow secure mail SMTP ports at the firewall?
      • How to check the network driver on the linux machine?
      • How to increase the size of virtual memory on linux?
      • How to use tcpdump command to capture the network ...
      • First assembly programme on 64bit linux machine??
      • How to create shared object file on linux ?
      • How kernel invokes system call function on linux ?
      • How to install video player(real player) on linux ...
      • How to install mplayer on linux machine?
      • configure: error: could not find library containin...
      • How to install subversion (svn) on linux ?
      • How to install ksar on linux machine?
      • How to configure tata photon + on linux machine + ...
      • ATDT#777 ERROR --> Invalid dial command
  • ►  2010 (152)
    • ►  December (9)
    • ►  November (34)
    • ►  October (20)
    • ►  September (14)
    • ►  August (24)
    • ►  July (19)
    • ►  June (3)
    • ►  May (25)
    • ►  April (3)
    • ►  January (1)
Powered by Blogger.