DHCP in Embedded Linux
Embedded devices act as computers within computers. They are fully self-contained devices that can perform services for machines which connect to them. The portability of the Linux kernel makes it a common operating system for these devices, but there is an additional challenge for designers of embedded Linux devices that connect to a network: how to ensure that its Dynamic Host Configuration Protocol (DHCP) client will always connect to a host without user input.
-
Embedded Linux
-
From a software perspective, there is nothing dramatically different between a Linux system running on a desktop computer and a Linux system running on an embedded device. The basic kernel is the same, but it only includes those modules which are necessary for the embedded device's hardware components and the components with which the device connects. Developers also have to design the hardware which runs on top of the Linux kernel in the embedded device to run without any direct user input.
DHCP Function
-
DHCP manages the assignment of IP addresses through a "lease" system: a DHCP client program requests to "lease" an available IP address from the DHCP server. The client then assigns an IP address to a particular device, be it a computer or an embedded device, for a particular amount of time. The device then tries to use that IP address when connecting to the DHCP server until its expiration, and the DHCP server doesn't assign that IP address to any other device until the lease expires.
-
Getting an Address
-
The challenge confronting embedded systems designers is that if a device powers up when it is not directly connected to a DHCP server, it may not get an IP address from the server. A Linux user on a desktop can refresh the connection manually when the computer is connected to a server, but embedded systems do not have this option. Linux embedded system designers solve this problem by adding code to check if the device's DHCP client has secured an active IP lease and connection. If this check shows that DHCP does not have an active connection, it sends the DHCP client the command to try again. This loop continues until it secures an active connection.
Backup
-
Embedded systems have to have internal backup mechanisms to automatically solve connection issues that users can normally resolve through a device interface. One such backup mechanism for embedded systems using Linux is to have a static IP address the device can use if it has an active connection to a DHCP server, but cannot obtain a regular IP address lease. Configuring embedded Linux in this way ensures that the device can perform its Internet-related functions even if it encounters leasing errors with its DHCP server.
-
References
- Photo Credit Photos.com/Photos.com/Getty Images