Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[SSI] openssi/openssi-tools/net/ha-lvs clusterip.sh,1.3,1.4 interface.c,1.5: msg#00067

Subject: [SSI] openssi/openssi-tools/net/ha-lvs clusterip.sh,1.3,1.4 interface.c,1.5,1.6
Update of /cvsroot/ssic-linux/openssi/openssi-tools/net/ha-lvs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26684

Modified Files:
      Tag: OPENSSI-DEBIAN
        clusterip.sh interface.c 
Log Message:
Configure gateway. This should enable some form of failover. This is needed 
even for DR


Index: clusterip.sh
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/openssi-tools/net/ha-lvs/clusterip.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- clusterip.sh        13 Jul 2004 06:31:42 -0000      1.3
+++ clusterip.sh        15 Jul 2004 09:25:32 -0000      1.4
@@ -1,10 +1,29 @@
 #!/bin/bash
 
+#$1  -> IP address 
+#$2 -> base interface name example eth0. This interface should be 
+#      configured. We get netmask from there
+function configure_interface()
+{
+       index=`echo $1 | awk  -F . '{ print $4 }'`;
+       INTERFACE_NAME=$2:$index
 
- if [ $# -lt 3 ]; then 
-       /bin/echo  "Usage: clusterip.sh  "director/realserver" clusterip 
interface";
+       # See any interface is already configured with the IP. If not configure 
it
+       /sbin/ifconfig -a | grep $1
+       if [ $? -ne 0 ]; then
+               # Get the netmask
+               mask=`/sbin/ifconfig $2  | grep Mask | awk -F':' '{print $4}'`
+               # Now  configure the interface
+               /sbin/ifconfig $INTERFACE_NAME $1 netmask $mask
+       fi
+
+}
+
+if [ $# -lt 4 ]; then 
+       /bin/echo  "Usage: clusterip.sh  "director/realserver" clusterip 
interface1 interface2";
        /bin/echo  "Where clusterip is the dotted IP address ";
-       /bin/echo  "interface is the interface name that should be configured";
+       /bin/echo  "interface1 is the interface name that should be configured 
with CVIP";
+       /bin/echo  "interface2 is the interface name that should be configured 
for cluster internal gateway";
        /bin/echo  " ";
        /bin/echo  " ";
        /bin/echo  " ";
@@ -26,19 +45,24 @@
         LVS_ROUTING="DR"
 fi
         
+CVIP=$2;
+index=`echo $CVIP | awk  -F . '{ print $4 }'`;
+INTERFACE=$3:$index;
+LO_INTERFACE=lo:$index;
+
 # Now let the kernel know the the routing 
 echo $LVS_ROUTING > /proc/cluster/lvs_routing
 
 if [ x$LVS_ROUTING = xDR ]; then 
 
-       CVIP=$2;
-       index=`echo $CVIP | awk  -F . '{ print $4 }'`;
-       INTERFACE=$3:$index;
-       LO_INTERFACE=lo:$index;
 
        if [ $DIRECTOR -eq 1  ];then 
 
                /bin/echo "Running on the LVS  Director";
+
+               if [ -n $LVS_INTERNAL_GW ]; then
+                       configure_interface $LVS_INTERNAL_GW  $4
+               fi
                #Making director reply for ARP on CVIP
                /bin/echo "0" >/proc/sys/net/ipv4/conf/all/hidden;
                /bin/echo "0" >/proc/sys/net/ipv4/conf/lo/hidden;
@@ -98,6 +122,11 @@
                        route add -host $CVIP dev $INTERFACE
                fi
 
+               if [ -n $LVS_INTERNAL_GW ]; then
+                       #installing default gw
+                       /sbin/route add default gw  $LVS_INTERNAL_GW
+               fi
+
        fi
        #set ip_forward OFF for vs-dr director/real server  (1 on, 0 off)
        /bin/echo "0" >/proc/sys/net/ipv4/ip_forward;
@@ -116,6 +145,8 @@
 
        if [ $DIRECTOR -eq 1  ];then 
                /bin/echo "Running on the LVS  Director";
+
+               configure_interface $LVS_INTERNAL_GW $4
                #set ip_forward ON for vs-nat director (1 on, 0 off).
                /bin/echo "1" >/proc/sys/net/ipv4/ip_forward
 
@@ -131,10 +162,14 @@
                ipvsadm --set 36000 0 0
                # set the director node to forward connection originating from 
                # real server 
-               iptables --table nat --append POSTROUTING --out-interface $3 
--jump MASQUERADE
+               iptables -t nat -A POSTROUTING  -o $3 -j MASQUERADE
 
        elif [ $DIRECTOR -eq 2  ];then 
                /bin/echo "Running on  LVS Director-backup";
+               #installing default gw
+               /sbin/route add default gw  $LVS_INTERNAL_GW
+               #set_realserver_ip_forwarding to OFF (1 on, 0 off).
+               /bin/echo "0" >/proc/sys/net/ipv4/ip_forward
        else
                /bin/echo "Running on  node other than LVS Director";
                #installing default gw

Index: interface.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/openssi-tools/net/ha-lvs/interface.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- interface.c 9 Jul 2004 08:16:21 -0000       1.5
+++ interface.c 15 Jul 2004 09:25:33 -0000      1.6
@@ -45,7 +45,8 @@
                        if( (pid = fork()) == 0 ) {
                                execl(CLUSTERIPCONF_PATH,CLUSTERIP_CONF,
                                                "director",gclist->cvip[i],
-                                               
get_garp_interface(nodenum),(char *) 0);
+                                               get_garp_interface(nodenum),
+                                               
get_multicast_interface(nodenum), (char *) 0);
                                /* Just a safe stand */
                                exit(1);
 
@@ -91,7 +92,7 @@
                        if( (pid = fork()) == 0 ) {
                                execl(CLUSTERIPCONF_PATH,CLUSTERIP_CONF,
                                                node_role,clist->cvip[i],
-                                               "lo",(char *)0);
+                                               "lo", "lo", (char *)0);
                                /* Just a safe stand */
                                exit(1);
 



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation