{"id":243,"date":"2026-09-22T10:45:41","date_gmt":"2026-09-22T10:45:41","guid":{"rendered":"https:\/\/phoenixnap.com\/doc\/?p=243"},"modified":"2026-11-27T10:32:15","modified_gmt":"2026-11-27T10:32:15","slug":"firewall-configuration","status":"publish","type":"post","link":"https:\/\/phoenixnap.com\/doc\/firewall-configuration","title":{"rendered":"Set Up a Firewall"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This tutorial uses the <strong><code>s0.d1.small<\/code><\/strong> server to demonstrate basic firewall configuration. The example focuses on installing <strong><code>iptables<\/code><\/strong> and managing firewall rules. These tasks do not require substantial compute resources, so the smallest instance is sufficient.<\/p>\n\n\n\n<div class=\"wp-block-group has-background is-vertical is-layout-flex wp-container-core-group-is-layout-2e417836 wp-block-group-is-layout-flex\" style=\"border-left-color:#4fabc2;border-left-width:0.19rem;background-color:#4fabc233;padding-top:0.94rem;padding-right:var(--wp--preset--spacing--30);padding-bottom:0.94rem;padding-left:1.25rem\">\n<h6 class=\"wp-block-heading\" style=\"font-size:0.81rem;font-style:normal;font-weight:600;letter-spacing:0px\">Prerequisites<\/h6>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.102), 0.94rem);\">A deployed <strong><code>s0.d1.small<\/code><\/strong> BMC instance running Ubuntu. <a href=\"https:\/\/phoenixnap.com\/doc\/connect-to-your-server\/\" data-type=\"post\" data-id=\"568\">Connect to your server<\/a> via SSH, or use the <a href=\"https:\/\/phoenixnap.com\/doc\/bmc-remote-console\/\" data-type=\"post\" data-id=\"209\">remote console<\/a>, and have a terminal open and ready.<\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Install iptables<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong><code>iptables<\/code><\/strong> utility manages packet-filtering rules on Linux servers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Install <strong><code>iptables<\/code><\/strong> with:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo apt install iptables<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">2. Install the persistent package to keep <strong><code>iptables<\/code><\/strong> firewall rules after rebooting:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo apt install iptables-persistent<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Follow any prompts displayed during installation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Review the Existing Firewall Rules<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Inspect the current set of rules on the server:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo iptables -L -v<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Review the chains, default policies, and existing rules before making changes. Do not assume that all chains accept traffic by default.<\/p>\n\n\n\n<div class=\"wp-block-group has-background is-vertical is-layout-flex wp-container-core-group-is-layout-2e417836 wp-block-group-is-layout-flex\" style=\"border-left-color:#fc4c4c;border-left-width:0.19rem;background-color:#fc4c4c33;padding-top:0.94rem;padding-right:var(--wp--preset--spacing--30);padding-bottom:0.94rem;padding-left:1.25rem\">\n<h6 class=\"wp-block-heading\" style=\"font-size:0.81rem;font-style:normal;font-weight:600;letter-spacing:0px\">Warning<\/h6>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.102), 0.94rem);\">Incorrect firewall rules can block SSH access or other required network traffic. Before changing rules, ensure you have an alternative way to access the server (such as the <a href=\"https:\/\/phoenixnap.com\/doc\/bmc-remote-console\/\" data-type=\"post\" data-id=\"209\">remote console<\/a>).<\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Add Firewall Rules<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The syntax for appending a new rule to a chain is:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo iptables -A &#91;CHAIN] &#91;options] -j &#91;TARGET]<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Common options are:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-center\" data-align=\"center\">Option<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><code>-A<\/code><\/strong><\/td><td>Appends a rule to the specified chain.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><code>-i<\/code><\/strong><\/td><td>Matches traffic arriving through a specified network interface, such as <strong><code>eth0<\/code><\/strong> or <strong><code>lo<\/code><\/strong>.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><code>-p<\/code><\/strong><\/td><td>Matches a protocol, such as <strong><code>tcp<\/code><\/strong>, <strong><code>udp<\/code><\/strong>, or <strong><code>icmp<\/code><\/strong>.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><code>-s<\/code><\/strong><\/td><td>Matches a source IP address or network.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><code>--dport<\/code><\/strong><\/td><td>Matches the destination port, such as <strong><code>22<\/code><\/strong> for SSH or <strong><code>443<\/code><\/strong> for HTTPS.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong><code>-j<\/code><\/strong><\/td><td>Specifies the target action, such as <strong><code>ACCEPT<\/code><\/strong>, <strong><code>DROP<\/code><\/strong>, or <strong><code>RETURN<\/code><\/strong>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Allow SSH Traffic<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To accept SSH connections on TCP port 22:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Ensure this rule is compatible with the chain's existing rules and default policy.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Allow Traffic from a Specific IP Address<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To accept connections from a specified IP address:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo iptables -A INPUT -s &#91;IP_ADDRESS] -j ACCEPT<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Replace <strong><code>[IP_ADDRESS]<\/code><\/strong> with the address you want to allow.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Verify the Rules<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">List the rules:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo iptables -L -v<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Confirm the new rules appear in the expected chains.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Save the Firewall Rules<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To persist the current rules across reboots, use the <strong><code>netfilter-persistent<\/code><\/strong> utility:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo netfilter-persistent save<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The command saves the current rules using the <strong><code>iptables-persistent<\/code><\/strong> package utility.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Delete Firewall Rules<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can remove rules when they are no longer needed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Flush a Chain<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To remove all rules from all chains in the current table, run:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo iptables -F<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The command removes rules not it does not reset a chain's default policies. Review the effects before running it on a production server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Delete a Specific Rule<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">1. List rules with their line numbers:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo iptables -L --line-numbers<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">2. Delete a rule:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo iptables -D INPUT &#91;RULE_LINE_NUMBER]<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">After deleting rules, review the configuration and save the updated rules to persist changes across reboots.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install iptables and configure firewall rules on an s0.d1.small server instance to control incoming and outgoing network traffic.<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[57],"tags":[],"class_list":["post-243","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Set Up a Firewall | phoenixNAP<\/title>\n<meta name=\"description\" content=\"Learn how to install and configure an iptables firewall on Bare Metal Cloud, allow network ports, and save persistent rules across reboots.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/phoenixnap.com\/doc\/firewall-configuration\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Set Up a Firewall | phoenixNAP\" \/>\n<meta property=\"og:description\" content=\"Learn how to install and configure an iptables firewall on Bare Metal Cloud, allow network ports, and save persistent rules across reboots.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/phoenixnap.com\/doc\/firewall-configuration\" \/>\n<meta property=\"og:site_name\" content=\"BMC Docs\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/phoenixnap\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-22T10:45:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-27T10:32:15+00:00\" \/>\n<meta name=\"author\" content=\"Marko Aleksic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@phoenixNAP\" \/>\n<meta name=\"twitter:site\" content=\"@phoenixNAP\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Marko Aleksic\" \/>\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\":\"Article\",\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/firewall-configuration#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/firewall-configuration\"},\"author\":{\"name\":\"Marko Aleksic\",\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/#\\\/schema\\\/person\\\/388816d91a9c0dbfb4257a5807eb0850\"},\"headline\":\"Set Up a Firewall\",\"datePublished\":\"2026-09-22T10:45:41+00:00\",\"dateModified\":\"2026-11-27T10:32:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/firewall-configuration\"},\"wordCount\":340,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/#organization\"},\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/firewall-configuration#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/firewall-configuration\",\"url\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/firewall-configuration\",\"name\":\"Set Up a Firewall | phoenixNAP\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/#website\"},\"datePublished\":\"2026-09-22T10:45:41+00:00\",\"dateModified\":\"2026-11-27T10:32:15+00:00\",\"description\":\"Learn how to install and configure an iptables firewall on Bare Metal Cloud, allow network ports, and save persistent rules across reboots.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/firewall-configuration#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/firewall-configuration\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/firewall-configuration#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Set Up a Firewall\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/#website\",\"url\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/\",\"name\":\"phoenixNAP Bare Metal Cloud Documentation\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/#organization\",\"name\":\"phoenixNAP\",\"url\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/phoenixnap-logo.png\",\"contentUrl\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/phoenixnap-logo.png\",\"width\":200,\"height\":200,\"caption\":\"phoenixNAP\"},\"image\":{\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/phoenixnap\",\"https:\\\/\\\/x.com\\\/phoenixNAP\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/phoenix-nap\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/PhoenixNAPdatacenter\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/#\\\/schema\\\/person\\\/388816d91a9c0dbfb4257a5807eb0850\",\"name\":\"Marko Aleksic\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cd755a8fadae1a19e47b381aa9aa6309fde0a9dbb6decea8c96f027e1babf093?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cd755a8fadae1a19e47b381aa9aa6309fde0a9dbb6decea8c96f027e1babf093?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cd755a8fadae1a19e47b381aa9aa6309fde0a9dbb6decea8c96f027e1babf093?s=96&d=mm&r=g\",\"caption\":\"Marko Aleksic\"},\"url\":\"https:\\\/\\\/phoenixnap.com\\\/doc\\\/author\\\/markoa\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Set Up a Firewall | phoenixNAP","description":"Learn how to install and configure an iptables firewall on Bare Metal Cloud, allow network ports, and save persistent rules across reboots.","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:\/\/phoenixnap.com\/doc\/firewall-configuration","og_locale":"en_US","og_type":"article","og_title":"Set Up a Firewall | phoenixNAP","og_description":"Learn how to install and configure an iptables firewall on Bare Metal Cloud, allow network ports, and save persistent rules across reboots.","og_url":"https:\/\/phoenixnap.com\/doc\/firewall-configuration","og_site_name":"BMC Docs","article_publisher":"https:\/\/www.facebook.com\/phoenixnap","article_published_time":"2026-09-22T10:45:41+00:00","article_modified_time":"2026-11-27T10:32:15+00:00","author":"Marko Aleksic","twitter_card":"summary_large_image","twitter_creator":"@phoenixNAP","twitter_site":"@phoenixNAP","twitter_misc":{"Written by":"Marko Aleksic","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/phoenixnap.com\/doc\/firewall-configuration#article","isPartOf":{"@id":"https:\/\/phoenixnap.com\/doc\/firewall-configuration"},"author":{"name":"Marko Aleksic","@id":"https:\/\/phoenixnap.com\/doc\/#\/schema\/person\/388816d91a9c0dbfb4257a5807eb0850"},"headline":"Set Up a Firewall","datePublished":"2026-09-22T10:45:41+00:00","dateModified":"2026-11-27T10:32:15+00:00","mainEntityOfPage":{"@id":"https:\/\/phoenixnap.com\/doc\/firewall-configuration"},"wordCount":340,"commentCount":0,"publisher":{"@id":"https:\/\/phoenixnap.com\/doc\/#organization"},"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/phoenixnap.com\/doc\/firewall-configuration#respond"]}]},{"@type":"WebPage","@id":"https:\/\/phoenixnap.com\/doc\/firewall-configuration","url":"https:\/\/phoenixnap.com\/doc\/firewall-configuration","name":"Set Up a Firewall | phoenixNAP","isPartOf":{"@id":"https:\/\/phoenixnap.com\/doc\/#website"},"datePublished":"2026-09-22T10:45:41+00:00","dateModified":"2026-11-27T10:32:15+00:00","description":"Learn how to install and configure an iptables firewall on Bare Metal Cloud, allow network ports, and save persistent rules across reboots.","breadcrumb":{"@id":"https:\/\/phoenixnap.com\/doc\/firewall-configuration#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/phoenixnap.com\/doc\/firewall-configuration"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/phoenixnap.com\/doc\/firewall-configuration#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/phoenixnap.com\/doc\/"},{"@type":"ListItem","position":2,"name":"Set Up a Firewall"}]},{"@type":"WebSite","@id":"https:\/\/phoenixnap.com\/doc\/#website","url":"https:\/\/phoenixnap.com\/doc\/","name":"phoenixNAP Bare Metal Cloud Documentation","description":"","publisher":{"@id":"https:\/\/phoenixnap.com\/doc\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/phoenixnap.com\/doc\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/phoenixnap.com\/doc\/#organization","name":"phoenixNAP","url":"https:\/\/phoenixnap.com\/doc\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/phoenixnap.com\/doc\/#\/schema\/logo\/image\/","url":"https:\/\/phoenixnap.com\/doc\/wp-content\/uploads\/2026\/10\/phoenixnap-logo.png","contentUrl":"https:\/\/phoenixnap.com\/doc\/wp-content\/uploads\/2026\/10\/phoenixnap-logo.png","width":200,"height":200,"caption":"phoenixNAP"},"image":{"@id":"https:\/\/phoenixnap.com\/doc\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/phoenixnap","https:\/\/x.com\/phoenixNAP","https:\/\/www.linkedin.com\/company\/phoenix-nap\/","https:\/\/www.youtube.com\/user\/PhoenixNAPdatacenter"]},{"@type":"Person","@id":"https:\/\/phoenixnap.com\/doc\/#\/schema\/person\/388816d91a9c0dbfb4257a5807eb0850","name":"Marko Aleksic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cd755a8fadae1a19e47b381aa9aa6309fde0a9dbb6decea8c96f027e1babf093?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cd755a8fadae1a19e47b381aa9aa6309fde0a9dbb6decea8c96f027e1babf093?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cd755a8fadae1a19e47b381aa9aa6309fde0a9dbb6decea8c96f027e1babf093?s=96&d=mm&r=g","caption":"Marko Aleksic"},"url":"https:\/\/phoenixnap.com\/doc\/author\/markoa"}]}},"_links":{"self":[{"href":"https:\/\/phoenixnap.com\/doc\/wp-json\/wp\/v2\/posts\/243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phoenixnap.com\/doc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phoenixnap.com\/doc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phoenixnap.com\/doc\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/phoenixnap.com\/doc\/wp-json\/wp\/v2\/comments?post=243"}],"version-history":[{"count":16,"href":"https:\/\/phoenixnap.com\/doc\/wp-json\/wp\/v2\/posts\/243\/revisions"}],"predecessor-version":[{"id":3393,"href":"https:\/\/phoenixnap.com\/doc\/wp-json\/wp\/v2\/posts\/243\/revisions\/3393"}],"wp:attachment":[{"href":"https:\/\/phoenixnap.com\/doc\/wp-json\/wp\/v2\/media?parent=243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixnap.com\/doc\/wp-json\/wp\/v2\/categories?post=243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixnap.com\/doc\/wp-json\/wp\/v2\/tags?post=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}