{"id":21988,"date":"2017-04-18T07:12:34","date_gmt":"2017-04-18T12:12:34","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=21988"},"modified":"2022-06-03T03:42:12","modified_gmt":"2022-06-03T08:42:12","slug":"how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/","title":{"rendered":"How to Set Up a Firewall with iptables on Ubuntu and CentOS"},"content":{"rendered":"
<\/div>

\"How<\/p>\n

In this tutorial, we are going to show you how to set up a firewall with iptables<\/strong> on a Linux VPS running Ubuntu<\/a> or CentOS<\/a> as an operating system. Iptables is an administration tool for IPv4 packet filtering and NAT and it is used to set up and manage the tables of IPv4 packet filter rules in the Linux kernel.<\/p>\n

Properly configuring and setting up a firewall is one of the most important and crucial things you need to do to secure your server<\/a>.
\n<\/p>\n

With iptables, several different packet matching tables are defined and each table can contain a number of built-in chains as well as some chains defined by the user. The chains are actually lists of rules that match set of packets and each rule specifies what to do with the matched packet.<\/p>\n

The default table is the filter<\/code> table and it contains the built-in chains INPUT, FORWARD, and OUTPUT. The INPUT chain is used for packets destined to local sockets, the FORWARD chain is used for packets being routed through the box while the OUTPUT chain is used for locally-generated packets.<\/p>\n

Connect to your server via SSH<\/a> and list the rules defined in a specific chain using the following syntax:<\/p>\n

sudo iptables -L CHAIN<\/pre>\n

Replace CHAIN with one of the built-in chains to see the defined rules. If no chain is selected, all chains will be listed in the output.<\/p>\n

sudo iptables -L\r\nChain 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

The firewall rules specify what to do with a certain packet if it matches certain criteria and in case the packet doesn’t match the criteria, the next firewall rule defined in the chain will be examined. This is a very important thing to know when defining the firewall rules because you can easily lock yourself out of your server if you define the rule which accepts packets from your local IP address after the blocking rule.<\/p>\n

The targets you can use for the firewall rules are ACCEPT, DROP, QUEUE and RETURN. ACCEPT will let the packet through, DROP will drop the packet, QUEUE will pass the packet to the userspace while RETURN will stop the packet traversing of the current chain and will resume at the next rule in the previous chain. The default chain policy will define what to do with a packet if it doesn’t match certain firewall rule. As you can see in the output of the first command, the default policy for all built-in chains is set to ACCEPT. ACCEPT will let the packet go through so basically there is no protection.<\/p>\n

Before adding any specific rules, add the following one:<\/p>\n

sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT<\/pre>\n

This will prevent the connections that are already established to be dropped and your current SSH session will remain active.<\/p>\n

Next, add rules to allow traffic on your loopback interface:<\/p>\n

sudo iptables -A INPUT -i lo -j ACCEPT\r\nsudo iptables -A OUTPUT -o lo -j ACCEPT<\/pre>\n

Next, allow access to your server via SSH for your local IP address so only you can access the server:<\/p>\n

sudo iptables -A INPUT -s 111.111.111.111 -p tcp --dport 22 -j ACCEPT<\/pre>\n

Where 111.111.111.111<\/code> is your local IP address and 22<\/code> is the listening port of your SSH daemon. In case your local IP address changes dynamically it is best to omit the -s 111.111.111.111<\/code> part and use a different method to protect the SSH service from unwanted traffic.<\/p>\n

sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT<\/pre>\n

Next, allow access to your important services like HTTP\/HTTPS server:<\/p>\n

sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT\r\nsudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT<\/pre>\n

[ecko_alert color=”blue”]Stuck somewhere? Get a VPS<\/a> from us and we’ll properly secure your server and configure a firewall for you, free of charge![\/ecko_alert]<\/p>\n

Now, list the current rules and check if everything is OK. For detailed output you can use the following command:<\/p>\n

sudo iptables -nvL<\/pre>\n

If you have other services that you want to allow access to it is best to do that now. Once you are done, you can set the default policy for the INPUT built-in chain to DROP.<\/p>\n

sudo iptables -P INPUT -j DROP<\/pre>\n

This will drop any packet that doesn’t match the firewall rules criteria. The final output should be similar to the following one:<\/p>\n

Chain INPUT (policy DROP 0 packets, 0 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    0     0 ACCEPT     tcp  --  *      *       0.0.0.0\/0            0.0.0.0\/0            tcp dpt:443\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 0 packets, 0 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

However, if you now restart the server you will lose all the firewall rules you defined so it is really important to make the rules permanent.<\/p>\n

In case you are using an\u00a0Ubuntu VPS<\/a> you need to install an additional package for that purpose. Go ahead and install the required package using the following command:<\/p>\n

sudo apt-get install iptables-persistent<\/pre>\n

On Ubutnu 14.04<\/strong> you can save and reload the firewall rules using the commands below:<\/p>\n

sudo \/etc\/init.d\/iptables-persistent save\r\nsudo \/etc\/init.d\/iptables-persistent reload<\/pre>\n

On Ubuntu 16.04<\/strong> use the following commands instead:<\/p>\n

sudo netfilter-persistent save\r\nsudo netfilter-persistent reload<\/pre>\n

If you are using a\u00a0CentOS VPS<\/a> you can save the firewall rules using the command below:<\/p>\n

service iptables save<\/pre>\n

Of course, you don\u2019t have to do any of this if you use one of our Fully Managed VPS Hosting services<\/a>, in which case you can simply ask our expert Linux admins to help you configure your iptables on your server. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n

PS<\/strong><\/span>. If you liked this post on How to Set Up a Firewall with iptables on Ubuntu and CentOS, please share it with your friends on the social networks using the buttons below or simply leave a comment in the comments section. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"

In this tutorial, we are going to show you how to set up a firewall with iptables on a Linux … <\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":24906,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1699,1703,1698],"tags":[34,147,281,59],"yoast_head":"\nHow to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting<\/title>\n<meta name=\"description\" content=\"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting\" \/>\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-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting\" \/>\n<meta property=\"og:description\" content=\"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/\" \/>\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-04-18T12:12:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:42:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/04\/How-to-Set-Up-a-Firewall-with-iptables-on-Ubuntu-and-CentOS.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\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-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to Set Up a Firewall with iptables on Ubuntu and CentOS\",\"datePublished\":\"2017-04-18T12:12:34+00:00\",\"dateModified\":\"2022-06-03T08:42:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/\"},\"wordCount\":834,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/04\/How-to-Set-Up-a-Firewall-with-iptables-on-Ubuntu-and-CentOS.jpg\",\"keywords\":[\"centos\",\"firewall\",\"iptables\",\"ubuntu\"],\"articleSection\":[\"CentOS\",\"Security\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/\",\"name\":\"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/04\/How-to-Set-Up-a-Firewall-with-iptables-on-Ubuntu-and-CentOS.jpg\",\"datePublished\":\"2017-04-18T12:12:34+00:00\",\"dateModified\":\"2022-06-03T08:42:12+00:00\",\"description\":\"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/04\/How-to-Set-Up-a-Firewall-with-iptables-on-Ubuntu-and-CentOS.jpg\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/04\/How-to-Set-Up-a-Firewall-with-iptables-on-Ubuntu-and-CentOS.jpg\",\"width\":1200,\"height\":600,\"caption\":\"How to Set Up a Firewall with iptables on Ubuntu and CentOS\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Set Up a Firewall with iptables on Ubuntu and CentOS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting\",\"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\":\"required name=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\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?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 plugin. -->","yoast_head_json":{"title":"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting","description":"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting","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-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting","og_description":"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2017-04-18T12:12:34+00:00","article_modified_time":"2022-06-03T08:42:12+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/04\/How-to-Set-Up-a-Firewall-with-iptables-on-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-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to Set Up a Firewall with iptables on Ubuntu and CentOS","datePublished":"2017-04-18T12:12:34+00:00","dateModified":"2022-06-03T08:42:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/"},"wordCount":834,"commentCount":2,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/04\/How-to-Set-Up-a-Firewall-with-iptables-on-Ubuntu-and-CentOS.jpg","keywords":["centos","firewall","iptables","ubuntu"],"articleSection":["CentOS","Security","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/","name":"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/04\/How-to-Set-Up-a-Firewall-with-iptables-on-Ubuntu-and-CentOS.jpg","datePublished":"2017-04-18T12:12:34+00:00","dateModified":"2022-06-03T08:42:12+00:00","description":"How to Set Up a Firewall with iptables on Ubuntu and CentOS - RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/04\/How-to-Set-Up-a-Firewall-with-iptables-on-Ubuntu-and-CentOS.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/04\/How-to-Set-Up-a-Firewall-with-iptables-on-Ubuntu-and-CentOS.jpg","width":1200,"height":600,"caption":"How to Set Up a Firewall with iptables on Ubuntu and CentOS"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-a-firewall-with-iptables-on-ubuntu-and-centos\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Set Up a Firewall with iptables on Ubuntu and CentOS"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting","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":"required name=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\/"]},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?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\/21988"}],"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=21988"}],"version-history":[{"count":1,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/21988\/revisions"}],"predecessor-version":[{"id":41883,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/21988\/revisions\/41883"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/24906"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=21988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=21988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=21988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}