Hitachi

For Linux(R) (x86) Systems HA Monitor Cluster Software


6.12.2 Specifying LAN status settings files

In HA Monitor, a LAN is connected and disconnected for each server. You must create LAN status settings files and then specify the files.

There are two types of LAN status settings files:

server-alias-name.up file

This file is used when a LAN is connected. It specifies the information needed for assigning to the LAN adapter the IP address used by the server.

server-alias-name.down file

This file is used when a LAN is disconnected. It specifies the information needed for deleting the IP address used by the server from the LAN adapter.

You must create these files under the directory for HA Monitor environment settings for each server. For server-alias-name in the file names, specify the value that was specified in the alias operand in the server environment definition.

HA Monitor provides sample LAN status settings files named server.up, server.down, server_ip.up, and server_ip.down in HA Monitor's sample file directory. If you copy these files to the directory for HA Monitor environment settings, you can save time in creating your LAN status settings files. Assign execution permissions to the files.

HA Monitor uses alias IP addresses to switch LANs. In the LAN status settings files, you specify these alias IP addresses, which are to be added to or deleted from LAN adapters, as arguments of the ifconfig, ip, and arping OS commands. For details about the OS commands, see the OS documentation.

If the OS is RHEL7 or a later version

Use either of the following combinations of sample LAN status settings files according to the command to be used:

  • ip command: server_ip.up and server_ip.down

  • ifconfig command: server.up and server.down

If the OS is RHEL6

Use the ifconfig command. Use the following combination of sample LAN status settings files:

  • server.up and server.down

This subsection explains how to specify LAN status settings files by using alias IP addresses.

Organization of this subsection

(1) Specifying the server-alias-name.up file

In the case where the ip command is used in RHEL7 or a later version

In the server-alias-name.up file, specify the interface name, alias IP address, and prefix (length of bits indicating the network) of the LAN adapter allocated to each host. If necessary, also specify the broadcast address and number of retries. After you have added an alias IP address, execute the echo and arping commands. The echo command clears the routine cache, and the arping command broadcasts an ARP request and updates the mapping of IP addresses and MAC addresses. Pay particular attention to the broadcast timings of ARP requests. In such a case, see (c) ARP request broadcast timings and take appropriate action.

The settings to be specified in the server-alias-name.up file differ depending on whether hbonding is used in RHEL7 or a later version.

If hbonding is not used in RHEL7 or a later version:

The following shows the contents of a server-alias-name.up file.

#!/bin/sh
set -x
 
INTERFACE=eXXX                     # LAN interface name
IPADDR=n.n.n.n                       # alias IP address
PREFIX=ee                           # address prefix
BROADCAST=nnn.nnn.nnn.nnn            # broadcast address
RETRYCNT=m                         # retry count
 
# Retry for the alias IP address adding.
exitcode=1
loopcnt=0
while [ $loopcnt -lt $RETRYCNT ]
do
    # The alias IP address is added to the LAN interface.
    /usr/sbin/ip addr add $IPADDR/$PREFIX broadcast $BROADCAST dev $INTERFACE
 
    # The information on old routing cache is deleted.
    /bin/echo 0 > /proc/sys/net/ipv4/route/flush
 
    # The ARP caches are updated.
    /sbin/arping -U -c 2 -I $INTERFACE $IPADDR
    sleep 1
    /sbin/arping -U -c 2 -I $INTERFACE $IPADDR
 
    # Was the alias IP address registered to the system ?
    RCD=`/usr/sbin/ip addr show dev $INTERFACE | grep " $IPADDR/$PREFIX "`
    if [ "$RCD" = "" ]
    then
        # When it is not registered, "1" is returned as the termination code.
        exitcode=1
 
        loopcnt=`/usr/bin/expr $loopcnt + 1`
    else

        # When it is registered, "0" is returned as the termination code.
        exitcode=0
 
        break
 
    fi
done
 
exit $exitcode
Legend:

eXXX: Interface name

n.n.n.n: Alias IP address

ee: Prefix

nnn.nnn.nnn.nnn: Broadcast address

m: Retry count

Taking into account occurrence of a temporary failure, we recommend that you specify 2 or a larger value for the number of retries (m).

If hbonding is used in RHEL7 or a later version:

The following shows the contents of a server-alias-name.up file. Note that, in this case, you must use the label specification to assign an IP address to the alias device. Also note that you must specify a physical device when executing the arping command.

#!/bin/sh
set -x
 
INTERFACE=hbondX                    # LAN interface name
IF_LABEL=hbondX:Y                   # alias device name
IPADDR=n.n.n.n                      # alias IP address
PREFIX=ee                           # address prefix
BROADCAST=nnn.nnn.nnn.nnn           # broadcast address
RETRYCNT=m                          # retry count
 
# Retry for the alias IP address adding.
exitcode=1
loopcnt=0
while [ $loopcnt -lt $RETRYCNT ]
do
    # The alias IP address is added to the LAN interface.
    /usr/sbin/ip addr add $IPADDR/$PREFIX broadcast $BROADCAST dev $INTERFACE label $IF_LABEL
 
    # The information on old routing cache is deleted.
    /bin/echo 0 > /proc/sys/net/ipv4/route/flush
 
    # The ARP caches are updated.
    /sbin/arping -U -c 2 -I $INTERFACE $IPADDR
    sleep 1
    /sbin/arping -U -c 2 -I $INTERFACE $IPADDR
 
    # Was the alias IP address registered to the system ?
    RCD=`/usr/sbin/ip addr show dev $INTERFACE | grep " $IPADDR/$PREFIX "`
    if [ "$RCD" = "" ]
    then
        # When it is not registered, "1" is returned as the termination code.
        exitcode=1
 
        loopcnt=`/usr/bin/expr $loopcnt + 1`
    else
        # When it is registered, "0" is returned as the termination code.
        exitcode=0
 
        break
 
    fi
done
 
exit $exitcode
Legend:

hbondX: Interface name

hbondX:Y: Alias device name

n.n.n.n: Alias IP address

ee: Prefix

nnn.nnn.nnn.nnn: Broadcast address

m: Retry count

Taking into account occurrence of a temporary failure, we recommend that you specify 2 or a larger value for the number of retries (m).

If the ifconfig command is used:

In the server-alias-name.up file, specify the interface name, IP index number, and alias IP address of the LAN adapter allocated to each host. If necessary, also specify a netmask, broadcast address, and number of retries. After you have added an alias IP address, execute the echo and arping commands. The echo command clears the routine cache, and the arping command broadcasts an ARP request and updates the mapping of IP addresses and MAC addresses. Pay particular attention to the broadcast timings of ARP requests. In such a case, see (c) ARP request broadcast timings and take appropriate action.

The following shows the contents of a server-alias-name.up file:

#!/bin/sh
set -x
 
INTERFACE=xxx:y                       # LAN interface name
IPADDR=n.n.n.n                        # alias IP address
NETMASK=nn.nn.nn.nn                  # netmask address
BROADCAST=nnn.nnn.nnn.nnn            # broadcast address
RETRYCNT=m                            # retry count
 
# Retry for the alias IP address adding.
exitcode=1
loopcnt=0
 
while [ $loopcnt -lt $RETRYCNT ]
do
    # The alias IP address is added to the LAN interface.
    /sbin/ifconfig $INTERFACE inet $IPADDR netmask $NETMASK broadcast $BROADCAST
 
    # The information on old routing cache is deleted.
    /bin/echo 0 > /proc/sys/net/ipv4/route/flush
 
    # The ARP caches are updated.
    IFNAME=`echo $INTERFACE | /bin/sed -e 's/:[0-9]*$//'`
    /sbin/arping -U -c 2 -I $IFNAME $IPADDR
    sleep 1
    /sbin/arping -U -c 2 -I $IFNAME $IPADDR
 
    # Was the alias IP address registered to the system ?
    RCD=`/sbin/ifconfig -a | /bin/grep -E "[:| ]$IPADDR "`
    if [ "$RCD" = "" ]
    then
        # When it is not registered, "1" is returned as the termination code.
        exitcode=1
 
        loopcnt=`/usr/bin/expr $loopcnt + 1`
    else
        # When it is registered, "0" is returned as the termination code.
        exitcode=0
 
        break
    fi
done
 
exit $exitcode
Legend:

xxx: Interface name

y: IP index number

n.n.n.n: Alias IP address

nn.nn.nn.nn: Netmask

nnn.nnn.nnn.nnn: Broadcast address

m: Retry count

If you use multiple alias IP addresses for a single interface, you must specify a different IP index number for each alias IP address.

If there is only one LAN status settings file or alias IP addresses will not be assigned to the same interface by multiple LAN status settings files, there is no need for retries. In this case, a server-alias-name.up file that was used with version 01-52 or earlier can also be used. However, we recommend that you specify 2 or a larger value for the number of retries (m), taking into account occurrence of a temporary failure.

(a) Overview of retry processing

This subsection provides an overview of retry processing by using the ifconfig command. Note that the information in this subsection does not apply if the ip command is used.

Be careful if there are multiple LAN status settings files that assign alias IP addresses to the same interface and these LAN status settings files are processed at the same time#. In such a case, one of the ifconfig commands might fail to assign alias IP addresses. For example, this problem might occur if server1.up is set to assign an alias IP address to eth1:1 and server2.up is set to assign an alias IP address to eth1:2.

This problem can be handled by retrying the processing. Specify the number of LAN status settings files that assign alias IP addresses to the same interface as the retry count (m) in the server-alias-name.up file. For example, in the case of server1.up and server2.up above, specify 2.

#

Multiple LAN status settings files might execute at the same time if server1 and server2 are started as active servers concurrently at the destination during hot standby processing resulting from a host failure.

(b) Assigning multiple alias IP addresses by one LAN status settings file

This subsection shows an example that assigns alias IP addresses to eth1 and eth2 by using one LAN status settings file.

This example assumes the following conditions:

  • In addition to this LAN status settings file, another LAN status settings file assigns a different alias IP address to eth1 (retry count for eth1 is 2).

  • Two LAN status settings files assign different alias IP addresses to eth2 (retry count for eth2 is 3).

  • If assignment of an alias IP address to eth1 fails, no IP address is assigned to eth2.

    #!/bin/sh
    set -x
     
    INTERFACE=eth1:1                    # LAN interface name
    IPADDR=192.168.100.100              # alias IP address
    NETMASK=255.255.255.0               # netmask address
    BROADCAST=192.168.100.255           # broadcast address
    RETRYCNT=2                          # retry count
     
    # Retry for the alias IP address adding.
    exitcode=1
    loopcnt=0
    while [ $loopcnt -lt $RETRYCNT ]
    do
        # The alias IP address is added to the LAN interface.
        /sbin/ifconfig $INTERFACE inet $IPADDR netmask $NETMASK broadcast $BROADCAST
     
        # The information on old routing cache is deleted.
        /bin/echo 0 > /proc/sys/net/ipv4/route/flush
     
        # The ARP caches are updated.
        IFNAME=`echo $INTERFACE | /bin/sed -e 's/:[0-9]*$//'`
        /sbin/arping -U -c 2 -I $IFNAME $IPADDR
        sleep 1
        /sbin/arping -U -c 2 -I $IFNAME $IPADDR
     
        # Was the alias IP address registered to the system ?
        RCD=`/sbin/ifconfig -a | /bin/grep ":$IPADDR "`
        if [ "$RCD" = "" ]
        then
            # When it is not registered, "1" is returned as the termination code.
            exitcode=1
     
            loopcnt=`/usr/bin/expr $loopcnt + 1`
        else
            # When it is registered, "0" is returned as the termination code.
            exitcode=0
     
            break
        fi
    done
     
    if [ "$exitcode" = "1" ]
    then
        exit $exitcode
    fi
     
    INTERFACE=eth2:1                    # LAN interface name
    IPADDR=192.168.200.100              # alias IP address
    NETMASK=255.255.255.0               # netmask address
    BROADCAST=192.168.200.255           # broadcast address
    RETRYCNT=3                          # retry count
     
    # Retry for the alias IP address adding.
    exitcode=1
    loopcnt=0
    while [ $loopcnt -lt $RETRYCNT ]
    do
        # The alias IP address is added to the LAN interface.
        /sbin/ifconfig $INTERFACE inet $IPADDR netmask $NETMASK broadcast $BROADCAST
     
        # The information on old routing cache is deleted.
        /bin/echo 0 > /proc/sys/net/ipv4/route/flush
        # The ARP caches are updated.
        IFNAME=`echo $INTERFACE | /bin/sed -e 's/:[0-9]*$//'`
        /sbin/arping -U -c 2 -I $IFNAME $IPADDR
        sleep 1
        /sbin/arping -U -c 2 -I $IFNAME $IPADDR
     
        # Was the alias IP address registered to the system ?
        RCD=`/sbin/ifconfig -a | /bin/grep ":$IPADDR "`
        if [ "$RCD" = "" ]
        then
            # When it is not registered, "1" is returned as the termination code.
            exitcode=1
     
            loopcnt=`/usr/bin/expr $loopcnt + 1`
        else
            # When it is registered, "0" is returned as the termination code.
            exitcode=0
     
            break
        fi
    done
     
    exit $exitcode

(c) ARP request broadcast timings

The ARP entry lock duration# might be set for clients and other machines (nodes) in the same network. When hot-standby switchover occurs, if a broadcast of an ARP request is performed in the lock duration of those nodes, the ARP entries on the nodes that received the ARP request are not updated. In this case, these nodes might fail to communicate with the switchover-destination host.

Therefore, an ARP request generated when hot-standby switchover occurs needs to be broadcast after the lock duration of those nodes. To achieve this, make sure that after the arping command is executed, sleep is used to wait for the lock duration, and then the arping command is executed again.

Note that in a system where the duration between stoppage of the hot-standby switchover source program that uses TCP communication and broadcasting of ARP request by the hot-standby switchover destination exceeds the lock duration, the sleep and second arping commands are unnecessary.

#

The ARP entry lock duration is the time during which ARP entries are not updated after the last time TCP communication is closed.

In RHEL, the default is 1 second.

In RHEL, the ARP entry lock duration that is set for each host can be checked with /proc/sys/net/ipv4/neigh/interface-name/locktime (unit: jiffy).

(2) Specifying the server-alias-name.down file

In the case where the ip command is used in RHEL7 or a later version

In the server-alias-name.down file, specify the interface name, alias IP address, and prefix (length of bits indicating the network) of the LAN adapter allocated to each host. If necessary, also specify the number of retries.

The settings to be specified in the server-alias-name.down file differ depending on whether hbonding is used in RHEL7 or a later version.

If hbonding is not used in RHEL7 or a later version:

The following shows the contents of a server-alias-name.down file.

#!/bin/sh
set -x
 
INTERFACE=eXXX                      # LAN interface name
IPADDR=n.n.n.n                        # alias IP address
PREFIX=ee                            # address prefix
RETRYCNT=m                          # retry count
 
# Retry for the alias IP address delete.
exitcode=1
loopcnt=0
while [ $loopcnt -lt $RETRYCNT ]
do
    # The alias IP address is deleted from the LAN interface.
    /usr/sbin/ip addr del $IPADDR/$PREFIX dev $INTERFACE
 
    # Was the alias IP address deleted from the system ?
    RCD=`/usr/sbin/ip addr show dev $INTERFACE | grep " $IPADDR/$PREFIX "`
    if [ "$RCD" = "" ]
    then
        # When it is deleted, "0" is returned as the termination code.
        exitcode=0
        break
    else
        # When it is not deleted, "1" is returned as the termination code.
        exitcode=1
        loopcnt=`/usr/bin/expr $loopcnt + 1`
        sleep 1
    fi
done
 
# The information on old routing cache is deleted.
/bin/echo 0 > /proc/sys/net/ipv4/route/flush
 
exit $exitcode
Legend:

eXXX: Interface name

n.n.n.n: Alias IP address

ee: Prefix

m: Number of retries

Taking into account occurrence of a temporary failure, we recommend that you specify 2 or a larger value for the number of retries (m).

If hbonding is used in RHEL7 or a later version:

The following shows the contents of a server-alias-name.down file. Note that, in this case, you must use the label specification to assign an IP address to the alias device. Also note that you must specify a physical device when executing the arping command.

#!/bin/sh
set -x
 
INTERFACE=hbondX                    # LAN interface name
IF_LABEL=hbondX:Y                   # alias device name
IPADDR=n.n.n.n                      # alias IP address
PREFIX=ee                           # address prefix
RETRYCNT=m                          # retry count
 
# Retry for the alias IP address delete.
exitcode=1
loopcnt=0
while [ $loopcnt -lt $RETRYCNT ]
do
    # The alias IP address is deleted from the LAN interface.
    /usr/sbin/ip addr del $IPADDR/$PREFIX dev $INTERFACE label $IF_LABEL
 
    # Was the alias IP address deleted from the system ?
    RCD=`/usr/sbin/ip addr show dev $INTERFACE | grep " $IPADDR/$PREFIX "`
    if [ "$RCD" = "" ]
    then
        # When it is deleted, "0" is returned as the termination code.
        exitcode=0
        break
    else
        # When it is not deleted, "1" is returned as the termination code.
        exitcode=1
        loopcnt=`/usr/bin/expr $loopcnt + 1`
        sleep 1
    fi
done
 
# The information on old routing cache is deleted.
/bin/echo 0 > /proc/sys/net/ipv4/route/flush
 
exit $exitcode
Legend:

hbondX: Interface name

hbondX:Y: Alias device name

n.n.n.n: Alias IP address

ee: Prefix

m: Number of retries

Taking into account occurrence of a temporary failure, we recommend that you specify 2 or a larger value for the number of retries (m).

If the ifconfig command is used:

In the server-alias-name.down file, specify the interface name and IP index number of the LAN adapter allocated to each host.

The following shows the contents of a server-alias-name.down file:

#!/bin/sh
set -x
 
INTERFACE=xxx:y                      # LAN interface name
 
# The alias IP address is deleted from the LAN interface.
/sbin/ifconfig   $INTERFACE down
 
# The information on old routing cache is deleted.
/bin/echo 0 > /proc/sys/net/ipv4/route/flush
Legend:

xxx: Interface name

y: IP index number

If use is specified in the fence_lan operand in the HA Monitor environment settings, the results of deleting alias IP addresses is checked. Create a server-alias-name.down file with the contents shown below.

Note that these contents can still be used even when use is not specified in the fence_lan operand.

#!/bin/sh
set -x
 
INTERFACE=xxx:y                      # LAN interface name
RETRYCNT=m                           # retry count
 
# Retry for the alias IP address delete.
exitcode=1
loopcnt=0
while [ $loopcnt -lt $RETRYCNT ]
do
    # The alias IP address is deleted from the LAN interface.
    /sbin/ifconfig $INTERFACE down
 
    # Was the alias IP address deleted from the system ?
    RCD=`/sbin/ifconfig -a | /bin/grep -E "$INTERFACE( |: )"`
    if [ "$RCD" = "" ]
    then
    # When it is deleted, "0" is returned as the termination code.
        exitcode=0
        break
    else
        # When it is not deleted, "1" is returned as the termination code.
        exitcode=1
    loopcnt=`/usr/bin/expr $loopcnt + 1`
        sleep 1
    fi
done
 
# The information on old routing cache is deleted.
/bin/echo 0 > /proc/sys/net/ipv4/route/flush
 
exit $exitcode
Legend:

xxx: Interface name

y: IP index number

m: Retry count

Taking into account occurrence of a temporary failure, we recommend that you specify 2 or a larger value for the number of retries (m).