{"id":21718,"date":"2017-03-14T08:39:28","date_gmt":"2017-03-14T13:39:28","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=21718"},"modified":"2022-12-14T05:45:17","modified_gmt":"2022-12-14T11:45:17","slug":"how-to-open-ports-in-ubuntu-and-centos-using-iptables","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/","title":{"rendered":"How to Open Ports in Ubuntu and CentOS using IPtables"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><figure id=\"attachment_28676\" aria-describedby=\"caption-attachment-28676\" style=\"width: 732px\" class=\"wp-caption alignnone\"><img decoding=\"async\" class=\"size-full wp-image-28676\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg\" alt=\"How to Open Ports in Ubuntu and CentOS\" width=\"742\" height=\"371\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS-150x75.jpg 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS-300x150.jpg 300w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><figcaption id=\"caption-attachment-28676\" class=\"wp-caption-text\">How to Open Ports in Ubuntu and CentOS<\/figcaption><\/figure>\n<p><img decoding=\"async\" class=\"alignright size-full wp-image-28677\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/03\/Ubuntu-iptables.jpg\" alt=\"Ubuntu iptables\" width=\"120\" height=\"120\" \/>We&#8217;ll show you, How to <strong>Open Ports in Ubuntu and CentOS using IPtables<\/strong>. Having a properly configured firewall is very important for the overall <a href=\"https:\/\/www.rosehosting.com\/blog\/how-to-secure-your-lemp-stack\/\">security on your server<\/a>. In this tutorial, we are going to show you how to set up your firewall and open the ports you need on your Linux VPS, using iptables. Let&#8217;s get started.<\/p>\n<p><!--more--><\/p>\n<p>While there are few powerful tools to manage the firewall on a Linux server, we are going to use <a href=\"https:\/\/ipset.netfilter.org\/iptables.man.html\" target=\"_blank\" rel=\"noopener noreferrer\">IPtables<\/a> in this tutorial. In case you are using UFW on Ubuntu or Firewalld on CentOS, you can check our corresponding guides about how to <a href=\"https:\/\/www.rosehosting.com\/blog\/set-up-firewall-with-ufw-on-ubuntu\/\" target=\"_blank\" rel=\"noopener noreferrer\">set up a firewall with UFW on Ubuntu<\/a> or how to <a href=\"https:\/\/www.rosehosting.com\/blog\/set-up-and-configure-a-firewall-with-firewalld-on-centos-7\/\" target=\"_blank\" rel=\"noopener noreferrer\">configure a firewall with FirewallD on CentOS<\/a>.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69c770f9b5447\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69c770f9b5447\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#1-Connect-via-SSH-and-list-current-IPtables\" >1. Connect via SSH and list current IPtables<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#2-Flush-Unwanted-Rules\" >2. Flush Unwanted Rules<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#3-Add-Firewall-Rule\" >3. Add Firewall Rule<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#4-List-Current-Rules\" >4. List Current Rules<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#5-Implement-DROP-Rule\" >5. Implement DROP Rule<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#6-Install-iptables-persistent\" >6. Install\u00a0iptables-persistent<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"1-Connect-via-SSH-and-list-current-IPtables\"><\/span>1. Connect via SSH and list current IPtables<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>First of all, <a href=\"https:\/\/www.rosehosting.com\/blog\/connect-to-your-linux-vps-via-ssh\/\" target=\"_blank\" rel=\"noopener noreferrer\">connect to your Linux VPS via SSH<\/a> and list the current IPtables rules using the following command:<\/p>\n<pre>sudo iptables -L<\/pre>\n<p>If you recently set up your server there will be no IPtables rules and the output should be similar to the one below:<\/p>\n<pre>Chain INPUT (policy ACCEPT)\r\ntarget     prot opt source               destination\r\n\r\nChain FORWARD (policy ACCEPT)\r\ntarget     prot opt source               destination\r\n\r\nChain OUTPUT (policy ACCEPT)\r\ntarget     prot opt source               destination<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"2-Flush-Unwanted-Rules\"><\/span>2. Flush Unwanted Rules<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If there are already some rules that you don&#8217;t want to be there you can flush the rules by using the following command:<\/p>\n<pre>sudo iptables -F<\/pre>\n<p>Be careful with this command, especially if the default policy on your <code>INPUT<\/code> and <code>OUTPUT<\/code> chains is set to something other than <code>ACCEPT<\/code> because that could lock you out of your server.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"3-Add-Firewall-Rule\"><\/span>3. Add Firewall Rule<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The first firewall rule you need to add is the following one:<\/p>\n<pre>sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT<\/pre>\n<p>This basically tells your firewall to accept your current SSH connection. The next step is to allow traffic on your loopback interface and to open some basic ports like <code>22<\/code> for SSH and <code>80<\/code> for HTTP.<\/p>\n<pre>sudo iptables -A INPUT -i lo -j ACCEPT\r\nsudo iptables -A OUTPUT -o lo -j ACCEPT\r\nsudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT\r\nsudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT<\/pre>\n<p>You are now ready to open the other ports you want to allow traffic to. Use the same command as you used to open the port 22 and 80 in the previous example.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"4-List-Current-Rules\"><\/span>4. List Current Rules<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>List the current rules using:<\/p>\n<pre>sudo iptables -L<\/pre>\n<p>The output should be similar to the one below:<\/p>\n<pre>Chain INPUT (policy ACCEPT)\r\ntarget     prot opt source               destination\r\nACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED\r\nACCEPT     all  --  anywhere             anywhere\r\nACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh\r\nACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http\r\n\r\nChain FORWARD (policy ACCEPT)\r\ntarget     prot opt source               destination\r\n\r\nChain OUTPUT (policy ACCEPT)\r\ntarget     prot opt source               destination\r\nACCEPT     all  --  anywhere             anywhere<\/pre>\n<p>For more detailed output you can use:<\/p>\n<pre>sudo iptables -nvL<\/pre>\n<p>And the output should be similar to this one:<\/p>\n<pre>Chain INPUT (policy ACCEPT 4 packets, 255 bytes)\r\n pkts bytes target     prot opt in     out     source               destination\r\n    0     0 ACCEPT     all  --  *      *       0.0.0.0\/0            0.0.0.0\/0            ctstate RELATED,ESTABLISHED\r\n    0     0 ACCEPT     all  --  lo     *       0.0.0.0\/0            0.0.0.0\/0\r\n    0     0 ACCEPT     tcp  --  *      *       0.0.0.0\/0            0.0.0.0\/0            tcp dpt:22\r\n    0     0 ACCEPT     tcp  --  *      *       0.0.0.0\/0            0.0.0.0\/0            tcp dpt:80\r\n\r\nChain FORWARD (policy ACCEPT 0 packets, 0 bytes)\r\n pkts bytes target     prot opt in     out     source               destination\r\n\r\nChain OUTPUT (policy ACCEPT 4 packets, 283 bytes)\r\n pkts bytes target     prot opt in     out     source               destination\r\n    0     0 ACCEPT     all  --  *      lo      0.0.0.0\/0            0.0.0.0\/0\r\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"5-Implement-DROP-Rule\"><\/span>5. Implement DROP Rule<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You can now implement the <code>DROP<\/code> rule which will block all incoming packets that don&#8217;t match one of the <code>ACCEPT<\/code> rules we added earlier.<\/p>\n<pre>sudo iptables -P INPUT DROP<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"6-Install-iptables-persistent\"><\/span>6. Install\u00a0iptables-persistent<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The final thing you need to do is to save the rules and make them permanent. If you are using <a href=\"https:\/\/www.rosehosting.com\/ubuntu-hosting.html\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu VPS<\/a> you can install <code>iptables-persistent<\/code> for that purpose.<\/p>\n<pre>sudo apt-get install iptables-persistent<\/pre>\n<p>On <strong>Ubuntu 14.04<\/strong> use the following commands to save\/reload the iptables rules:<\/p>\n<pre>sudo \/etc\/init.d\/iptables-persistent save\r\nsudo \/etc\/init.d\/iptables-persistent reload<\/pre>\n<p>On <strong>Ubuntu 16.04<\/strong> use the following commands:<\/p>\n<pre>sudo netfilter-persistent save\r\nsudo netfilter-persistent reload<\/pre>\n<p>If you are using <a href=\"https:\/\/www.rosehosting.com\/centos-hosting.html\" target=\"_blank\" rel=\"noopener noreferrer\">CentOS VPS<\/a> you can use the following command to save the IPtables rules:<\/p>\n<pre>service iptables save<\/pre>\n<hr \/>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-28678\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/03\/iptables-open-port.jpg\" alt=\"iptables open port\" width=\"150\" height=\"150\" \/>Of course, you don\u2019t have to open ports in Ubuntu and CentOS using IPtables, if you use one of our <a href=\"https:\/\/www.rosehosting.com\/linux-vps-hosting\/\">Linux VPS Hosting services<\/a>, in which case you can simply ask our expert Linux admins to open ports in Ubuntu and CentOS. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n<p><strong><span style=\"color: #ff0000;\">PS<\/span><\/strong>. If you liked this post on\u00a0<strong>How to Open Ports in Ubuntu and CentOS using IPtables,<\/strong>\u00a0 please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ll show you, How to Open Ports in Ubuntu and CentOS using IPtables. Having a properly configured firewall is very &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Open Ports in Ubuntu and CentOS using IPtables\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#more-21718\" aria-label=\"Read more about How to Open Ports in Ubuntu and CentOS using IPtables\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":28676,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1699,1701,13],"tags":[34,147,281,59],"class_list":["post-21718","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-networking-and-domains","category-tutorials","tag-centos","tag-firewall","tag-iptables","tag-ubuntu","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How To Open Ports In Ubuntu And CentOS Using IPtables | RoseHosting<\/title>\n<meta name=\"description\" content=\"Know how to open ports in Ubuntu and CentOS using IPtables. This tutorial has step-by-step instructions for opening ports.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Open Ports in Ubuntu and CentOS using IPtables\" \/>\n<meta property=\"og:description\" content=\"How to Open Ports in Ubuntu and CentOS using IPtables | RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2017-03-14T13:39:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-14T11:45:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"371\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to Open Ports in Ubuntu and CentOS using IPtables\",\"datePublished\":\"2017-03-14T13:39:28+00:00\",\"dateModified\":\"2022-12-14T11:45:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/\"},\"wordCount\":551,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg\",\"keywords\":[\"centos\",\"firewall\",\"iptables\",\"ubuntu\"],\"articleSection\":[\"CentOS\",\"Networking and Domains\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/\",\"name\":\"How To Open Ports In Ubuntu And CentOS Using IPtables | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg\",\"datePublished\":\"2017-03-14T13:39:28+00:00\",\"dateModified\":\"2022-12-14T11:45:17+00:00\",\"description\":\"Know how to open ports in Ubuntu and CentOS using IPtables. This tutorial has step-by-step instructions for opening ports.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg\",\"width\":742,\"height\":371,\"caption\":\"How to Open Ports in Ubuntu and CentOS\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Open Ports in Ubuntu and CentOS using IPtables\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RoseHosting\",\"https:\/\/x.com\/rosehosting\",\"https:\/\/www.linkedin.com\/in\/rosehosting\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\/\/www.rosehosting.com\",\"https:\/\/www.facebook.com\/rosehosting.helpdesk\"],\"url\":\"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How To Open Ports In Ubuntu And CentOS Using IPtables | RoseHosting","description":"Know how to open ports in Ubuntu and CentOS using IPtables. This tutorial has step-by-step instructions for opening ports.","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:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/","og_locale":"en_US","og_type":"article","og_title":"How to Open Ports in Ubuntu and CentOS using IPtables","og_description":"How to Open Ports in Ubuntu and CentOS using IPtables | RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2017-03-14T13:39:28+00:00","article_modified_time":"2022-12-14T11:45:17+00:00","og_image":[{"width":742,"height":371,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to Open Ports in Ubuntu and CentOS using IPtables","datePublished":"2017-03-14T13:39:28+00:00","dateModified":"2022-12-14T11:45:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/"},"wordCount":551,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg","keywords":["centos","firewall","iptables","ubuntu"],"articleSection":["CentOS","Networking and Domains","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/","name":"How To Open Ports In Ubuntu And CentOS Using IPtables | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg","datePublished":"2017-03-14T13:39:28+00:00","dateModified":"2022-12-14T11:45:17+00:00","description":"Know how to open ports in Ubuntu and CentOS using IPtables. This tutorial has step-by-step instructions for opening ports.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/How-to-Open-Ports-in-Ubuntu-and-CentOS.jpg","width":742,"height":371,"caption":"How to Open Ports in Ubuntu and CentOS"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-open-ports-in-ubuntu-and-centos-using-iptables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Open Ports in Ubuntu and CentOS using IPtables"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/21718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=21718"}],"version-history":[{"count":5,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/21718\/revisions"}],"predecessor-version":[{"id":44249,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/21718\/revisions\/44249"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/28676"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=21718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=21718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=21718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}