FIREWALL BUILDER TEST IPTABLES HOW TO
We will demonstrate how to use scp to copy the file over the network to the /tmp directory. The easiest way to do this is to use scp or to copy and paste the file contents to a new file on Server B. We need to copy the rules file to our destination server, Server B. Copy Exported Rules to Destination Server Now we’re ready to copy this file to our destination server, Server B. Iptables-export contents:# Generated by iptables-save v1.4.21 on Tue Sep 1 17:32:29 2015Īs you can see, the file contains the configuration of the active iptables rules. We’ll use the cat command to print it out to the terminal: Let’s take a quick look at the file’s contents. This file can be used on a different server to load the firewall rules into iptables. This will create the iptables-export file, in your home directory. On the Server A, the one with the iptables rules that you want to migrate, use the iptables-save to export the current rules to a file named “iptables-export” like this: This gives us an easy way to export the firewall rules to file, by redirecting stdout to a file.
The iptables-save command writes the current iptables rules to stdout (standard out). The example rules above will be used to demonstrate the firewall migration process. A INPUT -p tcp -m tcp -dport 80 -j ACCEPT
A INPUT -p tcp -m tcp -dport 22 -j ACCEPT A INPUT -m conntrack -ctstate RELATED,ESTABLISHED -j ACCEPT