How do you sync ipset sets across two machines?

andthereitgoes asked:

I would like to replicate IPSet sets from one machine (server01) to another machine (server02) using rsync or btsync or something similar. Is that possible? If so how do I do it?

This is a redundancy measure in case server01 is unavailable.

My answer:

You can use ipset save and ipset restore to copy the current state of your IP sets.

For example (run as root on server01):

`ipset save | ssh server02 "ipset restore"`

There’s nothing like rsync for this, unfortunately. But for active/passive failover, the example above should work.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.