{"id":780,"date":"2017-01-18T12:18:06","date_gmt":"2017-01-18T12:18:06","guid":{"rendered":"http:\/\/koala-wp.ecko.me\/?p=780"},"modified":"2017-01-18T12:18:06","modified_gmt":"2017-01-18T12:18:06","slug":"iptables-essentials-common-firewall-rules-and-commands","status":"publish","type":"post","link":"https:\/\/crownandluxury.com\/?p=780","title":{"rendered":"Linux Server Essentials: Common Firewall Rules and Commands"},"content":{"rendered":"\n<p>This cheat sheet-style guide provides a quick reference to iptables commands that will create firewall rules are useful in common, everyday scenarios. This includes iptables examples of allowing and blocking various services by port, network interface, and source IP address.<\/p>\n\n\n\n<p>In computing, a firewall is a network security system that monitors and controls the incoming and outgoing network traffic based on predetermined security rules.&nbsp;A firewall typically establishes a barrier between a trusted, secure internal network and another outside network, such as the Internet, that is assumed to not be secure or trusted.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\" id=\"getting-started\">Getting Started<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>If you are just getting started with configuring your firewall.<\/li><li>Most of the rules that are described here assume that your iptables is set to <strong>DROP<\/strong> incoming traffic, through the default input policy, and you want to selectively allow traffic in.<\/li><li>Use whichever subsequent sections are applicable to what you are trying to achieve. Most sections are not predicated on any other, so you can use the examples below independently.<\/li><li>Use the Contents menu on the right side of this page (at wide page widths) or your browser&#8217;s find function to locate the sections you need.<\/li><li>Copy and paste the command-line examples given, substituting the values in red with your own values.<\/li><\/ul>\n\n\n\n<p>Keep in mind that the order of your rules matter. All of these <code>iptables<\/code> commands use the <code>-A<\/code> option to append the new rule to the end of a chain. If you want to put it somewhere else in the chain, you can use the <code>-I<\/code> option which allows you to specify the position of the new rule (or simply place it at the beginning of the chain by not specifying a rule number).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"allow-loopback-connections\">Allow Loopback Connections<\/h3>\n\n\n\n<p>The <strong>loopback<\/strong> interface, also referred to as <code>lo<\/code>, is what a computer uses to for network connections to itself. For example, if you run <code>ping localhost<\/code> or <code>ping 127.0.0.1<\/code>, your server will ping itself using the loopback. The loopback interface is also used if you configure your application server to connect to a database server with a &#8220;localhost&#8221; address. As such, you will want to be sure that your firewall is allowing these connections.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>That should cover many of the commands that are commonly used when configuring an iptables firewall. Of course, iptables is a very flexible tool so feel free to mix and match the commands with different options to match your specific needs if they aren&#8217;t covered here.&nbsp;Continue reading this guide at <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-tinc-and-set-up-a-basic-vpn-on-ubuntu-14-04\" target=\"_blank\" rel=\"noopener\">Digital Ocean<\/a>. This article has been used as an example of an&nbsp;Ecko&nbsp;WordPress theme. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This cheat sheet-style guide provides a quick reference to iptables commands that will create firewall rules are useful in common, everyday scenarios. This includes iptables examples of allowing and blocking various services by port, network interface, and source IP address. In computing, a firewall is a network security system that monitors and controls the incoming [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[22,25],"class_list":["post-780","post","type-post","status-publish","format-standard","hentry","category-administration","tag-nginx","tag-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux Server Essentials: Common Firewall Rules and Commands - Crown an Luxury Timepieces<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/crownandluxury.com\/?p=780\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux Server Essentials: Common Firewall Rules and Commands - Crown an Luxury Timepieces\" \/>\n<meta property=\"og:description\" content=\"This cheat sheet-style guide provides a quick reference to iptables commands that will create firewall rules are useful in common, everyday scenarios. This includes iptables examples of allowing and blocking various services by port, network interface, and source IP address. In computing, a firewall is a network security system that monitors and controls the incoming [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/crownandluxury.com\/?p=780\" \/>\n<meta property=\"og:site_name\" content=\"Crown an Luxury Timepieces\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-18T12:18:06+00:00\" \/>\n<meta name=\"author\" content=\"CrownAndLuxury\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CrownAndLuxury\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/crownandluxury.com\/?p=780\",\"url\":\"https:\/\/crownandluxury.com\/?p=780\",\"name\":\"Linux Server Essentials: Common Firewall Rules and Commands - Crown an Luxury Timepieces\",\"isPartOf\":{\"@id\":\"https:\/\/crownandluxury.com\/#website\"},\"datePublished\":\"2017-01-18T12:18:06+00:00\",\"author\":{\"@id\":\"https:\/\/crownandluxury.com\/#\/schema\/person\/689dd98bb396b64007dc7139deb62482\"},\"breadcrumb\":{\"@id\":\"https:\/\/crownandluxury.com\/?p=780#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/crownandluxury.com\/?p=780\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/crownandluxury.com\/?p=780#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/crownandluxury.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux Server Essentials: Common Firewall Rules and Commands\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/crownandluxury.com\/#website\",\"url\":\"https:\/\/crownandluxury.com\/\",\"name\":\"Crown an Luxury Timepieces\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/crownandluxury.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/crownandluxury.com\/#\/schema\/person\/689dd98bb396b64007dc7139deb62482\",\"name\":\"CrownAndLuxury\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/crownandluxury.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1eef7995d66a0a390150f32f123dda9c52df4bb23af2e403d2f9d5ea8babaa82?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1eef7995d66a0a390150f32f123dda9c52df4bb23af2e403d2f9d5ea8babaa82?s=96&d=mm&r=g\",\"caption\":\"CrownAndLuxury\"},\"sameAs\":[\"https:\/\/crownandluxury.com\"],\"url\":\"https:\/\/crownandluxury.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux Server Essentials: Common Firewall Rules and Commands - Crown an Luxury Timepieces","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/crownandluxury.com\/?p=780","og_locale":"en_US","og_type":"article","og_title":"Linux Server Essentials: Common Firewall Rules and Commands - Crown an Luxury Timepieces","og_description":"This cheat sheet-style guide provides a quick reference to iptables commands that will create firewall rules are useful in common, everyday scenarios. This includes iptables examples of allowing and blocking various services by port, network interface, and source IP address. In computing, a firewall is a network security system that monitors and controls the incoming [&hellip;]","og_url":"https:\/\/crownandluxury.com\/?p=780","og_site_name":"Crown an Luxury Timepieces","article_published_time":"2017-01-18T12:18:06+00:00","author":"CrownAndLuxury","twitter_card":"summary_large_image","twitter_misc":{"Written by":"CrownAndLuxury","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/crownandluxury.com\/?p=780","url":"https:\/\/crownandluxury.com\/?p=780","name":"Linux Server Essentials: Common Firewall Rules and Commands - Crown an Luxury Timepieces","isPartOf":{"@id":"https:\/\/crownandluxury.com\/#website"},"datePublished":"2017-01-18T12:18:06+00:00","author":{"@id":"https:\/\/crownandluxury.com\/#\/schema\/person\/689dd98bb396b64007dc7139deb62482"},"breadcrumb":{"@id":"https:\/\/crownandluxury.com\/?p=780#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/crownandluxury.com\/?p=780"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/crownandluxury.com\/?p=780#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/crownandluxury.com\/"},{"@type":"ListItem","position":2,"name":"Linux Server Essentials: Common Firewall Rules and Commands"}]},{"@type":"WebSite","@id":"https:\/\/crownandluxury.com\/#website","url":"https:\/\/crownandluxury.com\/","name":"Crown an Luxury Timepieces","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/crownandluxury.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/crownandluxury.com\/#\/schema\/person\/689dd98bb396b64007dc7139deb62482","name":"CrownAndLuxury","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/crownandluxury.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1eef7995d66a0a390150f32f123dda9c52df4bb23af2e403d2f9d5ea8babaa82?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1eef7995d66a0a390150f32f123dda9c52df4bb23af2e403d2f9d5ea8babaa82?s=96&d=mm&r=g","caption":"CrownAndLuxury"},"sameAs":["https:\/\/crownandluxury.com"],"url":"https:\/\/crownandluxury.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/crownandluxury.com\/index.php?rest_route=\/wp\/v2\/posts\/780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/crownandluxury.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/crownandluxury.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/crownandluxury.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/crownandluxury.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=780"}],"version-history":[{"count":0,"href":"https:\/\/crownandluxury.com\/index.php?rest_route=\/wp\/v2\/posts\/780\/revisions"}],"wp:attachment":[{"href":"https:\/\/crownandluxury.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/crownandluxury.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/crownandluxury.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}