27.3. DHCP Server Mode

A DHCP server is an Internet host that returns configuration parameters to DHCP clients.

Two steps are required to configure Abilis as DHCP server:

[09:56:36] ABILIS_CPX:s p dhcp mode:server

COMMAND EXECUTED

[09:56:45] ABILIS_CPX:d p dhcp

RES:Dhcp - Not Saved (SAVE CONF), Not Refreshed (INIT) ------------------------
       ------------------------------------------------------------------------
       DESCR:Dynamic_Host_Configuration_Protocol
       LOG:DS           ACT:YES       srvport:67         cliport:68
       msg-len:1472     mode:SERVER   max-clients:300    ICMPCHK:NO
       MAC-FILTER:NO
       WDIR:C:\APP\DHCP\
[Caution]Caution

To activate the changes made on the lowercase parameters a save conf and an Abilis restart are required (i.e. with warm start command).

27.3.1. DHCP Server tables

The configuration of DHCP server mode is based on three tables:

  • DHCP Profiles table: table containing all the parameters to be distributed to clients (i.e. IP Address, Gateway, WINS, DSN, Domain, …);

  • DHCP Subnets: table containing the network IP address of the DHCP subnet, the subnet mask, the pools of addresses to distribute and the “lease” time of the IP addresses;

  • DHCP Hosts: allows to define a static association between a specific MAC-ADDRESS of a client and an IP address.

27.3.1.1. DHCP Profiles table

The DHCP Profiles table can hold up to 129 definitions, indexed from 0 up to 128.

The user can arbitrarily add/delete the definitions from the index 1 to 128. The profile with index 0 can't be deleted because it's a default profile.

Changes made on the table can be activated by executing the initialization command init res:dhcp.

The commands for the DHCP Profiles table management are:

  • d dhcp prof:xxx[,yyy,...] : display DHCP profile;

  • a dhcp prof:xxx [par:val] : add DHCP profile;

  • c dhcp prof:xxx[,yyy,...] :clears DHCP profile;

  • s dhcp prof:xxx[,yyy,...] par:val [par:val]: set DHCP profile parameters.

A complete list of available configuration parameters is available by typing d dhcp prof: ?.

[09:24:57] ABILIS_CPX:d dhcp prof: ?

D DHCP PROF:xxx[,yyy,...]        Display DHCP profile [0..128, A]

DHCP Profile parameter(s):

NAME:      Profile name. From 0 up to 32 ASCII characters.
           Spaces are not allowed. Case is preserved.
TTL:       IP time-to-live [0, 1..255]
KEEPALIVE: TCP keepalive interval [0, 15..65535 sec.]
NB-SCOPE-ID: Netbios scope identifier. From 0 up to 32 ASCII characters.
           Spaces are not allowed. Case is preserved.
NB-NODE-TYPE: Netbios node type [UNK, B, P, M, H]
DOMAIN:    IP domain name. From 0 up to 32 ASCII characters.
           Spaces are not allowed. Case is preserved.
GW1:       First gateway [0.0.0.0, 1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]
GW2:       Second (backup) gateway [0.0.0.0, 1-126.x.x.x, 127.0.0.1,
           128-223.x.x.x]
GW3:       Third (backup) gateway [0.0.0.0, 1-126.x.x.x, 127.0.0.1,
           128-223.x.x.x]
DNS1:      Primary Domain Name server [0.0.0.0, 1-126.x.x.x, 127.0.0.1,
           128-223.x.x.x]
DNS2:      Secondary Domain Name server [0.0.0.0, 1-126.x.x.x, 127.0.0.1,
           128-223.x.x.x]
SMTP:      Simple Mail Transport Protocol (SMTP) server [0.0.0.0,
           1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]
POP3:      Post Office Protocol (POP3) server [0.0.0.0, 1-126.x.x.x,
           127.0.0.1, 128-223.x.x.x]
NNTP:      Network News Transport Protocol (NNTP) server [0.0.0.0,
           1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]
WWW:       World Wide Web (WWW) server [0.0.0.0, 1-126.x.x.x, 127.0.0.1,
           128-223.x.x.x]
FINGER:    Finger server [0.0.0.0, 1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]
IRC:       Internet Relay Chat server [0.0.0.0, 1-126.x.x.x, 127.0.0.1,
           128-223.x.x.x]
NTP:       NTP/SNTP server [0.0.0.0, 1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]
TIME:      TIME server [0.0.0.0, 1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]
WINS1:     First WINS server [0.0.0.0, 1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]
WINS2:     Second WINS server [0.0.0.0, 1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]
TFTP:      TFTP server name. From 0 up to 64 ASCII characters.
           Spaces are not allowed. Case is preserved.
BOOTFILE:  Bootfile name. From 0 up to 128 ASCII characters.
           Spaces are not allowed. Case is preserved.

27.3.1.2. DHCP Subnets table

The DHCP Subnets table can hold up to 128 definitions.

Changes made on the table can be activated by executing the initialization command init res:dhcp.

The commands for the DHCP Subnets table management are:

  • d dhcp lan:xxx[,yyy,...] : display DHCP subnet;

  • a dhcp lan:xxx [par:val] : add DHCP subnet;

  • c dhcp lan:xxx[,yyy,...] :clears DHCP subnet;

  • s dhcp lan:xxx[,yyy,...] par:val [par:val]: set DHCP subnet parameters.

A complete list of available configuration parameters is available by typing d dhcp lan: ?.

[09:27:06] ABILIS_CPX:d dhcp lan: ?

D DHCP LAN:xxx[,yyy,...]         Display DHCP subnet [1..128, A]

DHCP Subnet parameter(s):

NAME:      Subnet name. From 0 up to 32 ASCII characters.
           Spaces are not allowed. Case is preserved.
NET:       Network address in DDN or network address and mask in Slash
           Notation [0.0.0.0, 1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]/[0..32]
MASK:      Network mask in DDN [0.0.0.0, 128.0.0.0-255.255.255.252]
POOL1:     First IP pool. A single IP address [1-126.x.x.x, 128-223.x.x.x]
           or two IP addresses separated by ':' (colon) or "#".
           (E.g.: 150.200.192.192 or 192.168.0.0:192.168.0.100)
POOL2:     Second IP pool. A single IP address [1-126.x.x.x, 128-223.x.x.x]
           or two IP addresses separated by ':' (colon) or "#".
           (E.g.: 150.200.192.192 or 192.168.0.0:192.168.0.100)
POOL3:     Third IP pool. A single IP address [1-126.x.x.x, 128-223.x.x.x]
           or two IP addresses separated by ':' (colon) or "#".
           (E.g.: 150.200.192.192 or 192.168.0.0:192.168.0.100)
POOL4:     Fourth IP pool. A single IP address [1-126.x.x.x, 128-223.x.x.x]
           or two IP addresses separated by ':' (colon) or "#".
           (E.g.: 150.200.192.192 or 192.168.0.0:192.168.0.100)
POOL5:     Fifth IP pool. A single IP address [1-126.x.x.x, 128-223.x.x.x]
           or two IP addresses separated by ':' (colon) or "#".
           (E.g.: 150.200.192.192 or 192.168.0.0:192.168.0.100)
PROF:      Profile [NONE, 1..128]
DEF-LEASE: Default lease time of the IP address [60..1000000 sec.]
MAX-LEASE: Maximum lease time of the IP address [60..1000000 sec.]

27.3.1.3. DHCP Hosts table

The DHCP Hosts table can hold up to 500 definitions, indexed from 1 up to 500.

Changes made on the table can be activated by executing the initialization command init res:dhcp.

The commands for the DHCP Hosts table management are:

  • d dhcp host:xxx[,yyy,...] : display DHCP host;

  • a dhcp host:xxx [par:val] : add DHCP host;

  • c dhcp host:xxx[,yyy,...] :clears DHCP host;

  • s dhcp host:xxx[,yyy,...] par:val [par:val]: set DHCP host parameters.

A complete list of available configuration parameters is available by typing d dhcp host: ?

[09:27:33] ABILIS_CPX:d dhcp host: ?

D DHCP HOST:xx                   Display DHCP host [1..500, A]

DHCP Host parameter(s):

MAC:       MAC address [00-00-00-00-00-01..FF-FF-FF-FF-FF-FF]
IP:        IP address [0.0.0.0, 1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]
PROF:      Profile [LAN, 1..128]
NAME:      Host name. From 0 up to 32 ASCII characters.
           Spaces are not allowed. Case is preserved.

27.3.2. Example of configuration of DHCP in Server mode

In this example the DHCP Server is configured to distribute the following parameters:

  • Network address: 192.168.0.0/24

  • IP pool of addresses: from 192.168.0.131 to 192.168.0.179

  • DNS server 1:192.168.0.232

  • DNS server 2:192.168.0.251

  • Default Gateway: 192.168.0.232

  • WINS server: 192.168.0.50

  • SMTP server: 192.168.0.250

  • POP3 server: 192.168.0.250

  • No static association between MAC-ADDRESS and any leased IP

  • ICMP checking of IP address

  • No MAC Filtering

First, set the dhcp resource active.

[15:20:37] ABILIS_CPX:s p dhcp act:yes mode:server

COMMAND EXECUTED

[15:40:56] ABILIS_CPX:d p dhcp

RES:Dhcp - Not Saved (SAVE CONF), Not Refreshed (INIT) ------------------------
       ------------------------------------------------------------------------
       DESCR:Dynamic_Host_Configuration_Protocol
       LOG:DS           ACT:YES       srvport:67         cliport:68
       msg-len:1472     mode:SERVER   max-clients:300    ICMPCHK:NO
       MAC-FILTER:NO
       WDIR:C:\APP\DHCP\

Configure the DHCP Profiles table.

[15:54:54] ABILIS_CPX:a dhcp prof:1 name:Private_LAN gw1:192.168.0.232 dns1:192.168.0.232 dns2:192.168.0.251 smtp:192.168.0.250 pop3:192.168.0.250 wins1:192.168.0.50

COMMAND EXECUTED

[15:55:11] ABILIS_CPX:d dhcp prof

- Not Saved (SAVE CONF), Not Refreshed (INIT) ---------------------------------

PROF: |NAME:
-------------------------------------------------------------------------------
  0    Default_profile
  1    Private_LAN

[15:55:27] ABILIS_CPX:d dhcp prof:1

- Not Saved (SAVE CONF), Not Refreshed (INIT) ---------------------------------

Parameter:   | Value:
-------------+-----------------------------------------------------------------
PROF:          1
NAME:          Private_Lan
GW1:           192.168.000.232
DNS1:          192.168.000.232
DNS2:          192.168.000.251
SMTP:          192.168.000.250
POP3:          192.168.000.250
WINS1:         192.168.000.050
---------------------------------------------------

Configure the DHCP Subnets table setting the network address, the pool and the identifier of DHCP Profile.

[16:02:17] ABILIS_CPX:a dhcp lan:1 name:Private_Lan net:192.168.0.0/24 pool1:192.168.0.131:192.168.0.179 prof:1

COMMAND EXECUTED

[16:03:22] ABILIS_CPX:d dhcp lan

- Not Saved (SAVE CONF), Not Refreshed (INIT) ---------------------------------

LAN: |NET:            |MASK:
-------------------------------------------------------------------------------
  1   192.168.000.000  255.255.255.000

[16:03:26] ABILIS_CPX:d dhcp lan:1

- Not Saved (SAVE CONF), Not Refreshed (INIT) ---------------------------------

Parameter:   | Value:
-------------+-----------------------------------------------------------------
LAN:           1
NAME:          Private_Lan
NET:           192.168.000.000/24
MASK:          255.255.255.000
POOL1:         192.168.000.131:192.168.000.179
PROF:          1
-------------------------------------------------------------------------------

Configuration of DHCP Hosts table is not required.

Now the configuration is complete.

[Caution]Caution

To initialize the resource, use command init res:dhcp (to set act the changes made on uppercase parameters and in the tables) and save the configuration with save conf command to make the changes permanent.

[Caution]Caution

To set act changes made on lowercase parameters a save conf and an Abilis restart are needed (i.e. with warm start command).

27.3.3. DHCP bindings table

The DHCP bindings table is the memory data base which stores bindings allocated for DHCP clients.

A binding record includes the information about allocated IP address, start time and end time of lease, profile which is currently used by a DHCP client and some other information.

The Table of DHCP bindings is used in server mode only.

[Tip]Tip

Refer to Section 27.3.3.1, “Appendix - how DHCP bindings table works” to have more information about DHCP bindings tables functioning.

Commands for handling DHCP bindings table are:

  • d dhcp bind: it displays DHCP bindings summary;

  • d dhcp binde: it display DHCP bindings detailst;

  • c dhcp bind: this command allows to remove a DHCP binding entry from the DHCP bindings table identified by the specified IP address.

Some examples follow.

[11:34:14] ABILIS_CPX:d dhcp bind

------------------+----------------+------+-----------------+------------------
MAC:              |IP:             |PROF: |Last request(UTC)|Expiry on(UTC)
------------------+----------------+------+-----------------+------------------
A0-F3-C1-C8-5B-0B  192.168.020.050      1  04/06/2015 16:49  07/02/2036 06:28
20-C9-D0-96-05-A1  192.168.020.102      1  09/06/2015 06:30  09/06/2015 16:30
00-19-99-52-CB-A0  192.168.020.104      1  09/06/2015 05:09  09/06/2015 15:09
08-00-27-16-7D-01  192.168.020.107      1  09/06/2015 05:21  09/06/2015 15:21
C4-6E-1F-19-E0-4D  192.168.020.118      1  09/06/2015 07:01  09/06/2015 17:01

[11:34:21] ABILIS_CPX:d dhcp binde

----+-----+-------------------+-----------------+-------+----------------------
 O: | ST: | MAC:              | IP:             | PROF: | Last request(UTC)
                                                        | Expiry on(UTC)
----+-----+-------------------+-----------------+-------+----------------------
  H   ACT   A0-F3-C1-C8-5B-0B   192.168.020.050       1   04/06/2015 16:49:15
                                                          07/02/2036 06:28:15
-------------------------------------------------------------------------------
  P   INV   38-0B-40-C6-82-53   192.168.020.071       1   31/03/2015 13:33:41
                                                          31/03/2015 23:33:41
-------------------------------------------------------------------------------
  P   EXP   00-26-E8-7B-31-7F   192.168.020.100       1   01/06/2015 09:27:07
                                                          01/06/2015 19:27:07
-------------------------------------------------------------------------------
  P   EXP   34-31-11-DF-46-79   192.168.020.101       1   05/06/2015 08:21:55
                                                          05/06/2015 18:21:55
-------------------------------------------------------------------------------
  P   ACT   20-C9-D0-96-05-A1   192.168.020.102       1   09/06/2015 06:30:52
                                                          09/06/2015 16:30:52
-------------------------------------------------------------------------------
  P   EXP   18-20-32-A0-B7-3B   192.168.020.103       1   01/06/2015 09:27:12
                                                          01/06/2015 19:27:12
-------------------------------------------------------------------------------
  P   ACT   00-19-99-52-CB-A0   192.168.020.104       1   09/06/2015 05:09:09
                                                          09/06/2015 15:09:09
-------------------------------------------------------------------------------
  P   EXP   14-7D-C5-3B-CB-16   192.168.020.105       1   25/05/2015 11:42:53
                                                          25/05/2015 21:42:53
-------------------------------------------------------------------------------
  P   EXP   38-0B-40-C6-82-53   192.168.020.106       1   05/06/2015 08:23:37
                                                          05/06/2015 18:23:37
-------------------------------------------------------------------------------
  P   ACT   08-00-27-16-7D-01   192.168.020.107       1   09/06/2015 05:21:24
                                                          09/06/2015 15:21:24
-------------------------------------------------------------------------------
  P   EXP   00-0C-E7-A2-98-E2   192.168.020.108       1   08/06/2015 14:36:38
                                                          09/06/2015 00:36:38
-------------------------------------------------------------------------------
  P   EXP   E4-D5-3D-84-ED-98   192.168.020.109       1   09/04/2015 12:05:28
                                                          09/04/2015 22:05:28
-------------------------------------------------------------------------------
  P   EXP   84-7A-88-B0-1A-A8   192.168.020.110       1   28/05/2015 07:25:08
                                                          28/05/2015 17:25:08
-------------------------------------------------------------------------------
  P   EXP   74-2F-68-76-1E-2B   192.168.020.111       1   21/05/2015 13:33:20
                                                          21/05/2015 23:33:20
-------------------------------------------------------------------------------
  P   EXP   5C-FF-35-2C-12-E2   192.168.020.112       1   21/05/2015 12:49:34
                                                          21/05/2015 22:49:34
-------------------------------------------------------------------------------
  P   REL   C4-6E-1F-19-E0-E2   192.168.020.117       1   08/06/2015 09:04:36
                                                          08/06/2015 09:05:32
-------------------------------------------------------------------------------
  P   ACT   C4-6E-1F-19-E0-4D   192.168.020.118       1   09/06/2015 07:01:23
                                                          09/06/2015 17:01:23
------------------------------------------------------------------------------

Meaning of the most important parameters:

O

Origin of the binding [H: allocated from host tables; P: allocated from IP pools of one of subnets from subnets table; ?: origin unknown].

ST

State of the binding [REL: released; ACT:active, EXP: expired, ABD: abandoned, UNK: unknown (error state)].

MAC

The binded MAC address of the DHCP client.

IP

The IP address assigned to the DHCP client with the MAC address.

PROF

The identifier of DHCP profile from profiles table.

Last request(GMT)

The GMT date and time value when the lease was assigned/renewed the last time.

Expiry on(GMT)

The GMT date and time value when the lease will expire.

Here there are few samples of bindings clear commands:

[15:00:45] ABILIS_CPX:c dhcp bind ip:192.168.0.161

YOU ARE GOING TO DELETE THE SPECIFIED DHCP BINDING ENTRY FROM THE DATA BASE IN MEMORY.
DO YOU WANT TO PROCEES (Y/N)? Y

COMMAND EXECUTED
[15:00:45] ABILIS_CPX:c dhcp bind ip:a

YOU ARE GOING TO DELETE THE WHOLE CONTENT OF THE DHCP BINDINGS DATA BASE IN MEMORY.
DO YOU WANT TO PROCEES (Y/N)? Y

COMMAND EXECUTED

27.3.3.1. Appendix - how DHCP bindings table works

DHCP bindings tables is stored in the DHCP.BND file in the location defined by the WDIR parameter.

It allows storage of up to max-clients bindings, one per each record.

Every one minute the DHCP server checks the bindings table and saves all bindings to the file, if the table was changed since the last time it was updated.

During Abilis CPX DHCP resource start-up, the DHCP driver executes the following operations:

  • if the file DHCP.BND exists:

    • reads the bindings table from the CF;

    • updates the file, making a write operation try;

      • writing attempt successful: the DHCP server goes to the ACTIVE state;

      • writing attempt unsuccessful: the DHCP server goes to the STOP state; it writes a warning message into the System Log (i.e. “W: DHCP STOPPED”) and it doesn't load the bindings DHCP.BND file content.

  • if the file doesn't exist:

    • it tries to create it. If it can't, the server goes to the STOP state and it writes a warning message into the System Log (i.e. “W: DHCP STOPPED”).

After loading the DHCP.BND file, the DHCP server checks the bindings according to the current configuration of the DHCP driver. The records which don't conform to the current configuration will be marked as “not valid” and they will not be used by the DHCP server.

The DHCP server makes the next checks when loading bindings and marks the binding as “invalid” in all the following cases:

  • The subnet record which is corresponding to the IP address from the binding is not found in the subnets table.

  • The profile identifier from the binding is not found in the the profiles table.

If the binding is static (i.e. allocated from the hosts):

  • The host record with the IP and MAC addresses which are corresponding to the IP and MAC addresses from the loading binding is not found in the hosts table.

  • The IP address from the binding is found in one of the pools of the subnet record (i.e. if the corresponding subnet record was found).

if the binding is dynamic (i.e. allocated from the pools):

  • The host record with the IP and MAC addresses which are corresponding to the IP and MAC addresses from the loading binding is found in the hosts table;

  • The IP address from the binding is not found in one of the pools of the subnet record (i.e. if the corresponding subnet record was found).