Copy IP Tables rules from one server to another

Yes. Save it as follows:

sudo iptables-save > iptables.conf

Restore it as follows:

sudo iptables-restore < iptables.conf

And since it’s all in a text file—in this case iptables.conf—you can then do further editing and tweaks based on machine specific parameters and scenarios.

Also, if you plan on retaining rules on reboot, consider having iptables-persistent installed and then copying the rules into the area that iptables-persistent loads them:

sudo cp iptables.conf /etc/iptables/rules.v4

Above is for IPv4 rules. For for IPV6 rules do this:

sudo cp iptables.conf /etc/iptables/rules.v6

Use

sudo iptables-save > [filename]

to save them in a file, then use

sudo iptables-restore < [filename]

once you've copied the file over.