{"id":11683,"date":"2019-03-15T22:10:54","date_gmt":"2019-03-15T22:10:54","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=11683"},"modified":"2019-03-15T22:10:54","modified_gmt":"2019-03-15T22:10:54","slug":"10-tips-on-how-to-use-wireshark-to-analyze-packets-in-your-network","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/15\/10-tips-on-how-to-use-wireshark-to-analyze-packets-in-your-network\/","title":{"rendered":"10 Tips On How to Use Wireshark to Analyze Packets in Your Network"},"content":{"rendered":"<p>In any packet-switched network, packets represent units of data that are transmitted between computers. It is the responsibility of network engineers and system administrators alike to\u00a0<a href=\"https:\/\/www.tecmint.com\/bmon-network-bandwidth-monitoring-debugging-linux\/\" target=\"_blank\" rel=\"noopener\">monitor and inspect the packets for security<\/a>\u00a0and troubleshooting purposes.<\/p>\n<p>To do this, they rely on software programs called\u00a0<a href=\"https:\/\/www.tecmint.com\/12-tcpdump-commands-a-network-sniffer-tool\/\" target=\"_blank\" rel=\"noopener\">network packet analyzers<\/a>, with\u00a0<strong>Wireshark<\/strong>\u00a0perhaps being the most popular and used due to its versatility and easiness of use. On top of this, Wireshark allows you to not only\u00a0<a href=\"https:\/\/www.tecmint.com\/install-vnstat-and-vnstati-to-monitor-linux-network-traffic\/\" target=\"_blank\" rel=\"noopener\">monitor traffic in real-time<\/a>, but also to save it to a file for later inspection.<\/p>\n<p>In this article we will share 10 tips on how to use\u00a0<strong>Wireshark<\/strong>\u00a0to analyze packets in your network, and hope that when you reach the Summary section you will feel inclined to add it to your bookmarks.<\/p>\n<h3>Installing Wireshark in Linux<\/h3>\n<p>To install\u00a0<strong>Wireshark<\/strong>, select the right installer for your operating system \/ architecture from\u00a0<a href=\"https:\/\/www.wireshark.org\/download.html\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/www.wireshark.org\/download.html<\/a>.<\/p>\n<p>Particularly, if you are using Linux, Wireshark must be available directly from your distribution\u2019s repositories for an easier install at your convenience. Although versions may differ, the options and menus should be similar \u2013 if not identical in each one.<\/p>\n<pre><strong>------------ On Debian\/Ubuntu based Distros ------------<\/strong> \r\n$ sudo apt-get install wireshark\r\n\r\n<strong>------------ On CentOS\/RHEL based Distros ------------<\/strong>\r\n$ sudo yum install wireshark\r\n\r\n<strong>------------ On Fedora 22+ Releases ------------<\/strong>\r\n$ sudo dnf install wireshark\r\n<\/pre>\n<p>There is a known bug in\u00a0<strong>Debian<\/strong>\u00a0and derivatives that may prevent listing the network interfaces unless you\u00a0<a href=\"https:\/\/www.tecmint.com\/sudoers-configurations-for-setting-sudo-in-linux\/\" target=\"_blank\" rel=\"noopener\">use sudo<\/a>\u00a0to launch Wireshark. To fix this, follow the accepted answer in\u00a0<a href=\"https:\/\/ask.wireshark.org\/questions\/7523\/ubuntu-machine-no-interfaces-listed\" target=\"_blank\" rel=\"nofollow noopener\">this post<\/a>.<\/p>\n<p>Once\u00a0<strong>Wireshark<\/strong>\u00a0is running, you can select the network interface that you want to monitor under\u00a0<strong>Capture<\/strong>:<\/p>\n<div id=\"attachment_24735\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Wireshark-Network-Analyzer.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24735\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Wireshark-Network-Analyzer.png\" alt=\"Wireshark Network Analyzer\" width=\"324\" height=\"252\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Wireshark Network Analyzer<\/p>\n<\/div>\n<p>In this article we will use\u00a0<code>eth0<\/code>, but you can choose another one if you wish. Don\u2019t click on the interface yet \u2013 we will do so later once we have reviewed a few capture options.<\/p>\n<h4>Setting Capture Options<\/h4>\n<p>The most useful capture options we will consider are:<\/p>\n<ol>\n<li><strong>Network interface<\/strong>\u00a0\u2013 As we explained before, we will only analyze packets coming through\u00a0<strong>eth0<\/strong>, either incoming or outcoming.<\/li>\n<li><strong>Capture filter<\/strong>\u00a0\u2013 This option allows us to indicate what kind of traffic we want to monitor by port, protocol, or type.<\/li>\n<\/ol>\n<p>Before we proceed with the tips, it is important to note that some organizations forbid the use of\u00a0<strong>Wireshark<\/strong>\u00a0in their networks. That said, if you are not utilizing Wireshark for personal purposes make sure your organization allows its use.<\/p>\n<p>For the time being, just select\u00a0<code>eth0<\/code>\u00a0from the dropdown list and click\u00a0<strong>Start<\/strong>\u00a0at the button. You will start seeing all traffic passing through that interface. Not really useful for monitoring purposes due to the high amount of packets inspected, but it\u2019s a start.<\/p>\n<div id=\"attachment_24736\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-Network-Interface-Traffic.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24736\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-Network-Interface-Traffic.png\" alt=\"Monitor Network Interface Traffic\" width=\"638\" height=\"278\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Monitor Network Interface Traffic<\/p>\n<\/div>\n<p>In the above image we can also see the\u00a0<strong>icons<\/strong>\u00a0to list the available interfaces, to\u00a0<strong>stop<\/strong>\u00a0the current capture, and to\u00a0<strong>restart<\/strong>\u00a0it (red box on the\u00a0<strong>left<\/strong>) and to configure and edit a filter (red box on the\u00a0<strong>right<\/strong>). When you hover over one of these icons, a tooltip will be displayed to indicate what it does.<\/p>\n<p>We will begin by illustrating capture options, whereas tips\u00a0<strong>#7<\/strong>\u00a0through\u00a0<strong>#10<\/strong>\u00a0will discuss how to do actually do something useful with a capture.<\/p>\n<h3>TIP #1 \u2013 Inspect HTTP Traffic<\/h3>\n<p>Type\u00a0<code>http<\/code>\u00a0in the filter box and click\u00a0<strong>Apply<\/strong>. Launch your browser and go to any site you wish:<\/p>\n<div id=\"attachment_24737\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Inspect-HTTP-Network-Traffic-.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24737\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Inspect-HTTP-Network-Traffic-.png\" alt=\"Inspect HTTP Network Traffic\" width=\"752\" height=\"141\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Inspect HTTP Network Traffic<\/p>\n<\/div>\n<p>To begin every subsequent tip, stop the live capture and edit the capture filter.<\/p>\n<h3>TIP #2 \u2013 Inspect HTTP Traffic from a Given IP Address<\/h3>\n<p>In this particular tip, we will prepend\u00a0<code>ip==192.168.0.10&amp;&amp;<\/code>\u00a0to the filter stanza to monitor HTTP traffic between the local computer and\u00a0<strong>192.168.0.10<\/strong>:<\/p>\n<div id=\"attachment_24738\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Inspect-HTTP-Traffic-on-IP-Address.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24738\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Inspect-HTTP-Traffic-on-IP-Address.png\" alt=\"Inspect HTTP Traffic on IP Address\" width=\"547\" height=\"184\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Inspect HTTP Traffic on IP Address<\/p>\n<\/div>\n<h3>TIP #3 \u2013 Inspect HTTP Traffic to a Given IP Address<\/h3>\n<p>Closely related with\u00a0<strong>#2<\/strong>, in this case we will use\u00a0<code>ip.dst<\/code>\u00a0as part of the capture filter as follows:<\/p>\n<pre>ip.dst==192.168.0.10&amp;&amp;http\r\n<\/pre>\n<div id=\"attachment_24739\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-HTTP-Network-Traffic-to-IP.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24739\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-HTTP-Network-Traffic-to-IP.png\" alt=\"Monitor HTTP Network Traffic to IP Address\" width=\"589\" height=\"169\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Monitor HTTP Network Traffic to IP Address<\/p>\n<\/div>\n<p>To combine tips\u00a0<strong>#2<\/strong>\u00a0and\u00a0<strong>#3<\/strong>, you can use\u00a0<code>ip.addr<\/code>\u00a0in the filter rule instead of\u00a0<code>ip.src<\/code>\u00a0or\u00a0<code>ip.dst<\/code>.<\/p>\n<h3>TIP #4 \u2013 Monitor Apache and MySQL Network Traffic<\/h3>\n<p>Sometimes you will be interested in inspecting traffic that matches either (or both) conditions whatsoever. For example, to monitor traffic on TCP ports\u00a0<strong>80<\/strong>\u00a0(web server) and\u00a0<strong>3306<\/strong>\u00a0(MySQL \/ MariaDB database server), you can use an\u00a0<code>OR<\/code>\u00a0condition in the capture filter:<\/p>\n<pre>tcp.port==80||tcp.port==3306\r\n<\/pre>\n<div id=\"attachment_24740\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-Apache-and-MySQL-Traffic.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24740\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-Apache-and-MySQL-Traffic.png\" sizes=\"auto, (max-width: 826px) 100vw, 826px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-Apache-and-MySQL-Traffic.png 826w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-Apache-and-MySQL-Traffic-768x201.png 768w\" alt=\"Monitor Apache and MySQL Traffic\" width=\"826\" height=\"216\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Monitor Apache and MySQL Traffic<\/p>\n<\/div>\n<p>In tips\u00a0<strong>#2<\/strong>\u00a0and\u00a0<strong>#3<\/strong>,\u00a0<code>||<\/code>\u00a0and the word\u00a0<strong>or<\/strong>\u00a0produce the same results. Same with\u00a0<code>&amp;&amp;<\/code>\u00a0and the word\u00a0<strong>and<\/strong>.<\/p>\n<h3>TIP #5 \u2013 Reject Packets to Given IP Address<\/h3>\n<p>To exclude packets not matching the filter rule, use\u00a0<code>!<\/code>\u00a0and enclose the rule within parentheses. For example, to exclude packages originating from or being directed to a given IP address, you can use:<\/p>\n<pre>!(ip.addr == 192.168.0.10)\r\n<\/pre>\n<h3>TIP #6 \u2013 Monitor Local Network Traffic (192.168.0.0\/24)<\/h3>\n<p>The following filter rule will display only local traffic and exclude packets going to and coming from the Internet:<\/p>\n<pre>ip.src==192.168.0.0\/24 and ip.dst==192.168.0.0\/24\r\n<\/pre>\n<div id=\"attachment_24741\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-Local-Network-Traffic.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24741\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-Local-Network-Traffic.png\" alt=\"Monitor Local Network Traffic\" width=\"757\" height=\"283\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Monitor Local Network Traffic<\/p>\n<\/div>\n<h3>TIP #7 \u2013 Monitor the Contents of a TCP Conversation<\/h3>\n<p>To inspect the contents of a\u00a0<strong>TCP<\/strong>\u00a0conversation (data exchange), right click on a given packet and choose Follow\u00a0<strong>TCP<\/strong>\u00a0stream. A window will pop-up with the content of the conversation.<\/p>\n<p>This will include\u00a0<strong>HTTP<\/strong>\u00a0headers if we are inspecting web traffic, and also any plain text credentials transmitted during the process, if any.<\/p>\n<div id=\"attachment_24742\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-TCP-Conversation.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24742\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Monitor-TCP-Conversation.png\" alt=\"Monitor TCP Conversation\" width=\"480\" height=\"338\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Monitor TCP Conversation<\/p>\n<\/div>\n<h3>TIP #8 \u2013 Edit Coloring Rules<\/h3>\n<p>By now I am sure you already noticed that each row in the capture window is colored. By default,\u00a0<strong>HTTP<\/strong>\u00a0traffic appears in\u00a0<strong>green<\/strong>\u00a0background with black text, whereas\u00a0<strong>checksum<\/strong>\u00a0errors are shown in\u00a0<strong>red<\/strong>\u00a0text with black background.<\/p>\n<p>If you wish to change these settings, click the\u00a0<strong>Edit<\/strong>\u00a0coloring rules icon, choose a given filter and click\u00a0<strong>Edit<\/strong>.<\/p>\n<div id=\"attachment_24743\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Customize-Wireshark-Output-in-Colors.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24743\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Customize-Wireshark-Output-in-Colors.png\" alt=\"Customize Wireshark Output in Colors\" width=\"681\" height=\"351\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Customize Wireshark Output in Colors<\/p>\n<\/div>\n<h3>TIP #9 \u2013 Save the Capture to a File<\/h3>\n<p>Saving the contents of a capture will allow us to be able to inspect it with greater detail. To do this, go to\u00a0<strong>File \u2192 Export<\/strong>\u00a0and choose an export format from the list:<\/p>\n<div id=\"attachment_24744\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Save-Wireshark-Capture-to-File.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24744\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Save-Wireshark-Capture-to-File.png\" sizes=\"auto, (max-width: 955px) 100vw, 955px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Save-Wireshark-Capture-to-File.png 955w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2012\/08\/Save-Wireshark-Capture-to-File-768x339.png 768w\" alt=\"Save Wireshark Capture to File\" width=\"955\" height=\"422\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Save Wireshark Capture to File<\/p>\n<\/div>\n<h3>TIP #10 \u2013 Practice with Capture Samples<\/h3>\n<p>If you think your network is \u201c<strong>boring<\/strong>\u201d, Wireshark provides a series of sample capture files that you can use to practice and learn. You can download these\u00a0<a href=\"https:\/\/wiki.wireshark.org\/SampleCaptures\" target=\"_blank\" rel=\"nofollow noopener\">SampleCaptures<\/a>\u00a0and import them via the\u00a0<strong>File \u2192 Import<\/strong>\u00a0menu.<\/p>\n<h5>Summary<\/h5>\n<p><strong>Wireshark<\/strong>\u00a0is free and open source software, as you can see in the\u00a0<a href=\"https:\/\/www.wireshark.org\/faq.html\" target=\"_blank\" rel=\"nofollow noopener\">FAQs section<\/a>\u00a0of the official website. You can configure a capture filter either before or after starting an inspection.<\/p>\n<p>In case you didn\u2019t notice, the filter has an autocomplete feature that allows you to easily search for the most used options that you can customize later. With that, the sky is the limit!<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/wireshark-network-traffic-analyzer-for-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In any packet-switched network, packets represent units of data that are transmitted between computers. It is the responsibility of network engineers and system administrators alike to\u00a0monitor and inspect the packets for security\u00a0and troubleshooting purposes. To do this, they rely on software programs called\u00a0network packet analyzers, with\u00a0Wireshark\u00a0perhaps being the most popular and used due to its &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/15\/10-tips-on-how-to-use-wireshark-to-analyze-packets-in-your-network\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;10 Tips On How to Use Wireshark to Analyze Packets in Your Network&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11683","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=11683"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11683\/revisions"}],"predecessor-version":[{"id":11684,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11683\/revisions\/11684"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=11683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=11683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=11683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}