We have situations where we need to migrate the complete rules in iptables/csf from the old server to the new server. In this case, we can use the command iptables-save
root@help2linux [~]# iptables-save > iptables_rules_back
This command will write the complete backup of the iptables rules to the file iptables_rules_back
Now we need to import these rules in to our new server. This can be done using the command
iptables-restore
root@new-help2linux [~]# iptables-restore < iptables_rules_back
root@help2linux [~]# iptables-save > iptables_rules_back
This command will write the complete backup of the iptables rules to the file iptables_rules_back
Now we need to import these rules in to our new server. This can be done using the command
iptables-restore
root@new-help2linux [~]# iptables-restore < iptables_rules_back