This HOW-TO of the is a supplement to the Rembo Server's documentation, The Rembo Wizard plug-in module's documentation and to the Internet Software Consortium's documentation for the DHCP 3.0 software. The example Rembo Server platform below is RedHat Linux 7.1 server. Configuration procedure has following objectives:
In the following procedure DHCP server will be installed on the same RedHat 7.1 Linux machine that is already hosting a Rembo Server. Apart few exceptions, the procedure is know to be the same with SuSE 7.2 Linux and with Sun/Solaris 7/8/9 systems. Differences are explained below where applicable.
- Verify that the dhcpd is _not_ installed:
ls -l /etc/init.d/dhcpd ls -l /usr/sbin/dhcpd
- If installed, uninstall from the RPMs (you can use rpm(8) if you like instead of graphical interface)
export DISPLAY=yourworkstation:0 /usr/bin/kpackage * Find dhcp-package * Uninstall the server from the RPM
In below example, the source code distribution of ISC <revision> DHCP server is placed in the shared NFS-directory /csadmin/common/install/rembo/dist/. (Not at the ESRF? Obtain your copy from DHCP home page).
cd /usr/local tar xvzf /csadmin/common/install/rembo/dhcpd/dhcp-<revision>.tar.gz - or Solaris: - gzcat /csadmin/common/install/rembo/dhcpd/dhcp-<revision>.tar.gz | tar xvf - - no gcc on Solaris? install it first - gcc cd /csadmin/common/sw/install ./cswinstall gcc cd dhcp-<revision> ./configure make make install make clean touch /var/state/dhcp/dhcpd.leases - or Solaris: - touch /etc/dhcpd.leases - do you want to remove gcc from Solaris? cd /csadmin/common/sw/install ./cswremove gcc
The System V init() startup script is OS-dependent, with .sh extension. In below example, the example script is placed in the shared NFS-directory /csadmin/common/install/rembo/dhcpd/. An example of dhcpd.sh for RedHat Linux 7.1 server is available in Appendices.
cd /etc/init.d cp /csadmin/common/install/rembo/dhcpd/initd.<your_os>/dhcpd.sh .
- Compile on the target system a program that allows any user to call the above /etc/init.d/dhcpd.sh with supervisor's privileges. For example (the dhcpd.c referred below is in the Appendices),
cd /tmp cc -o dhcpd /csadmin/common/install/rembo/dhcpd/initd/dhcpd.c mv dhcpd /etc/init.d/dhcpd chmod +s /etc/init.d/dhcpd
- non-root users should be able to edit dhcpd.conf, create a directory for it (In below example, the example configuration file is placed in the shared NFS-directory /csadmin/common/install/rembo/dhcpd. An example of dhcpd.conf is available in Appendices. In the example, group comp is for the installation personnel):
mkdir -p /etc/dhcpdir/RCS chmod -R 775 /etc/dhcpdir chown -R <you> /etc/dhcpdir chgrp -R comp /etc/dhcpdir cp /csadmin/common/install/rembo/dhcpd/dhcpd.conf_example /etc/dhcpdir/dhcpd.conf chmod 664 /etc/dhcpdir/dhcpd.conf chown <you> /etc/dhcpdir/dhcpd.conf chgrp comp /etc/dhcpdir/dhcpd.conf
On an other window, login as <you> and modify the DHCP configuration to correspond your needs.
cd /etc/dhcpdir ci -l dhcpd.conf ........ do some heavy editing on /etc/dhcpdir/dhcpd.conf ....... * add a network definition for all networks in your system *
- On the root user's window, check that your modifications do not contain errors
/usr/sbin/dhcpd -d -cf /etc/dhcpdir/dhcpd.conf 2>&1 | less *Common Error* "Can't bind to dhcp address, Address already in use" *Reason* Remboserver is running and is programmed for DHCPProxy: *Resolve* Add to rembo.conf: DisableDHCPProxy BootNoMulticastDiscovery
- (use ctrl-C with to kill the above process if no errors were reported)
- Satisfied? Back in the <you> window, save your work
ci -u dhdpc.conf (and to get it out next time, use "co -l dhcpd.conf")
- Check that the startup works, again, being <you>, say
/etc/init.d/dhcpd start /etc/init.d/dhcpd stop /etc/init.d/dhcpd debug - stop with CTRL-C - /etc/init.d/dhcpd start /etc/init.d/dhcpd restart
cd /etc/rc.d/rc3.d - or Solaris:- cd /etc/rc3.d ln -s ../init.d/dhcpd.sh S64dhcpd ln -s ../init.d/dhcpd.sh K64dhcpd - RedHat Linux only: - cd /etc/rc.d/rc5.d ln -s ../init.d/dhcpd.sh S64dhcpd ln -s ../init.d/dhcpd.sh K64dhcpd
#!/bin/sh # # dhcpd This shell script takes care of starting and stopping # dhcpd. # # chkconfig: - 65 35 # description: dhcpd provide access to Dynamic Host Control Protocol. # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -f /usr/sbin/dhcpd ] || exit 0 [ -f /etc/dhcpdir/dhcpd.conf ] || exit 0 [ -f /var/state/dhcp/dhcpd.leases ] || exit 0 RETVAL=0 prog="dhcpd" start() { # Start daemons. echo -n $"Starting $prog: " daemon /usr/sbin/dhcpd -cf /etc/dhcpdir/dhcpd.conf RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd return $RETVAL } stop() { # Stop daemons. echo -n $"Shutting down $prog: " killproc dhcpd RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcpd return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/dhcpd ]; then stop start RETVAL=$? fi ;; status) status dhcpd RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL
# dhcpd.conf ESRF DHCP configuration file 3.0 # Modified: $Date: 2001/11/28 08:53:13 $ # ------------------------------------------------------------------------------ # You may want to have two windows open on this system, # - one with your own account, one with root priviledges # 1) The actual location of this file is $Source: /etc/dhcpdir/dhcpd.conf$ # - move into that directory # 2) Check out the file for modifications "co -l dhcpd.conf" # 3) Once modified you may want to stop the dhcpd services # "/etc/init.d/dhcp stop # 4) Check your files against syntax errors by starting dhcpd services with # /usr/sbin/dhcpd -d # (stop with Ctrl-C) # 5) Save the modified file, check it in "ci -u dhcpd.conf" # Please give a meaningful comment. # 6) run "/etc/initd.d/dhcpd restart" # (suid executable that run /etc/initd./dhcpd.sh restart) # 7) At the end of script: Verify that the dhcpd process actually do start # ------------------------------------------------------------------------------ # ============================= PXE OPTION SPACE =============================== # Definition of PXE-specific options where the services required by # the PXE client are answered by the DHCP proxy of the PXE server. # Rembo server, for example may be located on a different machine than this # DHCP server. The client is as per Intel's PXE 2.1 specification and the # byte ordering is for the Intel processor architecture. option space PXE; # Option descriptions and the default values for the ESRF will follow: # ------------------------------------------------------------------------------ # multicast ip address : multicast address of boot file # # size 4 option PXE.mtftp_ip code 1 = ip-address; # ------------------------------------------------------------------------------ # discovery control : find bootserver using .. multicast = 1 # broadcast = 2 # use list = 7 option PXE.discovery_control code 6 = unsigned integer 8; # ------------------------------------------------------------------------------ # discovery multicast address : Multicast capable Boot Servers listening on this # option PXE.discovery_mcast_addr code 7 = array of unsigned integer 8; # ------------------------------------------------------------------------------ # boot servers : List of Boot Servers # { type MSB, type LSB, IPcnt, IP-addr-list, # type MSB ... } # - if more boot servers to be listed, redefine # the structure by adding type MSB, # type LSB and so on. option PXE.boot_servers code 8 = array of unsigned integer 8; # ------------------------------------------------------------------------------ # boot menu : Boot possibilities: # { type MSB, type LSB, desclen, "text", type MSB ... } # - if more items to be listed, redefine the structure # by adding type MSB, type LSB and so on. # - to find out the decimal text format, say ex.: # echo MyMenuText | od -t u1 # option PXE.boot_menu code 9 = array of unsigned integer 8; # ------------------------------------------------------------------------------ # menu prompt : What to display: { timeout, "prompt" } # option PXE.menu_prompt code 10 = { unsigned integer 8, text }; # ---------------------- PXE REMBO BOOT CLIENT CLASSES ------------------------- # Create a generic class for PXE clients who wants to boot from the ESRF # Rembo server(s): # - Use unicast to connect to the server # - Boot Server type = 15 # - Rembo Server #1 = example.myprivate.domain (192.168.1.1) # - Boot menu is currently: # (1) "Rembo Server" (default, type 15) # (2) "PXE/BootP Server" (if not defined in boot_servers, then local, type 0) class "pxeremboclient_example" { match hardware; option vendor-class-identifier "PXEClient"; vendor-option-space PXE; option PXE.discovery_control 7; option PXE.discovery_mcast_addr 0,0,0,0; option PXE.boot_servers 0,15,1,10,0,0,1; option PXE.boot_menu 0,15,12, 82,101,109,98,111,32,83,101,114,118,101,114, 0,0,9, 80,88,69,47,66,111,111,116,80; option PXE.menu_prompt 3 "EXAMPLE responded: Boot from a Rembo Server: EXAMPLE (F8=menu)"; } # Following is the list of all Rembo clients, selected by the first broadcast # packet's hardware information fields. # - The format is <ARP-hardware type><hardware address>, for Ethernet # 1:<MAC-address> # subclass "pxeremboclient_example" 1:00:02:b3:1a:5f:16; # node1 # ============================= DHCP OPTION SPACE ============================== # option definitions common to all hosts # server-identifier example.myprivate.domain; server-name "example"; option domain-name "myprivate.domain"; option domain-name-servers 192.168.1.1; option subnet-mask 255.255.255.0; # make sure Windows clients work fine # Hybrid node - WINS first. Then broadcast # for WINS servers see on each sub network # lease time = 3 hours default-lease-time 10800; max-lease-time 10800; deny unknown-clients; use-host-decl-names on; # from 3.0b2pl11 - No DDNS registration ddns-update-style none;
# ---------------------------- GROUP DEFINITIONS ------------------------------- # group { host node1 { # if the DHCP server is on a different machine than the Rembo Server, # declare in the following two lines the Rembo Server's name # server-identifier myremboserv.mydomain.org; # server-name "myremboserv"; hardware ethernet 00:02:b3:1a:5f:16; fixed-address 192.168.1.1; option host-name "pctest"; } } # ------------------------- SUBNET DEFINITIONS ------------------------------- # # Private networks that the DHCP should listen # subnet 192.168.1.0 netmask 255.255.255.0 { option broadcast-address 192.168.1.255; } # # Public networks that the DHCP should listen # subnet 123.123.123.0 netmask 255.255.255.0 { option routers 123.123.123.99; option broadcast-address 12.123.123.255; } # end of dhcpd.conf
/* This is a wrapper program to execute dhcpd.sh script */ #include <sys/wait.h> int main(int narg, char *argv[]) { char command[128]; char buff[80]; int i,rc; strcpy(command,"/etc/init.d/dhcpd.sh "); strcat(command,argv[1]); /* get stdin and stdout, stderr OK */ setuid(0); rc=system(command); if ( WIFEXITED(rc) != 0 ) { return(WEXITSTATUS(rc)); } else { return(0); } }
18 Nov 2002