Ubuntu: How can I make a specific set of iptables rules permanent? (3 solutions!)

preview_player
Показать описание
Ubuntu: How can I make a specific set of iptables rules permanent?

The Question: Is there a "best practice" or standard to make a few iptables rules permanent?
I mean: automatically applied upon a system reboot?
I am using a VPS with Ubuntu Server 10.04 LTS (Lucid Lynx).
Thank you.
BIG EDIT: I don't want ANY rule to be persisted (like iptables-persistent
package does). I want only my own specific set to be reloaded... if other rules
are eventually added by running iptables, these should be discarded...

Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful):

== This solution helped 49 people ==
iptables rules to a file and (re)load them (e.g., upon reboot).
So, for instance, you would run
# Load iptables rules from this file

== This solution helped 23 people ==
saving the iptable's rules, like this
or it's the same to put the file inside /etc/network/if-down.d/ or /etc/
network/if-post-down.d/ or /etc/network/if-pre-up.d/ or /etc/network/if-up.d/.

Рекомендации по теме