blob: 62ad71cc8a3ae6e27d95ce78d7afda0a6c6919d3 [file] [log] [blame]
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +02001Allows you to deploy gateway and back-end load-sharing clusters without the
2need of load-balancers.
3.PP
4This match requires that all the nodes see the same packets. Thus, the cluster
5match decides if this node has to handle a packet given the following options:
6.TP
Jan Engelhardt18c475d2009-06-10 20:18:43 +02007\fB\-\-cluster\-total\-nodes\fP \fInum\fP
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +02008Set number of total nodes in cluster.
9.TP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020010[\fB!\fP] \fB\-\-cluster\-local\-node\fP \fInum\fP
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020011Set the local node number ID.
12.TP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020013[\fB!\fP] \fB\-\-cluster\-local\-nodemask\fP \fImask\fP
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020014Set the local node number ID mask. You can use this option instead
Jan Engelhardt18c475d2009-06-10 20:18:43 +020015of \fB\-\-cluster\-local\-node\fP.
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020016.TP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020017\fB\-\-cluster\-hash\-seed\fP \fIvalue\fP
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020018Set seed value of the Jenkins hash.
19.PP
20Example:
21.IP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020022iptables \-A PREROUTING \-t mangle \-i eth1 \-m cluster
23\-\-cluster\-total\-nodes 2 \-\-cluster\-local\-node 1
24\-\-cluster\-hash\-seed 0xdeadbeef
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020025\-j MARK \-\-set-mark 0xffff
26.IP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020027iptables \-A PREROUTING \-t mangle \-i eth2 \-m cluster
28\-\-cluster\-total\-nodes 2 \-\-cluster\-local\-node 1
29\-\-cluster\-hash\-seed 0xdeadbeef
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020030\-j MARK -\-set\-mark 0xffff
31.IP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020032iptables \-A PREROUTING \-t mangle \-i eth1
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020033\-m mark ! \-\-mark 0xffff \-j DROP
34.IP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020035iptables \-A PREROUTING \-t mangle \-i eth2
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020036\-m mark ! \-\-mark 0xffff \-j DROP
37.PP
38And the following commands to make all nodes see the same packets:
39.IP
40ip maddr add 01:00:5e:00:01:01 dev eth1
41.IP
42ip maddr add 01:00:5e:00:01:02 dev eth2
43.IP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020044arptables \-A OUTPUT \-o eth1 \-\-h\-length 6
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020045\-j mangle \-\-mangle-mac-s 01:00:5e:00:01:01
46.IP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020047arptables \-A INPUT \-i eth1 \-\-h-length 6
48\-\-destination-mac 01:00:5e:00:01:01
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020049\-j mangle \-\-mangle\-mac\-d 00:zz:yy:xx:5a:27
50.IP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020051arptables \-A OUTPUT \-o eth2 \-\-h\-length 6
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020052\-j mangle \-\-mangle\-mac\-s 01:00:5e:00:01:02
53.IP
Jan Engelhardt18c475d2009-06-10 20:18:43 +020054arptables \-A INPUT \-i eth2 \-\-h\-length 6
55\-\-destination\-mac 01:00:5e:00:01:02
Pablo Neira Ayusocd958a62009-05-06 13:01:20 +020056\-j mangle \-\-mangle\-mac\-d 00:zz:yy:xx:5a:27
57.PP
58In the case of TCP connections, pickup facility has to be disabled
59to avoid marking TCP ACK packets coming in the reply direction as
60valid.
61.IP
62echo 0 > /proc/sys/net/netfilter/nf_conntrack_tcp_loose