{"id":747,"date":"2015-09-18T10:54:44","date_gmt":"2015-09-18T08:54:44","guid":{"rendered":"http:\/\/dety.net.ua\/?p=747"},"modified":"2015-09-18T10:54:44","modified_gmt":"2015-09-18T08:54:44","slug":"tcpdump-examples","status":"publish","type":"post","link":"https:\/\/dety.net.ua\/?p=747","title":{"rendered":"Tcpdump examples"},"content":{"rendered":"<p>See the list of interfaces on which tcpdump can listen:<\/p>\n<pre class=\"quotecode\">tcpdump -D<\/pre>\n<p>Listen on interface eth0:<\/p>\n<pre class=\"quotecode\">tcpdump -i eth0<\/pre>\n<p>Listen on any available interface (cannot be done in promiscuous mode. Requires Linux kernel 2.2 or greater):<\/p>\n<pre class=\"quotecode\">tcpdump -i any<\/pre>\n<p>Be verbose while capturing packets:<\/p>\n<pre class=\"quotecode\">tcpdump -v<\/pre>\n<p>Be more verbose while capturing packets:<\/p>\n<pre class=\"quotecode\">tcpdump -vv<\/pre>\n<p>Be very verbose while capturing packets:<\/p>\n<pre class=\"quotecode\">tcpdump -vvv<\/pre>\n<p>Be verbose and print the data of each packet in both hex and ASCII, excluding the link level header:<\/p>\n<pre class=\"quotecode\">tcpdump -v -X<\/pre>\n<p>Be verbose and print the data of each packet in both hex and ASCII, also including the link level header:<\/p>\n<pre class=\"quotecode\">tcpdump -v -XX<\/pre>\n<p>Be less verbose (than the default) while capturing packets:<\/p>\n<pre class=\"quotecode\">tcpdump -q<\/pre>\n<p>Limit the capture to 100 packets:<\/p>\n<pre class=\"quotecode\">tcpdump -c 100<\/pre>\n<p>Record the packet capture to a file called capture.cap:<\/p>\n<pre class=\"quotecode\">tcpdump -w capture.cap<\/pre>\n<p>Record the packet capture to a file called capture.cap but display on-screen how many packets have been captured in real-time:<\/p>\n<pre class=\"quotecode\">tcpdump -v -w capture.cap<\/pre>\n<p>Display the packets of a file called capture.cap:<\/p>\n<pre class=\"quotecode\">tcpdump -r capture.cap<\/pre>\n<p>Display the packets using maximum detail of a file called capture.cap:<\/p>\n<pre class=\"quotecode\">tcpdump -vvv -r capture.cap<\/pre>\n<p>Display IP addresses and port numbers instead of domain and service names when capturing packets (note: on some systems you need to specify -nn to display port numbers):<\/p>\n<pre class=\"quotecode\">tcpdump -n<\/pre>\n<p>Capture any packets where the destination host is 192.168.1.1. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n dst host 192.168.1.1<\/pre>\n<p>Capture any packets where the source host is 192.168.1.1. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n src host 192.168.1.1<\/pre>\n<p>Capture any packets where the source or destination host is 192.168.1.1. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n host 192.168.1.1<\/pre>\n<p>Capture any packets where the destination network is 192.168.1.0\/24. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n dst net 192.168.1.0\/24<\/pre>\n<p>Capture any packets where the source network is 192.168.1.0\/24. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n src net 192.168.1.0\/24<\/pre>\n<p>Capture any packets where the source or destination network is 192.168.1.0\/24. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n net 192.168.1.0\/24<\/pre>\n<p>Capture any packets where the destination port is 23. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n dst port 23<\/pre>\n<p>Capture any packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n dst portrange 1-1023<\/pre>\n<p>Capture only TCP packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n tcp dst portrange 1-1023<\/pre>\n<p>Capture only UDP packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n udp dst portrange 1-1023<\/pre>\n<p>Capture any packets with destination IP 192.168.1.1 and destination port 23. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n \"dst host 192.168.1.1 and dst port 23\"<\/pre>\n<p>Capture any packets with destination IP 192.168.1.1 and destination port 80 or 443. Display IP addresses and port numbers:<\/p>\n<pre class=\"quotecode\">tcpdump -n \"dst host 192.168.1.1 and (dst port 80 or dst port 443)\"<\/pre>\n<p>Capture any ICMP packets:<\/p>\n<pre class=\"quotecode\">tcpdump -v icmp<\/pre>\n<p>Capture any ARP packets:<\/p>\n<pre class=\"quotecode\">tcpdump -v arp<\/pre>\n<p>Capture either ICMP or ARP packets:<\/p>\n<pre class=\"quotecode\">tcpdump -v \"icmp or arp\"<\/pre>\n<p>Capture any packets that are broadcast or multicast:<\/p>\n<pre class=\"quotecode\">tcpdump -n \"broadcast or multicast\"<\/pre>\n<p>Capture 500 bytes of data for each packet rather than the default of 68 bytes:<\/p>\n<pre class=\"quotecode\">tcpdump -s 500<\/pre>\n<p>Capture all bytes of data within the packet:<\/p>\n<pre class=\"quotecode\">tcpdump -s 0<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>See the list of interfaces on which tcpdump can listen: tcpdump -D Listen on interface eth0: tcpdump -i eth0 Listen on any available interface (cannot be done in promiscuous mode. Requires Linux kernel 2.2 or greater): tcpdump -i any Be verbose while capturing packets: tcpdump -v Be more verbose while capturing packets: tcpdump -vv Be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6,13],"tags":[],"class_list":["post-747","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-linux","category-novosti"],"_links":{"self":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=747"}],"version-history":[{"count":1,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/747\/revisions"}],"predecessor-version":[{"id":748,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/747\/revisions\/748"}],"wp:attachment":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}