{"id":5344,"date":"2018-02-08T18:14:57","date_gmt":"2018-02-09T00:14:57","guid":{"rendered":"http:\/\/neosmart.net\/wiki\/?p=5344"},"modified":"2022-01-30T17:48:42","modified_gmt":"2022-01-30T23:48:42","slug":"filter-out-tcp-keep-alive-packets-in-wireshark","status":"publish","type":"post","link":"https:\/\/neosmart.net\/wiki\/filter-out-tcp-keep-alive-packets-in-wireshark\/","title":{"rendered":"Filter out TCP Keep-Alive packets in Wireshark"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/Wireshark.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignright  wp-image-5357 colorbox-5344\" src=\"https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/Wireshark.png?resize=154%2C154&#038;ssl=1\" alt=\"\" width=\"154\" height=\"154\" srcset=\"https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/Wireshark.png?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/Wireshark.png?resize=768%2C768&amp;ssl=1 768w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/Wireshark.png?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/Wireshark.png?resize=60%2C60&amp;ssl=1 60w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/Wireshark.png?w=800&amp;ssl=1 800w\" sizes=\"auto, (max-width: 154px) 100vw, 154px\" \/><\/a><\/p>\n<p>By default, Wireshark likes to mark TCP keep-alive packets as scary errors; opting to display them in a gruesome black-and-red and scaring anyone trying to analyze TCP dumps in an effort to debug network problems.<\/p>\n<p>The reasons for this <a href=\"https:\/\/web.archive.org\/web\/20181012143747\/http:\/\/www.lovemytool.com:80\/blog\/2014\/11\/are-tcp-keep-alive-messages-bad-by-chris-greer.html\">are complex<\/a>, but in short, most TCP keep-alive packets flagged as errors in Wireshark can be safely ignored. But having them pop up in the Wireshark trace means it&#8217;s a lot harder to spot\u00a0<em>real<\/em> errors &#8211; kind of like the boy who cried wolf. Fortunately, we can filter them out quite easily.<\/p>\n<p><!--more--><\/p>\n<p>Here&#8217;s a Wireshark analysis of some captured traffic that includes a lot of &#8220;false errors&#8221; involving TCP keep-alive packets during a regular HTTP(S) session:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5345 size-large colorbox-5344\" src=\"https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors-1024x639.png?resize=980%2C612&#038;ssl=1\" alt=\"\" width=\"980\" height=\"612\" srcset=\"https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors.png?resize=1024%2C639&amp;ssl=1 1024w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors.png?resize=768%2C479&amp;ssl=1 768w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors.png?resize=300%2C187&amp;ssl=1 300w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors.png?resize=60%2C37&amp;ssl=1 60w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors.png?resize=150%2C94&amp;ssl=1 150w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors.png?w=1397&amp;ssl=1 1397w\" sizes=\"auto, (max-width: 980px) 100vw, 980px\" \/><\/a><\/p>\n<p>And after applying this simple filter:<\/p>\n<pre><code>!(tcp.flags.ack &amp;&amp; tcp.len &lt;= 1)\r\n<\/code><\/pre>\n<p>We end up with a\u00a0<em>much<\/em> better display that actually flags\/highlights true causes for concern without overwhelming us with fake warnings about TCP keep-alive packets:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors-suppressed.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5346 size-large colorbox-5344\" src=\"https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors-suppressed.png?resize=980%2C612&#038;ssl=1\" alt=\"\" width=\"980\" height=\"612\" srcset=\"https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors-suppressed.png?resize=1024%2C639&amp;ssl=1 1024w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors-suppressed.png?resize=768%2C479&amp;ssl=1 768w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors-suppressed.png?resize=300%2C187&amp;ssl=1 300w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors-suppressed.png?resize=60%2C37&amp;ssl=1 60w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors-suppressed.png?resize=150%2C94&amp;ssl=1 150w, https:\/\/i0.wp.com\/neosmart.net\/wiki\/wp-content\/uploads\/sites\/5\/2017\/12\/keepalive-errors-suppressed.png?w=1397&amp;ssl=1 1397w\" sizes=\"auto, (max-width: 980px) 100vw, 980px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By default, Wireshark likes to mark TCP keep-alive packets as scary errors; opting to display them in a gruesome black-and-red and scaring anyone trying to analyze TCP dumps in an effort to debug network problems. The reasons for this are complex, but in short, most TCP keep-alive packets flagged as errors in Wireshark can be [&hellip;]<\/p>\n","protected":false},"author":505,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"class_list":["post-5344","post","type-post","status-publish","format-standard","hentry"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3SlTq-1oc","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/neosmart.net\/wiki\/wp-json\/wp\/v2\/posts\/5344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/neosmart.net\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/neosmart.net\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/neosmart.net\/wiki\/wp-json\/wp\/v2\/users\/505"}],"replies":[{"embeddable":true,"href":"https:\/\/neosmart.net\/wiki\/wp-json\/wp\/v2\/comments?post=5344"}],"version-history":[{"count":3,"href":"https:\/\/neosmart.net\/wiki\/wp-json\/wp\/v2\/posts\/5344\/revisions"}],"predecessor-version":[{"id":5618,"href":"https:\/\/neosmart.net\/wiki\/wp-json\/wp\/v2\/posts\/5344\/revisions\/5618"}],"wp:attachment":[{"href":"https:\/\/neosmart.net\/wiki\/wp-json\/wp\/v2\/media?parent=5344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}