The DHCPC resource can retrieve the IP address when Abilis is used as DHCP Client.
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 | |
---|---|
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:#
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:#
The most important parameters are:
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].
srv-udp-remport
DHCP Server UDP port [67].
TOS
TOS or DS field:
p-t: PRECEDENCE-TOS, 'p' [0..7], 't' [N, D, T, R, C];
bbbbbb: DS value bit by bit, 'b' [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 80.24.3, “How to activate the DHCP in client mode” to view a further 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
Tip | |
---|---|
Interesting chapters: |
This command reports the current situation of the DHCPC resource:
[14:27:55] ABILIS_CPX:d d dhcpc
RES:DhcpC ---------------------------------------------------------------------
Dynamic_Host_Configuration_Protocol_Client
STATE:READY NUM-CLIENTS:7
The meaning:
STATE
Current DHCP client state:
DOWN
- State set when registration
to lower UDP port fail, better said when the "use" of UDP
service is not possible.
INACTIVE
- The driver is "ready" to
work (no errors with UDP service), but inactive
(configuration parameter
ACT
:NO
).
READY
- The driver is fully ready
to work.
NUM-CLIENTS
Number of available clients. Corresponds to the number of configured IP resources.
This command can help to understand what is happening, in case of troubles:
[14:39:25] ABILIS_CPX:d s dhcpc
RES:DhcpC ---------------------------------------------------------------------
Dynamic_Host_Configuration_Protocol_Client
--- Cleared 4 days 07:02:23 ago, on 28/09/2017 at 01:15:38 -------------
-----------|---INPUT---|--OUTPUT---|-----------|---INPUT---|--OUTPUT---|
CHAR | 26930| 155700|PCK | 83| 519|
LONG | 0| |BAD-FORMAT | 0| |
MARTIAN | 35| |DENIED-SRV | 0| |
DISCOVER | | 8|OFFER | 2| |
REQUEST | | 511|ACK | 81| |
DECLINE | | 0|NAK | 0| |
RELEASE | | 0|INFORM | | 0|
------------------------------------------------------------------------
With reference to the shown interval of time («Cleared 4 days 07:02:23 ago») these counters, about Server mode, show the number of:
CHAR | Incoming/outgoing characters from/to UDP. |
PCK | Incoming/outgoing packets from/to UDP. |
LONG | Dropped incoming too long packets. |
BAD-FORMAT | Dropped incoming packets with bad format. |
MARTIAN | Incoming responses for unknown request. |
DENIED-SRV | Increased when the server response is discarded because it does not satisfy IPSRC/IPSRCLIST setting. |
DISCOVER | Outgoing DHCPDISCOVER packets. |
OFFER | Incoming DHCPOFFER packets. |
REQUEST | Outgoing DHCPREQUEST packets. |
ACK | Incoming DHCPACK packets. |
DECLINE | Outgoing DHCPDECLINE packets. |
NAK | Incoming DHCPNAK packets. |
RELEASE | Outgoing DHCPRELEASE packets. |
INFORM | Outgoing DHCPINFORM packets. |
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 | |
---|---|
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