A simple mechanism for bootstrapping Windows XP-based MANETs

The DHCP client that ships with Windows XP is lacking a functionality for executing shell commands after configuring a network interface using the Dynamic Host Configuration Protocol, BOOTP protocol, or with statically assigned addresses. Our efforts to extend this functionality for Windows XP is motivated by a need for bootstrapping XP platforms into a Mobile Ad Hoc Network with routing and autoconfiguration utilities.


As mentioned earlier this project was motivate by research in Mobile Ad-Hoc Networks (MANETs) where it is necessary to bootstrap Windows XP machines with routing and autoconfiguration utilities. Typically, these services must be started immediately after a node has setup its network interface an address. And while DHCP was not designed for managing network address allocation in dynamic network environments, it is being used by many network architects for the simple reason that it is included as one of the standard network configuration options in almost every mainstream operating system.

Our initial steps in this area have involved setting up DHCP relay services for providing DHCP functionality across a multihop network, and running OLSR routing services for forwarding other IP unicast and multicast packets. This the problem for which we are providing software here to solve.



Implement missing dhclient-exit-hooks type functionality for the DHCP client in Windows XP, so that routing and dhcrelay applications can be automatically started/restarted after the host's address is acquired or changed. Notification of address updates is acquired in Protolib by catching the FD_ADDRESS_LIST_CHANGE WSA event on a dummy socket.


  • The "background" optional argument will put this in the background.
  • The -mac <mac addr> optional argument will run DhcpMgr on the specified network interface. Expected as a colon-delimited 12-digit hex value
  • The -d optional arg will run NRLOLSR and dhcrelay in the foreground

Preconditions and Assumptions

  • Neither NRLOLSR nor dhcrelay is running when DhcpMgr starts.
  • The Microsoft .NET Framework must be installed (recommend version 1.1) is required because its Process class is used for finding and killing running processes of NRLOLSR and dhcrelay.
  • The current directory must be in your path. (set PATH=.\)

Caveats and FAQs

  • The shell commands (for routing and dhcrelay) which start after the host address changes are hardcoded into this program (for now).
  • IPv6 compatibility is supported, but untested.
  • If you run the program and get the error message "A required dll, MSCOREE.dll can not be found" or "The application failed to initialize properly", then you probably don't have Microsoft's .NET framework installed properly.
  • Sometimes the installer for DhcpMgr is not setting the registry value for IPEnableRouter correctly. You may want to double check it manually.
  • Dhcrelay is hardcoded to run on Cygwin's eth0, but it may not matter. I It may broadcast out every interface. This is untested.

Security Notice

The DhcpMgr package is using dhcrelay from ISC's DHCP distribution version 3.0.1rc11. It can be downloaded with the patch necessary for compiling it for XP via Cygwin from here. There are newer versions of dhcrelay available from ISC, but we have thus far been unable to get those to compile in XP.

Note, there are known vulnerabilities associated with the DHCP 3.0.1rc11 distribution that may or may not affect the dhcrelay application.

Compile Option

/I "..\common" /I "..\win32" /I "..\protolib\common" /I \
"..\protolib\win32" /D "_DEBUG" /D "PROTO_DEBUG" /D "HAVE_IPV6" \
/D "HAVE_ASSERT" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FD /EHsc \
/MDd /GS /Yc"StdAfx.h" /Fp".\Debug\DhcpMgr.pch" /Fo".\Debug/" \
/Fd".\Debug/" /W3 /nologo /c /clr

The "/clr" option is important. That includes the .NET framework (also known as the Common Language Runtime framework).

Install Options

An automatic installer has been built with the "Advanced Installer Freeware" package. Running the bin/DhcpMgr.msi file will automatically install this software on a Windows XP box. Or, you can install it manually by copying all the other files in bin/ to your target install directory. Then simply run the DhcpMgr executable with your desired options (for example, DhcpMgr.exe -d).

If you are installing manually, you will need to enable packet forwarding by setting the following option in the XP registry (you can use the regedit application to set this):


IpEnableRouter = 1

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet003\Services\Tcpip\Parameters, IPEnableRouter=1

Uninstall Options

If you installed using the DhcpMgr.msi file, then just go through the "Add Remove Programs" utility in the Control Panel. The one side affect to this is that it removes the IPEnableRoute parameter that was set in the Registry. So, be sure to manually add that back (with value of 0).

If you installed manually, just remove the files and reset your IPEnableRoute registry parameter back to 0.



Development Status

DHCP Exit Hooks for Windows XP is no longer under development, is not supported, and is online purely for archival purposes.