dhcpd - interact with the NAT32 DHCP daemonSYNOPSIS
dhcpd [ifn [on | off | a | A | s | S | d | D]DHCPD
dhcpd ifn lease n
dhcpd ifn offset n
dhcpd ifn limit n
dhcpd ifn real on | off
dhcpd ifn dns ip
dhcpd ifn gw ip | router1 | router2
dhcpd ifn delete ip
dhcpd ifn reset
dhcpd ifn test
dhcpd ifn ip mac
dhcpd ifn dump [n]
dhcpd ifn Dump
dhcpd ifn list
dstat [ifn [ea]]
The NAT32 DHCP daemon can be used to configure computers on one or more networks. Up to 1024 clients per interface can be configured in this release, but the subnet mask of an interface also limits the maximum number of clients per network. The default configuration settings are:NOTES
The DHCP daemon is started via the NAT32 command start dhcpd (usually in file startup.txt). Once started, the daemon is inactive until a dhcpd ifn A command for interface ifn is issued, followed by a dhcpd ifn on command for interface ifn. Option A is required in order to allow subsequent enabling. Option a disallows enabling and disables the daemon for the specified interface. If ifn is specified as s, the main private interface will be used.
- 7 day lease (604800 sec)
- DNS address is the NAT32 IP address of the interface
- Assigned IP addresses start at the interface's subnet address plus offset and always exclude the subnet address itself, the subnet broadcast address, NAT32's IP address, gateway addresses, and the Windows IP address of the interface.
- The number of assignable IP addresses can be limited to the value specified in limit. The default limit is the lesser of 1024 and the number of addresses per subnet as specified via the subnet mask of the interface.
- Individual IP addresses can be blocked or reserved as specified in file dhcpd.ini.
Option off disables the daemon for the specified interface.
Option S enables a static mode in which only requests for devices with an address reservation will be honored. Option s disables the static mode.
Option D turns on debugging, option d turns off debugging for the specified interface.
Option lease can be used to specify the lease duration (in secs) for a specified interface.
The default NAT32 IP address of a private LAN adapter with a fixed Windows IP address is netid+100.
If the adapter was configured via DHCP under Windows, NAT32's IP address defaults to netid+200.
If the adapter was unconfigured under Windows when NAT32 started, the address 172.16.i.200 is used for the interface, where i is the index of the adapter in the NAT32 wincfg table.
Note that the NAT32 DHCPD honors local DHCP requests from Windows. If this is undesirable (e.g. because some other DHCP server is running on that network), the NAT32 DHCPD should be turned off for that interface.
Option real can be used to specify that a real DNS server address be assigned so that NAT32's DNS Mapping mechanism is not used. Otherwise, the actual DNS address assigned to clients is the current DNS address as printed by the NAT32 setns command.
Option dns can be used to specify a DNS server address that will always be assigned to all clients on the network, irrespective of NAT32's notion of the current DNS address.
Option gw can be used to specify a gateway address that will always be assigned to all clients on the network, irrespective of NAT32's notion of the current gateway address. Alternatively, one of the NAT32 environment variables router1 or router2 can be specified.
Option delete can be used to delete an assigned entry from the DHCPD allocation table. The MAC address of the entry is left unaltered to ensure that the same IP address will be assigned if that client later requests or renews a lease.
Option reset resets the NAT32 DHCPD allocation table for an interface, while option dump prints either the entire table (from offset to limit) or entry n.
Command dhcpd ifn test tests all current allocations for the specified interface. If a client IP no longer has an ARP entry, an ARP request is sent and the DHCPD table entry is deleted if no ARP response is forthcoming. If an interface is down (or not in use), all entries for that interface are deleted.
Command dhcpd ifn list prints details of all current allocations for the specified interface.
Command dhcpd [ifn] prints the current DHCPD settings for either all interfaces or for the specified interface.
Command dstat [ea] converts the specified Ethernet Address to an IP address and name. The Ethernet address is specified in hex-hyphen format. The information is obtained from the ARP caches, the Hosts table and the DHCPD table. If an Ethernet Address is specified, an interface number ifn must also be specified.
The DHCP daemon saves no state information between runs. IP addresses are first assigned in the order the client machines are booted. The first IP address (e.g. 172.16.2.1) is assigned to the first machine to boot, 172.16.2.2 to the second machine to boot and so on. However, on reboot, most DHCP Clients always request the last assigned IP address if the lease for that address has not expired, and NAT32 will assign such preferred addresses whenever possible.
A problem arises if computers with fixed IP addresses exist on the private LAN because the DHCPD will only detect their presence if they are running at the time the DHCPD attempts to assign their address. To prevent this from happening, such fixed IP addresses should be reserved by issuing an appropriatedhcpd ifn ip maccommand for each address to be reserved.
For example, to reserve the IP address 172.16.2.1 for the machine with the MAC address 00-E0-98-18-11-45 on interface 2, the following command should be issued:dhcpd 2 172.16.2.1 00-E0-98-18-11-45
Such commands can be placed in a text file called dhcpd.ini that is executed whenever the DHCPD is started or reset. Never place reset commands in dhcpd.ini as this will cause recursive execution of dhcpd.ini.
If you ever need to replace a particular Ethernet NIC, be sure to update the relevant entry.
To prevent a particular IP address (e.g. 172.16.2.32 on interface 2) from ever being assigned, simply specify its MAC address as 00-00-00-00-00-01.
Whenever an IP address is assigned, released or renewed, the file dhcp.tcl is executed as follows:dhcp.tcl ifn ip mac [name] opwhere ifn is the interface number, ip is the IP address, mac is the Ethernet address, [name] is the host name and op is one of the strings assigned, released or renewed.
The above mechanism can be used to add port mappings when a particular computer is booted, or to remove port mappings when that computer releases its DHCP lease.
The menu item Config, DHCP Server can also be used to interact with the DHCPD.
The DHCPD can also be enabled on interfaces that connect to the Internet via external routers. This option is useful when computers on such networks are to be configured to use NAT32 as their name server and gateway to the Internet. Before enabling the DHCPD on such interfaces, be sure to disable the external router's DHCP server, unless NAT32 is running on powerful hardware, in which case the DHCPD will probably reply to DHCP requests faster than the external router can and thus effectively preempt the external router's DHCP Server.
dhcp, dnsmap, netcfg, nsdetect, setns, start, TCL