Answer the question
In order to leave comments, you need to log in
What needs to be done so that ipset would save the sets after rebooting the server?
Good afternoon habralyudi.
I have a hatzner server
uname -r
2.6.32-5-amd64
cat /etc/debian_version
6.0.5
iptables --version
iptables v1.4.8
ipset --version
ipset v4.2, protocol version 4.
Kernel module protocol version 4.
Answer the question
In order to leave comments, you need to log in
A simple and working solution by developing the "Max_rip" tip.
"Max_rip" gave great advice "/etc/init.d/iptables-persistent, Will add ipset save / ipset restore there". Only due to the fact that the soft sign is missing in the word "add" does not make sense on the first reading and it seems that /etc/init.d/iptables-persistent should do everything automatically. I tried - it doesn't work automatically. iptables-persistent preserves iptables settings, but does not preserve ipset sets without a file.
for me: First, the iptables-persistent package must be installed. Install on Debian like
this. This package will allow us to save the IPTABLES rules with a command from the console. After a reboot, the iptables rules will no longer be reset.
Next, edit the startup script /etc/init.d/iptables-persistent
Find the save_rules() section and add a line to it first.
This will save the IPSET sets each time you save the iptables rules using iptables-persistent.
After that we find the load_rules() section and add a line at the beginning
This will load the IPSETs each time the iptables rules are loaded with iptables-persistent.
This option is the most convenient in my opinion. One command from the console saves both iptables rules and Ipset sets. After a reboot, the rules will be saved.
Good luck.
So iptables does not save the rules)
You need to do this manually or automate the process.
/etc/init.d/iptables-persistent
Will add ipset save / ipset restore there
I confess. Itself could guess that set's ipset works also as well as tables/rules d iptables.
Finally did this:
touch /etc/default/ipsetrules
vi /etc/default/ipsetrules
# Generated by ipset 4.2 on Mon Sep 3 14:12:06 2012
-N blacklist iphash --hashsize 1024 --probes 8 --resize 50
-A blacklist 62.76.191.99
COMMIT
# Completed on Mon Sep 3 14:12:06 2012
ipset -X
ipset --restore </etc/default/ipsetrules
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question