Page 1 of 1

Best way to manage custom IP tables rules

Posted: 2020/04/11 01:27:24
by Whoever
I have a complex IPTables rule set which exists as a bash script on a CentOS 6 machine.

I now need to bring that rule set to CentOS7. The rules are sufficiently complex that it is impractical to re-code them using native tools. The script uses variable and is commented which makes editing them simpler.

What's the best way to bring this into a CentOS 7 VM without losing the ability to easily comment the rules?

Re: Best way to manage custom IP tables rules

Posted: 2020/04/11 03:20:48
by TrevorH
Run service iptables save on the CentOS 6 machine then copy /etc/sysconfig/iptables from there to the CentOS 7 machine.

yum remove firewall\*
yum install iptables iptables-services
systemctl enable iptables.service
systemctl start iptables

Re: Best way to manage custom IP tables rules

Posted: 2020/04/11 08:48:14
by jlehtone
In other words:
1. Get rid of firewalld
2. Get the familiar iptables.service
3. Update your script to match interface names on the C7 system
4. Run your script
5. Be happy. For now ...