I have a server with iptables rules setup. I want to use the same rules on a new server. Can I somehow copy/paste them or download/re-upload them using terminal? I’m on Ubuntu.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. Save it as follows:
Restore it as follows:
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-persistentinstalled and then copying the rules into the area thatiptables-persistentloads them:Above is for IPv4 rules. For for IPV6 rules do this: