Skip to content
Browse files

added scripts

  • Loading branch information...
1 parent d2dd54d commit c182fc1f434ff2d2a993205f29c0e39b2ad2d75a Arturo Borrero committed May 10, 2012
Showing with 102 additions and 0 deletions.
  1. +34 −0 ip6tables-cluster
  2. +34 −0 ipset-cluster
  3. +34 −0 iptables-cluster
View
34 ip6tables-cluster
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Arturo Borrero <aborrero@cica.es>
+# <cer.inet@linuxmail.org>
+# <arturo.borrero.glez@gmail.com>
+# Licensed under GPLv3
+# www.gnu.org/licenses/gpl-3.0.html
+
+# This tool expects a file in $CONFIG with
+# a variable declaration in this way: NODE_LIST="node1 node2.example.com 192.168.2.2 2a00:9ac0:ex:am:ple"
+# Use SSH tools (ssh-keygen, ssh-copy-id and so) to get transparent SSH between nodes.
+
+# Local vars
+IPT=/sbin/ip6tables
+CONFIG="/etc/ip6tables-cluster.cfg"
+
+# Loading configuration
+if [ ! -r $CONFIG ]
+then
+ echo "E: Config file not found: $CONFIG" >&2 ; exit 1
+else
+ source $CONFIG || { echo "E: While loading config file: $CONFIG" >&2 ; exit 1 ; }
+fi
+
+# Launching local command
+$IPT $*
+
+
+# Launching external command
+for node in $NODE_LIST
+do
+ echo ""
+ ( ssh $node $IPT $* ) 2> /dev/null &
+done
View
34 ipset-cluster
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Arturo Borrero <aborrero@cica.es>
+# <cer.inet@linuxmail.org>
+# <arturo.borrero.glez@gmail.com>
+# Licensed under GPLv3
+# www.gnu.org/licenses/gpl-3.0.html
+
+# This tool expects a file in $CONFIG with
+# a variable declaration in this way: NODE_LIST="node1 node2.example.com 192.168.2.2 2a00:9ac0:ex:am:ple"
+# Use SSH tools (ssh-keygen, ssh-copy-id and so) to get transparent SSH between nodes.
+
+# Local vars
+IPT=/usr/sbin/ipset
+CONFIG="/etc/ipset-cluster.cfg"
+
+# Loading configuration
+if [ ! -r $CONFIG ]
+then
+ echo "E: Config file not found: $CONFIG" >&2 ; exit 1
+else
+ source $CONFIG || { echo "E: While loading config file: $CONFIG" >&2 ; exit 1 ; }
+fi
+
+# Launching local command
+$IPT $*
+
+
+# Launching external command
+for node in $NODE_LIST
+do
+ echo ""
+ ( ssh $node $IPT $* ) 2> /dev/null &
+done
View
34 iptables-cluster
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Arturo Borrero <aborrero@cica.es>
+# <cer.inet@linuxmail.org>
+# <arturo.borrero.glez@gmail.com>
+# Licensed under GPLv3
+# www.gnu.org/licenses/gpl-3.0.html
+
+# This tool expects a file in $CONFIG with
+# a variable declaration in this way: NODE_LIST="node1 node2.example.com 192.168.2.2 2a00:9ac0:ex:am:ple"
+# Use SSH tools (ssh-keygen, ssh-copy-id and so) to get transparent SSH between nodes.
+
+# Local vars
+IPT=/sbin/iptables
+CONFIG="/etc/iptables-cluster.cfg"
+
+# Loading configuration
+if [ ! -r $CONFIG ]
+then
+ echo "E: Config file not found: $CONFIG" >&2 ; exit 1
+else
+ source $CONFIG || { echo "E: While loading config file: $CONFIG" >&2 ; exit 1 ; }
+fi
+
+# Launching local command
+$IPT $*
+
+
+# Launching external command
+for node in $NODE_LIST
+do
+ echo ""
+ ( ssh $node $IPT $* ) 2> /dev/null &
+done

0 comments on commit c182fc1

Please sign in to comment.
Something went wrong with that request. Please try again.