28.5. DHCPC resource (DHCP Client)

The DHCPC resource can retrieve the IP address when Abilis is used as DHCP Client.

28.5.1. Activating DHCPC resource

Add the resource to the Abilis system; the DHCP resource may already exist in the system, but may not yet be active: set it active with the command s act res:dhcp.

[09:47:27] ABILIS_CPX:a res:dhcpc

COMMAND EXECUTED
[Caution]Caution

After adding or setting the DHCPC active, you must restart the Abilis to make the resource running (use the command warm start to reboot the Abilis).

[09:48:58] ABILIS_CPX:s p dhcpc act:yes

COMMAND EXECUTED

RES:DhcpC - Not Saved (SAVE CONF), Not Refreshed (INIT) -----------------------
       ------------------------------------------------------------------------
Run    DESCR:Dynamic_Host_Configuration_Protocol_Client
       LOG:DS        ACT:YES       msg-len:1472
       cli-udp-locport:68          srv-udp-remport:67          TOS:0-N
       DHCP-SERVER:*               DHCP-SERVER-LIST:#

28.5.2. DHCPC resource parameters

The default parameters suffice to make the resource to work properly.

The most important parameters are:

[10:45:42] ABILIS_CPX:d p dhcpc

RES:DhcpC ---------------------------------------------------------------------
Run    DESCR:Dynamic_Host_Configuration_Protocol_Client
       LOG:DS        ACT:YES       msg-len:1472
       cli-udp-locport:68          srv-udp-remport:67          TOS:0-N
       DHCP-SERVER:*               DHCP-SERVER-LIST:#

[10:51:42] ABILIS_CPX:d p dhcpc ?

DhcpC resource parameter(s):

DESCR:     Resource description [Max. 80 aphanumeric extended characters]
LOG:       State changes log and alarm generation [NO, D, S, A, L, T, ALL] [+E]
           (D: Debug Log; S: System Log; A: Alarm view; L: Local audible alarm;
            T: SNMP traps; +E: Extended Log of state changes, see ref. manual)
ACT:       Operation activation [NO, YES]
msg-len:   Maximum length of DHCP message, actually the UDP payload
           [548..2048]
cli-udp-locport: Client UDP port [68]                               <Read Only>
srv-udp-remport: DHCP Server UDP port [67]                          <Read Only>
TOS:       Type Of Service octet or Differentiated Services Field (DS):
           -' p-t', i.e. PRECEDENCE and TOS values, where 'p' can be [0..7]
            and 't' can be [N=None, D=Min. Delay, T=Max. Throughput, R=Max.
            Reliability, C=Min. Monetary Cost]
           - 'bbbbbb', i.e. DS value bit by bit, where 'b' can be [0, 1]
DHCP-SERVER: DHCP Server IP address [*, 1-126.x.x.x, 127.0.0.1, 128-223.x.x.x]
DHCP-SERVER-LIST: Name of an IP/IR/RU/MR list of DHCP Server IP addresses
           [#, 0..9, a..z, A..Z, _]

Refer to Section 72.24.3, “How to activate the DHCP in client mode” to view a further example of configuration.

28.5.3. Example of configuration

Configure the DHCPC and IP-2 resources so that Abilis retrieves the IP address from the ADSL router. The first step is to activate the DHCPC resource and then optionally configure the DHCP-SERVER parameter:

[16:43:03] ABILIS_CPX:s p dhcpc dhcp-server:192.168.1.254

COMMAND EXECUTED

[16:43:33] ABILIS_CPX:d p dhcpc

RES:DhcpC - Not Saved (SAVE CONF), Not Refreshed (INIT) -----------------------
       ------------------------------------------------------------------------
Run    DESCR:Dynamic_Host_Configuration_Protocol_Client
       LOG:DS        ACT:YES       msg-len:1472
       cli-udp-locport:68          srv-udp-remport:67          TOS:0-N
       DHCP-SERVER:192.168.001.254 DHCP-SERVER-LIST:#

Now IP-2 resource must be configured to use DHCP. Display diagnostics for IP-2 resource helps to view the retrieved IP address:

[16:48:46] ABILIS_CPX:s p ip-2 ipadd:dhcp

COMMAND EXECUTED

[16:48:58] ABILIS_CPX:d p ip-2

RES:Ip-2 - IP over LAN (LAN) --------------------------------------------------
Run    DESCR:WAN
       OPSTATE:UP             LOG:NO                 STATE-DETECT:NORMAL
       LANRES:Eth-2
       IPADD:DHCP    DHCP-GW:YES     DHCP-GW-AD:2       DHCP-DNS:YES
       REDIS:EXT     HIDE:NO         RP:NONE            IPSEC:NO       VRRP:NO
       NAT:INSIDE    UPNP:NO         DIFFSERV:NO        DDNS:NO
       OUTBUF:100    OUTQUEUE:FAIR   MTU:1500           
       OUTSPL:NO     
       INBUF:0                       mru:1500           SRCV:NO
       - TRFA section ---------------------------------------------------------
       TRFA:NO      
       - Lan ------------------------------------------------------------------
       LLOG:NO       arpcache:200    CACHETIMER:120     rxbuf:4     txbuf:14
       VLAN-ID:UNTAG 
RES:Eth-2 ---------------------------------------------------------------------
Run    DESCR:
       LOG:DS            MODE:AUTO         DUPLEX:HALF
       MAC-ADDR:FACTORY (00-E0-4C-20-07-17) 
       dma-rxbuf:250     dma-txbuf:25      max-vlans:0
       ip-rxbuf:25       arp-rxbuf:5       pppoed-rxbuf:5    pppoes-rxbuf:25


[16:49:04] ABILIS_CPX:d d ip-2

RES:Ip-2 - IP over LAN (LAN) --------------------------------------------------
       WAN
       STATE:UP              LINK-STATE:LINKREADY
       CUR-IPADD:192.168.001.100    CUR-MASK:255.255.255.000
       OUTBUF:100   S-OUTBUF:500    CUR-OUTSP:N/A      OUTSP-TOUT:N/A   
       INBUF:0      S-INBUF:0       CUR-INSP:N/A       INSP-TOUT:N/A   
       SPL-OVERHEAD:RAW-IP,ETH
       - Lan ------------------------------------------------------------------
       STATE:LINKREADY       ARP-CACHE-ITEMS:1    

There are three other parameters which can be used to fit the configuration to needs:

DHCP-GW

Retrieve default gateway through DHCP [NO, YES]. Default value is YES.

DHCP-GW-AD

Administrative distance assigned to the default route obtained from a DHCP server [0..255]. Default value is 0.

DHCP-DNS

Retrieve primary and secondary DNS server through DHCP [NO, YES]. Default value is YES.

For example, configure IP-2 resource in the following way to retrieve only IP address and default gateway:

[17:05:54] ABILIS_CPX:s p ip-2 dhcp-gw:yes dhcp-dns:no

COMMAND EXECUTED

[17:07:53] ABILIS_CPX:init res:ip-2

COMMAND EXECUTED

[17:08:15] ABILIS_CPX:d p ip-2

RES:Ip-2 - IP over LAN (LAN) --------------------------------------------------
Run    DESCR:WAN
       OPSTATE:UP             LOG:NO                 STATE-DETECT:NORMAL
       LANRES:Eth-2
       IPADD:DHCP    DHCP-GW:YES     DHCP-GW-AD:2       DHCP-DNS:NO
       REDIS:EXT     HIDE:NO         RP:NONE            IPSEC:NO       VRRP:NO
       NAT:INSIDE    UPNP:NO         DIFFSERV:NO        DDNS:NO
       OUTBUF:100    OUTQUEUE:FAIR   MTU:1500           
       OUTSPL:NO     
       INBUF:0                       mru:1500           SRCV:NO
       - TRFA section ---------------------------------------------------------
       TRFA:NO      
       - Lan ------------------------------------------------------------------
       LLOG:NO       arpcache:200    CACHETIMER:120     rxbuf:4     txbuf:14
       VLAN-ID:UNTAG 
RES:Eth-2 ---------------------------------------------------------------------
Run    DESCR:
       LOG:DS            MODE:AUTO         DUPLEX:HALF
       MAC-ADDR:FACTORY (00-E0-4C-20-07-17) 
       dma-rxbuf:250     dma-txbuf:25      max-vlans:0
       ip-rxbuf:25       arp-rxbuf:5       pppoed-rxbuf:5    pppoes-rxbuf:25

[17:08:18] ABILIS_CPX:d ipr

Destination routes and conditional source routes:
+-+-+-+-+--------------------+--------------------+-----------------+----+---+
|B|P|S|H|     NET:/MASK:     |      MASK: or      |       GW: or    |IP: |AD:|
| | | | |                    |   SRNET:/SRMASK:   |      IPLB:      |    |   |
+-+-+-+-+--------------------+--------------------+-----------------+----+---+
|*|C| |*| 127.000.000.001/32 | 255.255.255.255    |                 |LOOP|  0|
|*|C| | | 192.168.030.001/32 | 255.255.255.255    |                 |R-ID|  0|
|*|C| | | 010.000.000.000/29 | 255.255.255.248    |                 |  12|  0|
|*|C| | | 192.168.000.000/24 | 255.255.255.000    |                 |  11|  0|
|*|C| | | 192.168.001.000/24 | 255.255.255.000    |                 |   2|  0|
|*|S| | | 192.168.008.000/24 | 255.255.255.000    |                 |D 10|  1|
|*|C| | | 192.168.030.000/24 | 255.255.255.000    |                 |   1|  0|
|*|C| | | 000.000.000.000/0  | 000.000.000.000    | 192.168.001.254 |   2|  0|
+-+-+-+-+--------------------+--------------------+-----------------+----+---+

In some cases it's useful to retrieve only IP address:

[17:11:15] ABILIS_CPX:s p ip-2 dhcp-gw:no

COMMAND EXECUTED

[17:20:18] ABILIS_CPX:init res:ip-2

COMMAND EXECUTED

[17:20:29] ABILIS_CPX:d p ip-2

RES:Ip-2 - IP over LAN (LAN) --------------------------------------------------
Run    DESCR:WAN
       OPSTATE:UP             LOG:NO                 STATE-DETECT:NORMAL
       LANRES:Eth-2
       IPADD:DHCP    DHCP-GW:NO     DHCP-GW-AD:2       DHCP-DNS:NO
       REDIS:EXT     HIDE:NO         RP:NONE            IPSEC:NO       VRRP:NO
       NAT:INSIDE    UPNP:NO         DIFFSERV:NO        DDNS:NO
       OUTBUF:100    OUTQUEUE:FAIR   MTU:1500           
       OUTSPL:NO     
       INBUF:0                       mru:1500           SRCV:NO
       - TRFA section ---------------------------------------------------------
       TRFA:NO      
       - Lan ------------------------------------------------------------------
       LLOG:NO       arpcache:200    CACHETIMER:120     rxbuf:4     txbuf:14
       VLAN-ID:UNTAG 
RES:Eth-2 ---------------------------------------------------------------------
Run    DESCR:
       LOG:DS            MODE:AUTO         DUPLEX:HALF
       MAC-ADDR:FACTORY (00-E0-4C-20-07-17) 
       dma-rxbuf:250     dma-txbuf:25      max-vlans:0
       ip-rxbuf:25       arp-rxbuf:5       pppoed-rxbuf:5    pppoes-rxbuf:25

[17:20:33] ABILIS_CPX:d ipr

Destination routes and conditional source routes:
+-+-+-+-+--------------------+--------------------+-----------------+----+---+
|B|P|S|H|     NET:/MASK:     |      MASK: or      |       GW: or    |IP: |AD:|
| | | | |                    |   SRNET:/SRMASK:   |      IPLB:      |    |   |
+-+-+-+-+--------------------+--------------------+-----------------+----+---+
|*|C| |*| 127.000.000.001/32 | 255.255.255.255    |                 |LOOP|  0|
|*|C| | | 192.168.030.001/32 | 255.255.255.255    |                 |R-ID|  0|
|*|C| | | 010.000.000.000/29 | 255.255.255.248    |                 |  12|  0|
|*|C| | | 192.168.000.000/24 | 255.255.255.000    |                 |  11|  0|
|*|C| | | 192.168.001.000/24 | 255.255.255.000    |                 |   2|  0|
|*|S| | | 192.168.008.000/24 | 255.255.255.000    |                 |D 10|  1|
|*|C| | | 192.168.030.000/24 | 255.255.255.000    |                 |   1|  0|
+-+-+-+-+--------------------+--------------------+-----------------+----+---+


[17:20:57] ABILIS_CPX:d d ip-2

RES:Ip-2 - IP over LAN (LAN) --------------------------------------------------
       WAN
       STATE:UP              LINK-STATE:LINKREADY
       CUR-IPADD:192.168.001.100    CUR-MASK:255.255.255.000
       OUTBUF:100   S-OUTBUF:500    CUR-OUTSP:N/A      OUTSP-TOUT:N/A   
       INBUF:0      S-INBUF:0       CUR-INSP:N/A       INSP-TOUT:N/A   
       SPL-OVERHEAD:RAW-IP,ETH
       - Lan ------------------------------------------------------------------
       STATE:LINKREADY       ARP-CACHE-ITEMS:1    

28.5.4. DHCPC diagnostics, statistics and debug

28.5.4.1. DHCPC diagnostics

The following commands are used to display diagnostics:

d d dhcp / d de dhcp

It informs about the STATE of the resource [INACTIVE, READY, DOWN] etc.

[14:27:55] ABILIS_CPX:d d dhcpc

RES:DhcpC ---------------------------------------------------------------------
       Dynamic_Host_Configuration_Protocol_Client                              
       STATE:READY          NUM-CLIENTS:7

28.5.4.2. DHCPC statistics

The following commands are used to display statistics:

d s dhcp / d se dhcp

Shows statistic information, such as the total number of DHCP packets [DISCOVER, REQUEST, DECLINE, RELEASE, OFFER, ACK, NAK, INFORM] etc.

[14:39:25] ABILIS_CPX:d s dhcpc

RES:DhcpC ---------------------------------------------------------------------
       Dynamic_Host_Configuration_Protocol_Client                              
       --- Cleared 1 days 03:18:40 ago, on 01/08/2016 at 11:20:51 -------------
       -----------|---INPUT---|--OUTPUT---|-----------|---INPUT---|--OUTPUT---|
       CHAR       |      10538|      36900|PCK        |         33|        123|
       LONG       |          0|           |BAD-FORMAT |          4|           |
       MARTIAN    |         11|           |UNK-IPP    |          0|           |
       DISCOVER   |           |          5|OFFER      |          7|           |
       REQUEST    |           |        115|ACK        |         26|           |
       DECLINE    |           |          0|NAK        |          0|           |
       RELEASE    |           |          3|INFORM     |           |          0|
       ------------------------------------------------------------------------

28.5.4.3. DHCPC debug

Type the following command to view the commands allowed:

[14:39:31] ABILIS_CPX:debug res:dhcpc

RES:DhcpC ---------------------------------------------------------------------
       Dynamic_Host_Configuration_Protocol_Client                              
       BufferLength:64512  Date/Time:02/08/2016 14:52:56 TraceTime:99118835

Usage:
  LSN:0           - This help
  LSN:1           - Statistics
  LSN:3           - DHCP client log
  LSN:3  CMD:CLR  - Clear DHCP client log
  LSN:4           - IP ports statistics
  LSN:5  CMD:X    - Make REQUEST on IP port, where X - number of IP port
  LSN:6  CMD:X    - Make RELEASE on IP port, where X - number of IP port
[Note]Note

To use these commands you need to have administrator or super user rights.

Type the following command to view the DHCPC log:

[14:20:53] ABILIS_CPX:debug res:dhcpc lsn:3

RES:DhcpC ---------------------------------------------------------------------
       Dynamic_Host_Configuration_Protocol_Client                              
       BufferLength:64512  Date/Time:02/08/2016 14:54:06 TraceTime:99188868

01/08 22:08:26 [  2] Send attempt:8
01/08 22:16:58 [  2] Send REQUEST (renew)
01/08 22:16:58 [  2] Send data remote IP:172.027.027.072
01/08 22:16:58 [  2] Send attempt:9
01/08 22:34:01 [  2] Send REQUEST (renew)
01/08 22:34:01 [  2] Send data remote IP:172.027.027.072
01/08 22:34:01 [  2] Send attempt:10
01/08 23:05:18 [  2] T2 expired. Start REBINDING
01/08 23:05:18 [  2] Send REQUEST (rebind)
01/08 23:05:18 [  2] Send data remote IP:255.255.255.255
01/08 23:05:18 [  2] Send attempt:1
01/08 23:05:18 [  2] State. RENEWING   --> REBINDING 
01/08 23:05:18 [  2] Receive packet. REM-IP: 092.115.254.001
01/08 23:05:18 [  2]                 MAC:    00-1F-9E-D2-CD-C0
01/08 23:05:18 [  2] Receive packet. REM-IP: 092.115.254.001
01/08 23:05:18 [  2]                 MAC:    00-1F-9E-D2-CD-C0
01/08 23:05:18 [  2] Assigned IP:092.115.254.190   Mask:255.255.255.000
01/08 23:05:18 [  2]         GW1:092.115.254.001   DNS1:172.027.137.020
01/08 23:05:18 [  2]         GW2:000.000.000.000   DNS2:172.027.137.010
01/08 23:05:18 [  2]         Lease:10479   T1:5239   T2:9169
01/08 23:05:18 [  2] State. REBINDING  --> BOUND