dhcpd - interact with the NAT32 DHCP daemonSYNOPSIS
dhcpd list | [ifn [on | off | a | A | s | S | d | D]]DHCPD
dhcpd ifn List
dhcpd ifn lease sec
dhcpd ifn range [start [end]]
dhcpd ifn offset [n]
dhcpd ifn limit [n]
dhcpd ifn max [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 [gw] [dns]
dhcpd ifn ip mac [check] [block] [name] [pihole]
dhcpd ifn dump [n]
dhcpd ifn list [n]
dhcpd ifn client [n]
dhcpd ifn Dump
dhcpd ifn populate
dhcpd ifn bind # From STDIN
dstat [ifn] [ea]
The NAT32 DHCP daemon can be used to configure computers on one or more networks, including the Windows computer itself. 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.
- Whenever possible, an address requested by a client will be honoured, even if it violates the subnet plus offset condition described above.
- The range of IP addresses assigned can be specified with the range command. Arguments start and end specify the first and the last host numbers to be assigned.
- The number of assignable IP addresses can be limited to the value specified in max. The default number is the lesser of 1024 and the number of hosts 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 usually equals the Windows IP address.
If the adapter was unconfigured under Windows when NAT32 started, the user will be prompted to supply an IP address and Mask for the interface.
Note that the NAT32 DHCPD honors local DHCP requests from the Windows TCP/IP stack. 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. Option Dump prints the table from 0 to limit.
Option populate first populates the ARP table by executing an arping command. It subsequently adds resolved bindings to the DHCPD allocation table. This mechanism can be used to ensure that machines retain their IP address if NAT32 needs to be restarted.
Option bind reads IP to MAC bindings from STDIN. Each binding has the format 0 22.214.171.124 00-00-00-00-00-00, although excess input is ignored. The input format is compatible to the Dump command output format, therefore the command can be used to restore bindings that were saved with Dump during a previous invocation of NAT32.dhcpd p Dump > dhcpd.logIt is strongly advised that this mechanism be used to ensure that machines retain their IP address if NAT32 needs to be restarted.
dhcpd p bind < dhcpd.log
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 ifn displays assignments for a given ifn.
Command dstat ifn ea converts the specified Ethernet Address on ifn 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.
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 01-00-00-00-00-01.
Whenever an IP address is assigned, released or renewed, and if the variable dhcpd_log is true, 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.
The DHCPD may report a special server IP address to clients of the form x.x.x.232 so that subsequent DHCP renewals will work correctly when originated by the local Windows TCP/IP stack. This address can be modified if needed by editing the "Special Address" line in the relevant ifnx.ini file.
The command dhcpd ifn ip [gw] [dns] can be used to override the gateway address and DNS server address assigned to a specific machine. This feature is particularly useful for debugging. The target machine must of course renew its DHCP lease for the new settings to take effect.
dhcpc, dnsmap, ipcfg, netcfg, nsdetect, pihole, set, setns, start, TCL