SUSE Conversations


Automatic network configuration and eDirectory configuration for bootable VMware images



By: jhhut

July 24, 2008 10:11 am

Reads:288

Comments:0

Rating:0

Overview

In many VMware environments, using host-only or nat networking is fine for simple product demonstrations, but other times it would be nice to be able to simulate products (in this case eDirectory) in a ‘realistic’ network environment. You may also want your VMware image, as it boots, to autoconfigure the virtual NIC (if one doesn’t exist), set it to request a DHCP address, then configure your eDirectory instances to bind to the newly acquired ip addresses given by the DHCP server. This document and boot scripts will accomplish both. When configured, the VMware image will create virtual nic’s if necessary, set them to dhcp by default, and then configure eDirectory to listen on the new address. This procedure will also work if you set your VMware image to a static ip. Multiple virtual nics and multiple instances of eDirectory are also supported.

Operating System:
SuSE Linux Enterprise Server 10 SP2 (SLES10SP2)
eDirectory version:
eDirectory 8.8.2 for Linux

Prerequisites

SuSE Linux Enterprise Server 10 SP2 i386 architecture

eDirectory 8.8.2 installation files (archive or iso)

This article assumes a working knowledge of SuSE Linux and eDirectory in general.

Installation and Configuration


SUSE Linux

  1. Install SLES 10 SP2 i386 as a virtual VMware machine. For software pattern installation, select the default installation. You may configure your vm image with one or more virtual network adapters. The network topography can be set to bridged, nat, or host only at this point.


eDirectory
Now that your VMware machine has been built, continue by installing eDirectory.


Installation:

  1. Download eDirectory 8.8.2 iso from download.novell.com
  2. “su” to root (‘su’ in console, enter root password)
  3. Mount the eDirectory installation .iso as /media/cdrom (‘mount -t iso9660 -o loop eDir_882.iso /media/cdrom’)
  4. “cd” into /media/cdrom (this may also be “/media/cdrom/eDirectory/setup”, depending on the eDirectory version) (‘cd /media/cdrom’)
  5. execute ‘./nds-install’. Select options 1 and 2 for full eDirectory installation.

eDirectory installation is now complete. You can now configure your eDirectory tree using the eDirectory utility ‘ndsconfig’.

eDirectory Configuration:

  1. First, you must set your system PATH for the nds binaries/libraries by issuing command ‘. /opt/novell/eDirectory/bin/./ndspath’ in the console. (Note that the command starts with dot-space)
  2. Now configure your eDirectory tree from the command line using ndsconfig; i.e. ‘ndsconfig new -t MYTREE -a cn=admin.o=novell -n o=novell -S myserver -i -e -D /var/opt/novell/instance0 -d /var/opt/novell/instance0/data/dib -w password –config-file /var/opt/novell/nds0.conf’ (The ‘-i’ option ignores duplicate tree lookup, ‘-e’ enables ldap clear-text password.
  3. Once eDirectory configuration is complete, you can verify ndsd is up and running with ‘ndsstat’.

Configure the boot script buildeth0 to generate ifcfg-eth files if they don’t exist.

This step will place a boot script named buildeth0 into /etc/init.d/ that will query for any existing /etc/sysconfig/network/ifcfg-eth-id files and build them as dhcp if necessary.

Download and extract the attached .zip file to get the scripts buildeth0 and setndsconf. Copy them to your vmware image.

  1. As root, log into your SLES 10 VMware image machine.
  2. Copy the script buildeth0 to /etc/init.d/. Be sure to chmod 755 the script so it will execute.
  3. Now, add the script to the default run-levels rc3 and rc5
    1. “chkconfig -a buildeth0”
    2. Go to /etc/init.d/rc3.d/ and verify that the link SXXbuildeth0 is ‘S01buildeth0′. Rename (mv) the link to S01buildeth0 if necessary. Repeat the same process for /etc/init.d/rc5.

If you want to test this script before continuing, here is are the steps. The script will first check /etc/udev/rules.d/30-net_persistent_names.rules for any virtual ‘mac’ addresses assigned by the VMware image booting up. If the script finds any ‘mac’ addresses, it will then check /etc/sysconfig/network/ for any matching ifcfg-eth-id-mac configuration scripts. If none are found, the script will build one that is set to dhcp. If it does find a matching script, it is left alone (for static ip assignments). This script is very nice for appliance-type vm images as you can remove the entries in /etc/udev/rules.d/30-net_persistent_names.rules and any /etc/sysconfig/network/ifcfg-eth-id scripts, then copy the image to some other VMware server. When the image boots, it will automatically set up its dhcp networking for you.

Set up automatic eDirectory configuration

eDirectory generally does not behave well in a dhcp environment. The configuration file nds.conf is usually ‘hard-coded’ to existing static ip addresses, and almost never to the loopback address. Another boot script, setndsconf, will discover any eDirectory instances owned by the root user, parse out their nds.conf files, then sed the nds.conf files with the dhcp (or static) ip addresses before nds starts. Then when eDirectory (ndsd) starts, it will be configured for the dhcp addresses already assigned to the VMware image system.

  1. download and copy the script setndsconf to /etc/init.d/ and chmod it 755.
  2. Add the script setndsconf to default runlevels, ‘(su) chkconfig -a setndsconf’
  3. Verify that the link /etc/init.d/SXXsetndsconf is set to start after S0Xnetwork in /etc/init.d/rc3.d and /etc/init.d/rc5.d (By default, network is S05network, so you will probably have to ‘mv S0Xsetndsconf to S06setndsconf in both rc3.d and rc5.d)

Reboot and test

You should now have boot scripts S01buildeth0 and S06setndsconf in both /etc/init.d/rc3.d and rc5.d. If you want to test to see if the scripts are working (as root)

  1. rm /etc/sysconfig/network/ifcfg-eth-id*
  2. vi /etc/udev/rules.d/30-net_persistent_names.rules and remove any “SUBSYSTEM==”net” entries.
  3. Reboot your VMware image.
  4. When the image reboots, you should see the boot scripts building the ifcfg files and configuring the eDirectory instances.
  5. Log in as root, set the eDirectory path if not set (. /opt/novell/eDirectory/bin/./ndspath), and run “ndsconfig get”. You should see that the eDirectory instance has now been configured for your dhcp address as well as the loopback for the NCP, HTTP, and HTTPS ports you configured when setting up eDirectory.

Conclusion

These two scripts (buildeth0 and setndsconf) make if very easy to build VMware images and move/copy/share them between vmare host systems. (I even use setndsconf on my laptop’s instance of eDirectory for dhcp awareness). You can set up your VMware image with the scripts and eDirectory, remove the ifcfg-eth-id and SUBSYSTEM entries, tar up the VMware image and give it to someone else. All they need to do is untar the image and open the VMware image file on their VMware server, and the network and eDirectory will be set up and in place as the machine boots.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , ,
Categories: SUSE Linux Enterprise Server, Technical Solutions, Virtualization

Disclaimer: As with everything else at SUSE Conversations, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.

Comment

RSS