dropdown menu

DHCP (Dynamic Host Configuration Protocol)

DHCP (Dynamic Host Configuration Protocol) 

DHCP allows to get an IP address and other network parameters, like gateway, DNS server IP, subnet mask etc. (It is a client - server setup.)

The DHCP facility assigns an IP address for a specified period of time known as a lease, using the following process:
- The requesting (client) system broadcasts a DHCP Discover message to UDP port 67. At this point, the system does not need to know anything about the local network, not even the subnet mask (the source address for this message is, and the destination is

- One or more DHCP servers reply with a DHCP Offer message (to UDP port 68), containing an IP address, subnet mask, server IP address, and lease duration (and possibly other parameters). The server reserves the offered address until it is accepted or rejected by the requesting client or a timeout period expires.

- The client selects an offered IP address and broadcasts a DHCP Request message. All servers other than the successful one release the pending reservation.

- The selected server sends a DHCP Acknowledge message to the client.

- When the lease is 50% expired, the client attempts to renew it (via another DHCP Request). If it cannot do so at that time, it will try when it reaches 87.5% of the lease period; if the second renewal attempt also fails, the client looks for a new server. During the lease period, DHCP-assigned parameters persist across boots on most systems. On some systems, the client tries to extend its lease each time it boots.

dhcpcd: dhcp client daemon
dhcprd: dhcp relay agent daemon (usually routers are configured to pass the dhcp requests/replies to different networks and or subnets, so dhcprd is not used)
dhcpsd: dhcp server daemon

The DHCP client daemon is dhcpcd. The daemon runs on port 68..
The DHCP client configuration file is /etc/dhcpcd.ini

/etc/options.file       <--contains dhcp option definitions

In /etc/rc.tcpip:
# Start up dhcpcd daemon
start /usr/sbin/dhcpcd "$src_running"

# lssrc -ls dhcpcd
LogFileName:     /usr/tmp/dhcpcd.log
Logging:         ENABLED
Tracing:         NOT ACTIVE
Interface        IP Address     Duration  Start     End
en0      3600       1527666340 1527669940
Subsystem         Group            PID          Status
 dhcpcd           tcpip            3538946      active

more details:



The DHCP client configuration file is /etc/dhcpcd.ini
It contains the configuration information for the DHCP client program (dhcpcd).

Common DHCP Options:
1  Netmask
3  Default gateway
6  Nameserver
12 DHCP Client hostname
15 Domain name

119 is the search domain suffix list, but AIX does not support this :(

syntax used in this file:
option <code value> -- An option requested by the client (if it is inside the curly braces, it is valid for the mentioned interface only, if outside then applies to all interfaces)
reject <code>       -- Specifies that if this option code is returned by the server, this option should be ignored by the client. Its value should not be used.

After dhcpcd.ini is configured, the dhcp client daemon (dhcpcd) should be started, which will read this file during start up:
# startsrc -s dhcpcd


dhcp and resolv.conf

an example from dhcpcd.ini:
interface en0
option 12 "my-aix-hostname"

If using above setting, dhcp will update resolv.conf with domain and nameserver details. Additionally hostname will be set (to FQDN: my-aix-hostname.example.domain), also gateway will be configured and netmask as well. Only the search list will not inserted into resolv.conf, that would be option 119 in dhcpcd.ini, but IBM does not support that.

Some additional details regarding search vs domain entry in resolv.conf:
The domain entry and search entry are mutually exclusive. If both entries are used, the one that appears last will override the other. The search entry can have up to a maximum of 1024 characater strings for the DomainName variable. The first DomainName variable is interpreted as the default domain name.


example from /etc/dhcpcd.ini:

updateDNS "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' A NONIM >> /tmp/updns.out 2>&1 "      <--it requestes to update the DNS server with the new IP address
clientid MAC                                             <-- client id to use in all communication with server
                                                         (MAC: MAC address, HOSTNAME: host name should be used as client id)

interface en0                                            <--interface for DHCP (I have seen "any" as well)
option 1                                   <--specified netmask is requested/accepted
reject 3                                                 <-- Do not accept the default gateway
reject 6                                                 <-- Do not accept the nameserver
reject 15                                                <-- Do not accept the domain name
otheroptions accept                                      <-- Specifies how all other options should be handled (default is all accepted)
                                                         (it refers to any options not specifically mentioned)


our new config:
interface en0
option 12 "my-hostname"


our older configs:
interface en0
option 12 "my-hostname"                              <--this line will register server in DNS
option 15 "our.example.domain.com"
option 19 0
option 20 0

In this older config, hostname will looks like: my-hostname.our.example.domain.com, which is hardcoded, and if we migrate server to another domain, it will still have that wrong FQDN locally.



Shree said...

1. AIX use DHCP to get IP address instead of statically entering IP’s on server...?
2. The process could be enabled to allow interfaces to get IP’s from DHCP service?

Anonymous said...

lol, you serious?

aix said...

I am happy that someone is still reading this blog :-)