OCI: How To Migrate Iptables Firewall Rules to a New Server
in Linux
Applies to
Oracle Cloud Infrastructure -
Linux OS
Goal
How to easily copy your active iptables rule set from one server to another.
Solution
To migrate your iptables firewall rules from the old server to the new one, perform steps below :
1. On the old server, export the iptables rules to a file by running the command:
$ iptables-save > iptables
2. Transfer the file "iptables” to the new server.
3. On the new server, to make sure the iptables rules persist post reboot, then install iptables-service and enable the service with command :
$ yum install iptables-services $ systemctl enable --now iptables.service
4. Import the iptables rules :
$ iptables-restore < iptables
Tagged:
0