{"id":612,"date":"2013-04-23T10:53:42","date_gmt":"2013-04-23T09:53:42","guid":{"rendered":"http:\/\/www.jbahillo.com\/?p=612"},"modified":"2013-07-03T06:59:10","modified_gmt":"2013-07-03T05:59:10","slug":"debugging-iptables","status":"publish","type":"post","link":"https:\/\/www.jbahillo.com\/?p=612","title":{"rendered":"Debugging iptables"},"content":{"rendered":"<p>Today I had to debug iptables while reviewing a customer issue, which basically had problems with a VPN that allowed traffic from the client to the server, but not to any other machine in the server network.<br \/>\nA quick look at tcpdump and kern.log showed that the issue was in iptables configuration, but&#8230;which rule was the culprit?<\/p>\n<p>I have normally debugged iptables by looking at the whle set of rules, and when this is not possible due to a large amount of rules and chains, then isolating traffic and looking at the packet \/bytes counters (iptables -L chain -n -v)<\/p>\n<p>But at this point I could not isolate traffic, and decided to look for information, as there had to be anotehr way of finding which rule was causing this. Finally I found <a title=\"iptables debugging\" href=\"http:\/\/backreference.org\/2010\/06\/11\/iptables-debugging\/\" target=\"_blank\">this article <\/a><\/p>\n<p>In my cause, I just had to(I had not to load modules as it was done per default):<\/p>\n<ol>\n<li>Add a rule for send traffic to raw table and TRACE target<\/li>\n<li>Generate some traffic for seeing the rules navigation<\/li>\n<li>tail -f kern.log (I grepped the MAC for seeing only affected ones)<\/li>\n<\/ol>\n<p>Then I could see something like this:<\/p>\n<pre class=\"brush: bash; gutter: false\">Apr 22 12:58:06 foobar kernel: [967185.974770] TRACE: filter:fdns:return:5 IN=tap0 \nOUT=eth0 MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=192.168.161.2\n DST=192.168.2.250 LEN=84 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=14245 SEQ=2066 MARK=0x1\nApr 22 12:58:06 foobar kernel: [967185.974783] TRACE: filter:FORWARD:rule:9 IN=tap0\n OUT=eth0 MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=192.168.161.2\n DST=192.168.2.250 LEN=84 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=14245 SEQ=2066 MARK=0x1\nApr 22 12:58:06 foobar kernel: [967185.974796] TRACE: filter:fobjects:return:1 IN=tap0 \nOUT=eth0 MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=192.168.161.2\n DST=192.168.2.250 LEN=84 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=14245 SEQ=2066 MARK=0x1\nApr 22 12:58:06 foobar kernel: [967185.974809] TRACE: filter:FORWARD:rule:10 IN=tap0 \nOUT=eth0 MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=192.168.161.2\n DST=192.168.2.250 LEN=84 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=14245 SEQ=2066 MARK=0x1\nApr 22 12:58:06 foobar kernel: [967185.974823] TRACE: filter:fglobal:rule:2 IN=tap0\n OUT=eth0 MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=192.168.161.2\n DST=192.168.2.250 LEN=84 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=14245 SEQ=2066 MARK=0x1\nApr 22 12:58:06 foobar kernel: [967185.974836] TRACE: filter:drop:rule:1 IN=tap0\n OUT=eth0 MAC=00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD SRC=192.168.161.2\n DST=192.168.2.250 LEN=84 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=14245 SEQ=2066 MARK=0x1<\/pre>\n<p>So I could see straight forward which rule (the second in fglobal here) I had to look at in order to see why traffic was being blocked<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I had to debug iptables while reviewing a customer issue, which basically had problems with a VPN that allowed traffic from the client to the server, but not to any other machine in the server network. A quick look&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/www.jbahillo.com\/?p=612\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[10,1],"tags":[115,112,113,111,114],"class_list":["post-612","post","type-post","status-publish","format-standard","hentry","category-gnulinux","category-seguridad","tag-chain","tag-debug","tag-firewall","tag-iptables","tag-rule"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Small articles thats how how to get which rule is blocking traffic\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Javier Bahillo\"\/>\n\t<meta name=\"keywords\" content=\"iptables,debug,firewall,rule,chain,gnu\/linux,seguridad\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.jbahillo.com\/?p=612\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"es_ES\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Javier Bahillo | Blog de un Administrador de Sistemas\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Debugging iptables | Javier Bahillo\" \/>\n\t\t<meta property=\"og:description\" content=\"Small articles thats how how to get which rule is blocking traffic\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.jbahillo.com\/?p=612\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2013-04-23T09:53:42+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2013-07-03T05:59:10+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Debugging iptables | Javier Bahillo\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Small articles thats how how to get which rule is blocking traffic\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?p=612#article\",\"name\":\"Debugging iptables | Javier Bahillo\",\"headline\":\"Debugging iptables\",\"author\":{\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?author=21#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/#organization\"},\"datePublished\":\"2013-04-23T10:53:42+01:00\",\"dateModified\":\"2013-07-03T06:59:10+01:00\",\"inLanguage\":\"es-ES\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?p=612#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?p=612#webpage\"},\"articleSection\":\"GNU\\\/Linux, Seguridad, chain, debug, firewall, iptables, rule\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?p=612#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jbahillo.com#listItem\",\"position\":1,\"name\":\"Inicio\",\"item\":\"https:\\\/\\\/www.jbahillo.com\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?cat=1#listItem\",\"name\":\"Seguridad\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?cat=1#listItem\",\"position\":2,\"name\":\"Seguridad\",\"item\":\"https:\\\/\\\/www.jbahillo.com\\\/?cat=1\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?p=612#listItem\",\"name\":\"Debugging iptables\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jbahillo.com#listItem\",\"name\":\"Inicio\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?p=612#listItem\",\"position\":3,\"name\":\"Debugging iptables\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?cat=1#listItem\",\"name\":\"Seguridad\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/#organization\",\"name\":\"Javier Bahillo\",\"description\":\"Blog de un Administrador de Sistemas\",\"url\":\"https:\\\/\\\/www.jbahillo.com\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?author=21#author\",\"url\":\"https:\\\/\\\/www.jbahillo.com\\\/?author=21\",\"name\":\"Javier Bahillo\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?p=612#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/23ebe4a43dc73242549ef5e7aeabbb6f292b190480d690968359ac9f5d180474?s=96&r=g\",\"width\":96,\"height\":96,\"caption\":\"Javier Bahillo\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?p=612#webpage\",\"url\":\"https:\\\/\\\/www.jbahillo.com\\\/?p=612\",\"name\":\"Debugging iptables | Javier Bahillo\",\"description\":\"Small articles thats how how to get which rule is blocking traffic\",\"inLanguage\":\"es-ES\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?p=612#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?author=21#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/?author=21#author\"},\"datePublished\":\"2013-04-23T10:53:42+01:00\",\"dateModified\":\"2013-07-03T06:59:10+01:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/#website\",\"url\":\"https:\\\/\\\/www.jbahillo.com\\\/\",\"name\":\"Javier Bahillo\",\"description\":\"Blog de un Administrador de Sistemas\",\"inLanguage\":\"es-ES\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.jbahillo.com\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Debugging iptables | Javier Bahillo","description":"Small articles thats how how to get which rule is blocking traffic","canonical_url":"https:\/\/www.jbahillo.com\/?p=612","robots":"max-image-preview:large","keywords":"iptables,debug,firewall,rule,chain,gnu\/linux,seguridad","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.jbahillo.com\/?p=612#article","name":"Debugging iptables | Javier Bahillo","headline":"Debugging iptables","author":{"@id":"https:\/\/www.jbahillo.com\/?author=21#author"},"publisher":{"@id":"https:\/\/www.jbahillo.com\/#organization"},"datePublished":"2013-04-23T10:53:42+01:00","dateModified":"2013-07-03T06:59:10+01:00","inLanguage":"es-ES","mainEntityOfPage":{"@id":"https:\/\/www.jbahillo.com\/?p=612#webpage"},"isPartOf":{"@id":"https:\/\/www.jbahillo.com\/?p=612#webpage"},"articleSection":"GNU\/Linux, Seguridad, chain, debug, firewall, iptables, rule"},{"@type":"BreadcrumbList","@id":"https:\/\/www.jbahillo.com\/?p=612#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.jbahillo.com#listItem","position":1,"name":"Inicio","item":"https:\/\/www.jbahillo.com","nextItem":{"@type":"ListItem","@id":"https:\/\/www.jbahillo.com\/?cat=1#listItem","name":"Seguridad"}},{"@type":"ListItem","@id":"https:\/\/www.jbahillo.com\/?cat=1#listItem","position":2,"name":"Seguridad","item":"https:\/\/www.jbahillo.com\/?cat=1","nextItem":{"@type":"ListItem","@id":"https:\/\/www.jbahillo.com\/?p=612#listItem","name":"Debugging iptables"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.jbahillo.com#listItem","name":"Inicio"}},{"@type":"ListItem","@id":"https:\/\/www.jbahillo.com\/?p=612#listItem","position":3,"name":"Debugging iptables","previousItem":{"@type":"ListItem","@id":"https:\/\/www.jbahillo.com\/?cat=1#listItem","name":"Seguridad"}}]},{"@type":"Organization","@id":"https:\/\/www.jbahillo.com\/#organization","name":"Javier Bahillo","description":"Blog de un Administrador de Sistemas","url":"https:\/\/www.jbahillo.com\/"},{"@type":"Person","@id":"https:\/\/www.jbahillo.com\/?author=21#author","url":"https:\/\/www.jbahillo.com\/?author=21","name":"Javier Bahillo","image":{"@type":"ImageObject","@id":"https:\/\/www.jbahillo.com\/?p=612#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/23ebe4a43dc73242549ef5e7aeabbb6f292b190480d690968359ac9f5d180474?s=96&r=g","width":96,"height":96,"caption":"Javier Bahillo"}},{"@type":"WebPage","@id":"https:\/\/www.jbahillo.com\/?p=612#webpage","url":"https:\/\/www.jbahillo.com\/?p=612","name":"Debugging iptables | Javier Bahillo","description":"Small articles thats how how to get which rule is blocking traffic","inLanguage":"es-ES","isPartOf":{"@id":"https:\/\/www.jbahillo.com\/#website"},"breadcrumb":{"@id":"https:\/\/www.jbahillo.com\/?p=612#breadcrumblist"},"author":{"@id":"https:\/\/www.jbahillo.com\/?author=21#author"},"creator":{"@id":"https:\/\/www.jbahillo.com\/?author=21#author"},"datePublished":"2013-04-23T10:53:42+01:00","dateModified":"2013-07-03T06:59:10+01:00"},{"@type":"WebSite","@id":"https:\/\/www.jbahillo.com\/#website","url":"https:\/\/www.jbahillo.com\/","name":"Javier Bahillo","description":"Blog de un Administrador de Sistemas","inLanguage":"es-ES","publisher":{"@id":"https:\/\/www.jbahillo.com\/#organization"}}]},"og:locale":"es_ES","og:site_name":"Javier Bahillo | Blog de un Administrador de Sistemas","og:type":"article","og:title":"Debugging iptables | Javier Bahillo","og:description":"Small articles thats how how to get which rule is blocking traffic","og:url":"https:\/\/www.jbahillo.com\/?p=612","article:published_time":"2013-04-23T09:53:42+00:00","article:modified_time":"2013-07-03T05:59:10+00:00","twitter:card":"summary","twitter:title":"Debugging iptables | Javier Bahillo","twitter:description":"Small articles thats how how to get which rule is blocking traffic"},"aioseo_meta_data":{"post_id":"612","title":"Debugging iptables | #site_title","description":"Small articles thats how how to get which rule is blocking traffic","keywords":[{"label":"iptables","value":"iptables"},{"label":"debug","value":"debug"},{"label":"firewall","value":"firewall"},{"label":"rule","value":"rule"},{"label":"chain","value":"chain"}],"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"","defaultPostTypeGraph":""},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-04-23 20:46:55","updated":"2025-06-03 23:22:26","seo_analyzer_scan_date":null},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p74T96-9S","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/posts\/612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=612"}],"version-history":[{"count":11,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/posts\/612\/revisions"}],"predecessor-version":[{"id":673,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=\/wp\/v2\/posts\/612\/revisions\/673"}],"wp:attachment":[{"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jbahillo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}