Configuring a CYGWIN DHCP Server for Windows
A target board can use the Dynamic Host Configuration Protocol (DHCP) to obtain its network configuration from the host system. DHCP software serves much the same purpose as the older BOOTP software, and includes the BOOTP functionality as a subset.
Using DHCP requires that your host system be configured as a DHCP server. Most Windows systems include a DHCP client, which allows the Windows workstation to receive IP address assignments from a DHCP server (for example, in the corporate network). To provide addresses to a target system, you must add a DHCP server to the Windows system. No configuration changes are made to the existing DHCP client in this process.
Do not confuse the DHCP server daemon, dhcpd, with the DHCP client daemon, dhcpcd. This document describes how to configure the server daemon; no changes are necessary for the client daemon.
Note
You must use the Cygwin-based DHCP server that is provided with Cygwin. Windows DHCP servers cannot be configured to host a target system in this way.
- The DHCP FAQ is available at: http://www.dhcp-handbook.com/dhcp_faq.html
- The DHCP-HOWTO is available at: http://www.tldp.org/HOWTO/DHCP/
To configure the DHCP daemon, use the following general procedure:
- Update the file dhcpd.conf, as described in Updating a DHCP Configuration File.
- Set the IP address to the one used in dhcpd.conf.
- Create the file dhcpd.leases.
- Add dhcpd as a Windows service and restart it, as described in Restarting Required Services on Windows.
Setting the IP Address
Configure your network connections to make sure that the IP addresses referenced by dhcpd.conf are the same ones that will be used by the DHCP server.
You will need to have a local area connection enabled, associated with the TCP/IP protocol. If these options do not appear when you follow the instructions in this section, ask your Windows system administrator for assistance.
To configure your network connections:
- Choose Start > Control Panel (or Start > Settings > Control Panel), and then select Network Connections (or Network and Dial-Up Connections, depending on the version of Windows that you are using).
- Right-click on Local Area Connection and select Properties. The following screen appears:
- Select Internet Protocol (TCP/IP) and click the Properties button. Enter the IP address that you will use for your host system, as shown in the following figure:
The eth1 Ethernet port on your host machine is now associated with the specified IP address. When DHCP is started on the host, it will send the information in the configuration file to that port. DHCP will be turned off automatically, so that your computer will not try to obtain an IP address from its local network.
Remember that the IP address parameter must match the server-name value, if any, used in the dhcpd.conf file.
Creating the dhcpd.leases File
In addition to configuring the DHCP server, you also must create the dhcpd.leases file, which the server references. If the file /var/spool/dhcp/dhcpd.leases does not exist on your system, create it. For example, use the touch command as follows:
$ touch /var/spool/dhcp/dhcpd.leases
This command creates the file if it does not exist, and updates the timestamp if it does exist. No settings are needed in the dhcpd.leases file; it just has to exist.
Note
The dhcpd.leases file and the /var/spool/dhcp directory must have read/write permissions set for all users. Generally the touch command is sufficient; however, this depends on how your host machine is configured. If necessary, use the chmod command to change permissions, as in the following example:
$ chmod a+rw \ /var/spool/dhcp/dhcpd.leases /var/spool/dhcp
Restart the Service
Finally, add dhcpd as a Windows service and restart it, as described in Restarting Required Services on Windows.