{"id":2557,"date":"2016-08-23T16:57:39","date_gmt":"2016-08-23T20:57:39","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2557"},"modified":"2018-01-12T14:05:16","modified_gmt":"2018-01-12T19:05:16","slug":"migrate-iptables-firewall-rules-server","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/","title":{"rendered":"How To Migrate Iptables Firewall Rules to a New Server"},"content":{"rendered":"<h1>How To Migrate Iptables Firewall Rules to a New Server<\/h1>\n<p>This guide will go over the basic steps you should take in order to transfer firewall rules from one server to another.<\/p>\n<h2>Getting started<\/h2>\n<p>You&#8217;ll need the following in place before getting started with this guide:<br \/>\n\u2022 2 Node (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\">Cloud Server<\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\">Dedicated Server<\/a>) <\/p>\n<p>You&#8217;ll be transferring rules from one to another, so if you like, make sure they each have different firewall rules before beginning the guide so as to demonstrate its effectiveness.<\/p>\n<h2>Tutorial<\/h2>\n<p>First, check current iptables rules on server1.<\/p>\n<p><code>iptables -S<\/code><\/p>\n<p>Output Sample:<\/p>\n<p><code class=\"gris\">-P INPUT ACCEPT<br \/>\n-P FORWARD ACCEPT<br \/>\n-P OUTPUT ACCEPT<br \/>\n-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT<br \/>\n-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT<br \/>\n-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT<br \/>\n-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT<br \/>\n-A INPUT -s 1.2.3.4\/32 -j DROP<\/code><\/p>\n<p>You have the option to save server1&#8217;s iptables rules to a file. This is the command to do so.<\/p>\n<p><code>iptables-save > iptables-rules-file<\/code><\/p>\n<p>Now you can copy the file from server1 to server2. This is really all you&#8217;ll need to reinstate the rules on the other server.<\/p>\n<p><code>scp iptables-rules-file root@ip.of.server.2:\/root<\/code><\/p>\n<p>Restore the rules on server2 from the file you just transferred.<\/p>\n<p><code>iptables-restore < \/root\/iptables-rules-file<\/code><\/p>\n<p>Review your iptables rules on server2 to make sure that they were indeed copied over.<\/p>\n<p><code>iptables -S<\/code><\/p>\n<p>Here's a sample of the output you should expect to see.<\/p>\n<p><code class=\"gris\">-P INPUT ACCEPT<br \/>\n-P FORWARD ACCEPT<br \/>\n-P OUTPUT ACCEPT<br \/>\n-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT<br \/>\n-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT<br \/>\n-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT<br \/>\n-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT<br \/>\n-A INPUT -s 1.2.3.4\/32 -j DROP<\/code><\/p>\n<h2>Conclusion<\/h2>\n<p>With that, you should now have successfully migrated your iptables rules from one server to another. Refer to the man pages for iptables to get an idea of what else you can do with this versatile program. If you liked this KB article, please share it with your friends. <\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>How To Migrate Iptables Firewall Rules to a New Server This guide will go over the basic steps you should take in order to transfer firewall rules from one server to another. Getting started You&#8217;ll need the following in place before getting started with this guide: \u2022 2 Node (Cloud Server or Dedicated Server) You&#8217;ll<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"class_list":["post-2557","post","type-post","status-publish","format-standard","hentry","category-security"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Migrate Iptables Firewall Rules to a New Server - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how to migrate your Iptables firewall rules from one of your server to another. Read now &amp; Enjoy !\" \/>\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.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Migrate Iptables Firewall Rules to a New Server - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how to migrate your Iptables firewall rules from one of your server to another. Read now &amp; Enjoy !\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-23T20:57:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-12T19:05:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"963\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\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:\\\/\\\/www.globo.tech\\\/learning-center\\\/migrate-iptables-firewall-rules-server\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/migrate-iptables-firewall-rules-server\\\/\"},\"author\":{\"name\":\"GloboTech Communications\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"headline\":\"How To Migrate Iptables Firewall Rules to a New Server\",\"datePublished\":\"2016-08-23T20:57:39+00:00\",\"dateModified\":\"2018-01-12T19:05:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/migrate-iptables-firewall-rules-server\\\/\"},\"wordCount\":237,\"commentCount\":0,\"articleSection\":[\"Security\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/migrate-iptables-firewall-rules-server\\\/\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/migrate-iptables-firewall-rules-server\\\/\",\"name\":\"How To Migrate Iptables Firewall Rules to a New Server - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\"},\"datePublished\":\"2016-08-23T20:57:39+00:00\",\"dateModified\":\"2018-01-12T19:05:16+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how to migrate your Iptables firewall rules from one of your server to another. Read now & Enjoy !\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/migrate-iptables-firewall-rules-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/migrate-iptables-firewall-rules-server\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/migrate-iptables-firewall-rules-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Migrate Iptables Firewall Rules to a New Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\\\/\\\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Migrate Iptables Firewall Rules to a New Server - Globo.Tech","description":"This tutorial will show you how to migrate your Iptables firewall rules from one of your server to another. Read now & Enjoy !","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.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/","og_locale":"en_US","og_type":"article","og_title":"How To Migrate Iptables Firewall Rules to a New Server - Globo.Tech","og_description":"This tutorial will show you how to migrate your Iptables firewall rules from one of your server to another. Read now & Enjoy !","og_url":"https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/","og_site_name":"Globo.Tech","article_published_time":"2016-08-23T20:57:39+00:00","article_modified_time":"2018-01-12T19:05:16+00:00","og_image":[{"width":1920,"height":963,"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png","type":"image\/png"}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/#article","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/"},"author":{"name":"GloboTech Communications","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"headline":"How To Migrate Iptables Firewall Rules to a New Server","datePublished":"2016-08-23T20:57:39+00:00","dateModified":"2018-01-12T19:05:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/"},"wordCount":237,"commentCount":0,"articleSection":["Security"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/","url":"https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/","name":"How To Migrate Iptables Firewall Rules to a New Server - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-08-23T20:57:39+00:00","dateModified":"2018-01-12T19:05:16+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how to migrate your Iptables firewall rules from one of your server to another. Read now & Enjoy !","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/migrate-iptables-firewall-rules-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How To Migrate Iptables Firewall Rules to a New Server"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2557","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=2557"}],"version-history":[{"count":4,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2557\/revisions"}],"predecessor-version":[{"id":4081,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2557\/revisions\/4081"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}