9.2 DHCP Installation and Configuration

9.2.1 Prerequisites

  • Novell Cluster Services

  • DHCP must be installed on every server

    NOTE:In cluster setup, Runtime Credentials must be set on all the nodes in the DHCP cluster. For more information, see Section 11.3, Setting Runtime Credentials.

Novell Cluster Services 2.0 provides a DHCP resource template, which facilitates configuring DHCP with a shared Linux POSIX volume in a cluster environment. Use the instructions in Configuring and Managing Cluster Resources for Shared LVM Volume Groups in the OES 11 SP2: Novell Cluster Services for Linux Administration Guide. Afterwards, cluster-enable the shared volume by using the DHCP template.

For details on installing the DHCP server, see Section 6.0, Installing and Configuring DHCP.

For details on Cluster Services, see Overview of Novell Cluster Services.

9.2.2 Configuring DHCP on the Shared Disk

To configure DHCP to use shared storage, you need to create a shared directory (file system or disk) on the shared disk system and create mount points to that shared file system on each cluster server that will run DHCP.

  1. Use LVM to create a file system on the shared disk system.

    Enter yast2 disk at the terminal console to access the LVM tools in YaST Expert Partitioner.

  2. On each cluster node that runs DHCP, create the directory path that is used as the mount point. At a terminal console prompt, log in as the root user, then enter mkdir /mnt/dhcp.

  3. Log in as the root user and mount the shared disk (file system) that was created in Step 1.

    For example, depending on the mount point and directory names, you could enter a command similar to the following to mount the shared disk:

    mount /dev/volgroup/clustervol /mnt/dhcp

  4. At the root of the shared disk you just created (/mnt/dhcp), enter the following commands to create the directories specified:

    mkdir etc

    mkdir -p var/lib/dhcp/db

    The db directory must be owned by the user that is used in /etc/sysconfig/dhcpd in the parameter DHCPD_RUN_AS="dhcpd". Also, all the four directories must have permissions of drwxr-xr-x.

9.2.3 Configuring the dhcpd.conf File

  1. Copy the dhcpd.conf file from the /etc directory on one of the OES cluster servers to the etc directory you created on the shared disk in Step 4.

    This would be the /mnt/dhcp/etc directory if you used the same directory names as those given in the example above.

  2. Modify the LDAP attributes as required. For example, ldap-server 192.168.0.1; ldap-dhcp-server-cn DHCP_acme;

9.2.4 Creating a dhcpd.leases File

A dhcpd.leases file is necessary for DHCP to function. The DHCP daemon requires this file before it starts. The file can be empty, and it must reside in the var/lib/dhcp/db directory you created in Step 4.

One way to create the empty file is to use the touch command. For example, if you used the directory names listed in the example above, you could enter the following to create an empty dhcpd.leases file:

touch /mnt/dhcp/var/lib/dhcp/db/dhcpd.leases

9.2.5 Novell Cluster Services Configuration and Setup

After DHCP is properly installed and configured, you must create and configure a DHCP resource in Novell Cluster Services. This includes configuring DHCP load and unload scripts, setting DHCP start, failover, and failback modes, and assigning the DHCP resource to specific servers in your cluster.

Creating a DHCP Cluster Resource

Novell Cluster Services includes a DHCP resource template, which greatly simplifies the process for creating a DHCP cluster resource. Much of the DHCP cluster resource configuration is performed automatically by the DHCP resource template.

To create a DHCP cluster resource:

  1. Ensure that the shared disk (file system) you created and mounted in Step 2 is unmounted.

    If you used the directory names specified in the example, you can enter unmount /mnt/dhcp to unmount the shared disk.

  2. Open your Internet browser and enter the URL for iManager.

    The URL is http://server_ip_address/nps/iManager.html. Replace server_ip_address with the IP address or DNS name of a server in the cluster or with the IP address for Apache-based services.

  3. Enter your username and password.

  4. In Roles and Tasks, select Clusters > My Clusters, then select the cluster.

    If the cluster does not appear in your personalized list of clusters to manage, you can add it. Click Add, browse and select the cluster, then click OK. Wait for the cluster to appear in the list and report its status, then select the cluster.

  5. On the Cluster Manager page, click New.

  6. Specify Resource as the resource type you want to create by clicking the Resource radio button, then click Next.

  7. Specify a name for the DHCP resource.

    Do not use periods in cluster resource names. Novell clients interpret periods as delimiters. If you use a space in a cluster resource name, that space is converted to an underscore.

  8. Type the DHCP template name in the Inherit From Template field, or browse and select it from the list.

  9. Select the Define Additional Properties check box, click Next, then continue with Configuring DHCP Load, Unload, and Monitor Scripts.

    The DHCP resource template configures the DHCP resource by automatically creating DHCP load and unload scripts, setting failover and failback modes, and assigning DHCP as a resource to all nodes in the cluster.

Configuring DHCP Load, Unload, and Monitor Scripts

Table 9-1 Sample Values for DHCP Load and Unload Scripts

Variable

Template Value

Description

Resource_IP

a.b.c.d

IP address of the virtual cluster server for this cluster resource.

MOUNT_FS

ext3

The file system type you made on the LVM volume.

VOLGROUP_NAME

myclustervg01

The name you gave to the cluster segment manager.

MOUNT_POINT

/mnt/dhcp

The mount location for the LVM volume you created. This example shows a mount location with a directory named the same as the LVM volume name. You can mount the LVM volume anywhere.

MOUNT_DEV

/dev/$VOLGROUP_NAME/myclustervol01

The Linux path for the LVM volume you created.

Load Script Configuration

The DHCP load script page should already be displayed. The load script contains commands to start the DHCP service. You must customize some commands for your specific DHCP configuration.

NOTE:The scripts in this section are based on the template values in Table 9-1. Make sure to substitute the sample values with the ones you used in your solution.

The load script appears similar to the following example:

#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs

# define the IP address
RESOURCE_IP=10.10.189.136
# define the file system type
MOUNT_FS=ext3
#define the volume group name
VOLGROUP_NAME=myclustervg01
# define the device
MOUNT_DEV=/dev/$VOLGROUP_NAME/myclustervol01
# define the mount point
MOUNT_POINT=/mnt/myclustervol01

#activate the volume group
exit_on_error vgchange -a ey $VOLGROUP_NAME

# mount the file system
exit_on_error mount_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS

# add the IP address
exit_on_error add_secondary_ipaddress $RESOURCE_IP

# load the DHCP server
exit_on_error /opt/novell/dhcp/bin/cluster_dhcpd.sh -m $MOUNT_POINT

exit 0

Configuring the DHCP Load Script:

Add the following line to the script before exit 0 to load DHCP:

exit_on_error /opt/novell/dhcp/bin/cluster_dhcpd.sh -m $MOUNT_POINT

NOTE: You must add this line only for OES versions prior to OES 11 SP1 May 2013 patch. For later OES versions, this line is automatically added to the load script.

To customize the DHCP load script for your specific configuration:

  1. View and, if necessary, edit the following lines for your specific container name, device, and mount point:

    #define the container name
    container_name=name
    # define the device
    MOUNT_DEV=/dev/volgroup/clustervol 
    # define the mount point
    MOUNT_POINT=/mnt/dhcp
    
  2. Edit the following line to assign a unique IP address to the DHCP cluster resource:

    RESOURCE_IP=a.b.c.d
    

    Replace <a.b.c.d> with the IP address you want to assign to the DHCP cluster resource.

    The IP address for the DHCP cluster resource allows clients to reconnect to that address regardless of which server is hosting it.

  3. Click Next and continue with the Unload Script Configuration.

Unload Script Configuration

The DHCP unload script page should now be displayed. The unload script contains commands to stop the DHCP service. You must customize some commands for your specific DHCP configuration.

NOTE:The scripts in this section are based on the template values in Table 9-1. Make sure to substitute the sample values with the ones you used in your solution.

The unload script appears similar to the following example:

#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs

# define the IP address
RESOURCE_IP=10.10.189.136
# define the file system type
MOUNT_FS=ext3
#define the volume group name
VOLGROUP_NAME=myclustervg01
# define the device
MOUNT_DEV=/dev/$VOLGROUP_NAME/myclustervol01
# define the mount point
MOUNT_POINT=/mnt/myclustervol01

# request dhcpd stop
ignore_error killproc -p /var/lib/dhcp/var/run/dhcpd.pid -TERM /usr/sbin/dhcpd

# del the IP address
ignore_error del_secondary_ipaddress $RESOURCE_IP

#unmount the volume
sleep 10 # if not using SMS for backup, please comment out this line
exit_on_error umount_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS

#deactivate the volume group
exit_on_error vgchange -a n $VOLGROUP_NAME

# return status
exit 0

Configuring the DHCP unload script:

Add the line ignore_error killproc -p /var/lib/dhcp/var/run/dhcpd.pid -TERM /usr/sbin/dhcpd before the following:

# del the IP address
ignore_error del_secondary_ipaddress $RESOURCE_IP

NOTE:You must add this line only for OES versions prior to OES 11 SP1 May 2013 patch. For later OES versions, this line is automatically added to the unload script.

The path for the dhcpd.pid file changed between OES 11 and OES 11 SP1. In OES 11, the DHCP process ID is located in /var/run/dhcpd.pid. In OES 11 SP1 and later versions, the DHCP process ID is located in /var/lib/dhcp/var/run/dhcpd.pid. During a cluster upgrade from OES 11 to OES 11 SP1 and later, you must change the path for dhcpd.pid. For more information see Changing the Path for dhcpd.pid.

Changing the Path for dhcpd.pid

During a cluster upgrade from OES 11 to OES 11 SP1 and later versions, you must modify the location of the dhcpd.pid file in the unload script from /var/run/dhcpd.pid to /var/lib/dhcp/var/run/dhcpd.pid. After you modify the script, you should bring the resource online only on OES 11 SP1 and later nodes.

  1. In your OES 11 cluster, upgrade one or more nodes to OES 11 SP1 and later.  

    At least one of the upgraded nodes should appear in the DHCP resource's preferred nodes list. If it is not, you can modify the resource's preferred nodes list. For information about how to set preferred nodes, see Configuring Preferred Nodes and Node Failover Order for a Resource in the OES 11 SP2: Novell Cluster Services for Linux Administration Guide“.

  2. Cluster migrate the DHCP resource to an OES 11 SP1 and later node in its preferred nodes list:

    1. Log in as the root user to the OES 11 node where the resource is running, then open a terminal console.

    2. At the command prompt, enter

      cluster migrate <dhcp_resource_name> <oes11sp1_node_name>

      The DHCP resource goes offline on the OES 11 node and comes online on the specified OES 11 SP1 and later node.

  3. Log in to iManager, click Clusters, select the cluster, then click the Cluster Manager tab.

  4. On the Cluster Manager tab, select the check box next to the DHCP resource, then click Offline.

  5. At a command prompt on the OES 11 SP1 and later cluster node, manually stop the DHCP process by entering:

    killproc -p /var/lib/dhcp/var/run/dhcpd.pid -TERM /usr/sbin/dhcpd

    You must do this because the path in the old unload script is different from the path in OES 11 SP1 and later versions.

  6. In iManager, click the Cluster Options tab, then click the DHCP resource link to open its Properties page.

  7. Modify the path for the dhcpd.pid file in the unload script for the DHCP resource:

    1. Click the Scripts tab, then click Unload Script.

    2. Look for the following line in the DHCP unload script from OES 11:

      ignore_error killproc -p /var/run/dhcpd.pid -TERM /usr/sbin/dhcpd

    3. Change it to the following for OES 11 SP1 and later versions:

      ignore_error killproc -p /var/lib/dhcp/var/run/dhcpd.pid -TERM /usr/sbin/dhcpd

    4. Click Apply to save the script changes.

  8. Click the Preferred Nodes tab, remove the OES 11 nodes from the Assigned Nodes list, then click Apply.

    After the unload script change, you want the DHCP resource to fail over only to OES 11 SP1 and later nodes. This is necessary to ensure a graceful shutdown of the dhcpd.pid when the DHCP resource fails over to a different node. For information about how to set preferred nodes, see Configuring Preferred Nodes and Node Failover Order for a Resource in the OES 11 SP2: Novell Cluster Services for Linux Administration Guide.

  9. Click OK to save your changes and close the resource's Properties page.

  10. Bring the DHCP resource online again. Click the Cluster Manager tab, select the check box next to the DHCP resource, then click Online.

    The resource will come online on the OES 11 SP1 and later node that is listed as its most preferred node if the node is available.

To customize the DHCP unload script for your specific configuration:

  1. View and, if necessary edit the container name, device, and mount point in the applicable lines of the unload script.

  2. Replace <a.b.c.d> with the same IP address you specified in the load script, then click Next.

    The page to set Start, Failover, and Failback modes is now displayed

  3. Continue with Monitor Script.

Monitor Script

The monitor script contains commands to monitor the DHCP service. The monitor script appears similar to the following example:

#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs

# define the IP address
RESOURCE_IP=a.b.c.d
# define the file system type
MOUNT_FS=ext3
#define the volume group name
VOLGROUP_NAME=name
# define the device
MOUNT_DEV=/dev/$VOLGROUP_NAME/dhcp
# define the mount point
MOUNT_POINT=/mnt/dhcp

#check the logical volume
exit_on_error status_lv $MOUNT_DEV

# check the file system
exit_on_error status_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS

# check the IP address
exit_on_error status_secondary_ipaddress $RESOURCE_IP

# check dhcpd
exit_on_error rcnovell-dhcpd status

# return status
exit 0 

Configuring the DHCP Monitor Script:

  1. Replace the line exit_on_error rcnovell-dhcpd status with the following:

    rcnovell-dhcpd status 
    if test $? != 0; then 
         exit_on_error /opt/novell/dhcp/bin/cluster_dhcpd.sh -m <MOUNT_POINT> 
    fi 
    exit_on_error rcnovell-dhcpd status 
    
  2. Continue with Setting DHCP Start, Failover, and Failback Modes.

Setting DHCP Start, Failover, and Failback Modes

  1. The DHCP resource template sets the DHCP resource Start mode and Failover mode to Auto and the Failback Mode to Disable.

    • If the DHCP resource Start mode is set to Auto, the DHCP server automatically loads on a designated server when the cluster is first brought up. If the DHCP Start mode is set to Manual, you can manually start DHCP on a specific server when you want, instead of having it automatically start when servers in the cluster are brought up.

    • If the DHCP Failover mode is set to Auto, the DHCP server automatically moves to the next server in the Assigned Nodes list in the event of a hardware or software failure. If the DHCP Failover mode is set to Manual, you can intervene after a failure occurs and before the DHCP server is started on another node.

    • If the DHCP Failback mode is set to Disable, the DHCP server continues running on the node it has failed to. If the DHCP Failback Mode is set to Auto, the DHCP server automatically moves back to its preferred node when the preferred node is brought back online. Set the DHCP Failback mode to Manual to prevent the DHCP server from moving back to its preferred node when that node is brought back online, until you are ready to allow it to happen.

  2. View or change the DHCP resource Start, Failover, and Failback modes, then click Next and continue with View or Edit DHCP Resource Server Assignments.

View or Edit DHCP Resource Server Assignments

The page to view or change DHCP resource server assignments should now be displayed. The DHCP resource template automatically assigns the DHCP resource to all nodes in the cluster. The order of assignment is the order the nodes appear in the resource list.

To view or edit DHCP resource node assignments or change the server failover order:

  1. From the list of unassigned nodes, select the server you want the resource assigned to, then click the right-arrow button to move the selected server to the Assigned Nodes list.

    Repeat this step for all servers you want assigned to the resource. You can also use the left-arrow button to unassign servers from the resource.

  2. Click the up-arrow and down-arrow buttons to change the failover order of the servers assigned to the resource or volume.

  3. Click Apply or Finish to save node assignment changes.