# and thus no proper routes to the external world it will instead
# route all packets through the nat-gw node.
#
-# NATGW_NODES is the list of nodes that belong to this natgw group.
+# CTDB_NATGW_NODES is the list of nodes that belong to this natgw group.
# You can have multiple natgw groups in one cluster but each node
# can only belong to one single natgw group.
#
-# NATGW_PUBLIC_IP=10.0.0.227/24
-# NATGW_PUBLIC_IFACE=eth0
-# NATGW_DEFAULT_GATEWAY=10.0.0.1
-# NATGW_PRIVATE_NETWORK=10.1.1.0/24
-# NATGW_NODES=/etc/ctdb/natgw_nodes
+# CTDB_NATGW_PUBLIC_IP=10.0.0.227/24
+# CTDB_NATGW_PUBLIC_IFACE=eth0
+# CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
+# CTDB_NATGW_PRIVATE_NETWORK=10.1.1.0/24
+# CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes
# where to log messages
# the default is /var/log/log.ctdb
. $CTDB_BASE/functions
loadconfig ctdb
-[ -z "$NATGW_PUBLIC_IFACE" ] && exit 0
+[ -z "$CTDB_NATGW_PUBLIC_IFACE" ] && exit 0
cmd="$1"
shift
delete_all() {
- remove_ip $NATGW_PUBLIC_IP $NATGW_PUBLIC_IFACE
- remove_ip $NATGW_PUBLIC_IP_HOST lo
+ remove_ip $CTDB_NATGW_PUBLIC_IP $CTDB_NATGW_PUBLIC_IFACE
+ remove_ip $CTDB_NATGW_PUBLIC_IP_HOST lo
ip route del 0.0.0.0/0 metric 10 >/dev/null 2>/dev/null
# Delete the masquerading setup from a previous iteration where we
# were the NAT-GW
- iptables -D POSTROUTING -t nat -s $NATGW_PRIVATE_NETWORK -d ! $NATGW_PRIVATE_NETWORK -j MASQUERADE >/dev/null 2>/dev/null
+ iptables -D POSTROUTING -t nat -s $CTDB_NATGW_PRIVATE_NETWORK -d ! $CTDB_NATGW_PRIVATE_NETWORK -j MASQUERADE >/dev/null 2>/dev/null
}
NATGWMASTER=`ctdb natgwlist | head -1`
NATGWIP=`ctdb natgwlist | tail --lines=+2 | head -1 | cut -d: -f3`
- NATGW_PUBLIC_IP_HOST=`echo $NATGW_PUBLIC_IP | sed -e "s/\/.*/\/32/"`
+ CTDB_NATGW_PUBLIC_IP_HOST=`echo $CTDB_NATGW_PUBLIC_IP | sed -e "s/\/.*/\/32/"`
delete_all
if [ "$MYPNN" == "$NATGWMASTER" ]; then
# This is the first node, set it up as the NAT GW
echo 1 >/proc/sys/net/ipv4/ip_forward
- iptables -A POSTROUTING -t nat -s $NATGW_PRIVATE_NETWORK -d ! $NATGW_PRIVATE_NETWORK -j MASQUERADE
- ip addr add $NATGW_PUBLIC_IP dev $NATGW_PUBLIC_IFACE
- ip route add 0.0.0.0/0 via $NATGW_DEFAULT_GATEWAY >/dev/null 2>/dev/null
+ iptables -A POSTROUTING -t nat -s $CTDB_NATGW_PRIVATE_NETWORK -d ! $CTDB_NATGW_PRIVATE_NETWORK -j MASQUERADE
+ ip addr add $CTDB_NATGW_PUBLIC_IP dev $CTDB_NATGW_PUBLIC_IFACE
+ ip route add 0.0.0.0/0 via $CTDB_NATGW_DEFAULT_GATEWAY >/dev/null 2>/dev/null
else
# This is not the NAT-GW
# Assign the public ip to the private interface and make
# We do this so that the ip address will exist on a
# non-loopback interface so that samba may send it along in the
# KDC requests.
- ip addr add $NATGW_PUBLIC_IP_HOST dev lo
+ ip addr add $CTDB_NATGW_PUBLIC_IP_HOST dev lo
ip route add 0.0.0.0/0 via $NATGWIP metric 10
fi
.\" Title: ctdbd
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/12/2009
+.\" Date: 05/14/2009
.\" Manual:
.\" Source:
.\"
-.TH "CTDBD" "1" "05/12/2009" "" ""
+.TH "CTDBD" "1" "05/14/2009" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
# and thus no proper routes to the external world it will instead
# route all packets through the nat\-gw node\.
#
-# NATGW_NODES is the list of nodes that belong to this natgw group\.
+# CTDB_NATGW_NODES is the list of nodes that belong to this natgw group\.
# You can have multiple natgw groups in one cluster but each node
# can only belong to one single natgw group\.
#
-# NATGW_PUBLIC_IP=10\.0\.0\.227/24
-# NATGW_PUBLIC_IFACE=eth0
-# NATGW_DEFAULT_GATEWAY=10\.0\.0\.1
-# NATGW_PRIVATE_NETWORK=10\.1\.1\.0/24
-# NATGW_NODES=/etc/ctdb/natgw_nodes
+# CTDB_NATGW_PUBLIC_IP=10\.0\.0\.227/24
+# CTDB_NATGW_PUBLIC_IFACE=eth0
+# CTDB_NATGW_DEFAULT_GATEWAY=10\.0\.0\.1
+# CTDB_NATGW_PRIVATE_NETWORK=10\.1\.1\.0/24
+# CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes
.fi
.RE
-.SS "NATGW_PUBLIC_IP"
+.SS "CTDB_NATGW_PUBLIC_IP"
.PP
This is an ip address in the public network that is used for all outgoing traffic when the public addresses are not assigned\. This address will be assigned to one of the nodes in the cluster which will masquerade all traffic for the other nodes\.
.PP
Format of this parameter is IPADDRESS/NETMASK
-.SS "NATGW_PUBLIC_IFACE"
+.SS "CTDB_NATGW_PUBLIC_IFACE"
.PP
-This is the physical interface where the NATGW_PUBLIC_IP will be assigned to\. This should be an interface connected to the public network\.
+This is the physical interface where the CTDB_NATGW_PUBLIC_IP will be assigned to\. This should be an interface connected to the public network\.
.PP
Format of this parameter is INTERFACE
-.SS "NATGW_DEFAULT_GATEWAY"
+.SS "CTDB_NATGW_DEFAULT_GATEWAY"
.PP
-This is the default gateway to use on the node that is elected to host the NATGW_PUBLIC_IP\. This is the default gateway on the public network\.
+This is the default gateway to use on the node that is elected to host the CTDB_NATGW_PUBLIC_IP\. This is the default gateway on the public network\.
.PP
Format of this parameter is IPADDRESS
-.SS "NATGW_PRIVATE_NETWORK"
+.SS "CTDB_NATGW_PRIVATE_NETWORK"
.PP
This is the network/netmask used for the interal private network\.
.PP
Format of this parameter is IPADDRESS/NETMASK
-.SS "NATGW_NODES"
+.SS "CTDB_NATGW_NODES"
.PP
This is the list of all nodes that belong to the same NATGW group as this node\. The default is /etc/ctdb/natgw_nodes\.
.SS "Operation"
.PP
When the NAT\-GW fiunctionality is used, one of the nodes is elected to act as a NAT router for all the other nodes in the group when they need to originate traffic to the external public network\.
.PP
-The NAT\-GW node is assigned the NATGW_PUBLIC_IP to the designated interface and the provided default route\. The NAT\-GW is configured to act as a router and to masquerade all traffic it receives from the internal private network and which is destined to the external network(s)\.
+The NAT\-GW node is assigned the CTDB_NATGW_PUBLIC_IP to the designated interface and the provided default route\. The NAT\-GW is configured to act as a router and to masquerade all traffic it receives from the internal private network and which is destined to the external network(s)\.
.PP
All other nodes in the group are configured with a default route of metric 10 pointing to the designated NAT GW node\.
.PP
# and thus no proper routes to the external world it will instead
# route all packets through the nat-gw node.
#
-# NATGW_NODES is the list of nodes that belong to this natgw group.
+# CTDB_NATGW_NODES is the list of nodes that belong to this natgw group.
# You can have multiple natgw groups in one cluster but each node
# can only belong to one single natgw group.
#
-# NATGW_PUBLIC_IP=10.0.0.227/24
-# NATGW_PUBLIC_IFACE=eth0
-# NATGW_DEFAULT_GATEWAY=10.0.0.1
-# NATGW_PRIVATE_NETWORK=10.1.1.0/24
-# NATGW_NODES=/etc/ctdb/natgw_nodes
- </pre></div><div class="refsect2" lang="en"><a name="id2476123"></a><h3>NATGW_PUBLIC_IP</h3><p>
+# CTDB_NATGW_PUBLIC_IP=10.0.0.227/24
+# CTDB_NATGW_PUBLIC_IFACE=eth0
+# CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
+# CTDB_NATGW_PRIVATE_NETWORK=10.1.1.0/24
+# CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes
+ </pre></div><div class="refsect2" lang="en"><a name="id2476123"></a><h3>CTDB_NATGW_PUBLIC_IP</h3><p>
This is an ip address in the public network that is used for all outgoing
traffic when the public addresses are not assigned.
This address will be assigned to one of the nodes in the cluster which
will masquerade all traffic for the other nodes.
</p><p>
Format of this parameter is IPADDRESS/NETMASK
- </p></div><div class="refsect2" lang="en"><a name="id2476141"></a><h3>NATGW_PUBLIC_IFACE</h3><p>
- This is the physical interface where the NATGW_PUBLIC_IP will be
+ </p></div><div class="refsect2" lang="en"><a name="id2476141"></a><h3>CTDB_NATGW_PUBLIC_IFACE</h3><p>
+ This is the physical interface where the CTDB_NATGW_PUBLIC_IP will be
assigned to. This should be an interface connected to the public network.
</p><p>
Format of this parameter is INTERFACE
- </p></div><div class="refsect2" lang="en"><a name="id2476156"></a><h3>NATGW_DEFAULT_GATEWAY</h3><p>
+ </p></div><div class="refsect2" lang="en"><a name="id2476156"></a><h3>CTDB_NATGW_DEFAULT_GATEWAY</h3><p>
This is the default gateway to use on the node that is elected to host
- the NATGW_PUBLIC_IP. This is the default gateway on the public network.
+ the CTDB_NATGW_PUBLIC_IP. This is the default gateway on the public network.
</p><p>
Format of this parameter is IPADDRESS
- </p></div><div class="refsect2" lang="en"><a name="id2476171"></a><h3>NATGW_PRIVATE_NETWORK</h3><p>
+ </p></div><div class="refsect2" lang="en"><a name="id2476172"></a><h3>CTDB_NATGW_PRIVATE_NETWORK</h3><p>
This is the network/netmask used for the interal private network.
</p><p>
Format of this parameter is IPADDRESS/NETMASK
- </p></div><div class="refsect2" lang="en"><a name="id2476186"></a><h3>NATGW_NODES</h3><p>
+ </p></div><div class="refsect2" lang="en"><a name="id2476186"></a><h3>CTDB_NATGW_NODES</h3><p>
This is the list of all nodes that belong to the same NATGW group
as this node. The default is /etc/ctdb/natgw_nodes.
</p></div><div class="refsect2" lang="en"><a name="id2476197"></a><h3>Operation</h3><p>
to act as a NAT router for all the other nodes in the group when
they need to originate traffic to the external public network.
</p><p>
- The NAT-GW node is assigned the NATGW_PUBLIC_IP to the designated
+ The NAT-GW node is assigned the CTDB_NATGW_PUBLIC_IP to the designated
interface and the provided default route. The NAT-GW is configured
to act as a router and to masquerade all traffic it receives from the
internal private network and which is destined to the external network(s).
# and thus no proper routes to the external world it will instead
# route all packets through the nat-gw node.
#
-# NATGW_NODES is the list of nodes that belong to this natgw group.
+# CTDB_NATGW_NODES is the list of nodes that belong to this natgw group.
# You can have multiple natgw groups in one cluster but each node
# can only belong to one single natgw group.
#
-# NATGW_PUBLIC_IP=10.0.0.227/24
-# NATGW_PUBLIC_IFACE=eth0
-# NATGW_DEFAULT_GATEWAY=10.0.0.1
-# NATGW_PRIVATE_NETWORK=10.1.1.0/24
-# NATGW_NODES=/etc/ctdb/natgw_nodes
+# CTDB_NATGW_PUBLIC_IP=10.0.0.227/24
+# CTDB_NATGW_PUBLIC_IFACE=eth0
+# CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
+# CTDB_NATGW_PRIVATE_NETWORK=10.1.1.0/24
+# CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes
</screen>
</refsect2>
- <refsect2><title>NATGW_PUBLIC_IP</title>
+ <refsect2><title>CTDB_NATGW_PUBLIC_IP</title>
<para>
This is an ip address in the public network that is used for all outgoing
traffic when the public addresses are not assigned.
</para>
</refsect2>
- <refsect2><title>NATGW_PUBLIC_IFACE</title>
+ <refsect2><title>CTDB_NATGW_PUBLIC_IFACE</title>
<para>
- This is the physical interface where the NATGW_PUBLIC_IP will be
+ This is the physical interface where the CTDB_NATGW_PUBLIC_IP will be
assigned to. This should be an interface connected to the public network.
</para>
<para>
</para>
</refsect2>
- <refsect2><title>NATGW_DEFAULT_GATEWAY</title>
+ <refsect2><title>CTDB_NATGW_DEFAULT_GATEWAY</title>
<para>
This is the default gateway to use on the node that is elected to host
- the NATGW_PUBLIC_IP. This is the default gateway on the public network.
+ the CTDB_NATGW_PUBLIC_IP. This is the default gateway on the public network.
</para>
<para>
Format of this parameter is IPADDRESS
</para>
</refsect2>
- <refsect2><title>NATGW_PRIVATE_NETWORK</title>
+ <refsect2><title>CTDB_NATGW_PRIVATE_NETWORK</title>
<para>
This is the network/netmask used for the interal private network.
</para>
</para>
</refsect2>
- <refsect2><title>NATGW_NODES</title>
+ <refsect2><title>CTDB_NATGW_NODES</title>
<para>
This is the list of all nodes that belong to the same NATGW group
as this node. The default is /etc/ctdb/natgw_nodes.
they need to originate traffic to the external public network.
</para>
<para>
- The NAT-GW node is assigned the NATGW_PUBLIC_IP to the designated
+ The NAT-GW node is assigned the CTDB_NATGW_PUBLIC_IP to the designated
interface and the provided default route. The NAT-GW is configured
to act as a router and to masquerade all traffic it receives from the
internal private network and which is destined to the external network(s).