Dynamic Host Configuration Protocol

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

DYNAMIC HOST CONFIGURATION

PROTOCOL
PhD. Alcides Montoya Canola, Est. Carlos Andres Ballesteros
Universidad Nacional de Colombia - sede Medellin

Abstract
This guide will develop the procedure that will allow you to practice
the knowledge acquired in the theoretical class of server management.
The topic to be developed is DHCP.

1 Introduction
The purpose of the Dynamic Host Configuration Protocol (DHCP) is to assign
network settings centrally (from a server) rather than configuring them locally
on every workstation. A host configured to use DHCP does not have control over
its own static address. It is enabled to configure itself completely and automat-
ically according to directions from the server. If you use the NetworkManager
on the client side, you do not need to configure the client. This is useful if you
have changing environments and only one interface active at a time. Never use
NetworkManager on a machine that runs a DHCP server.[1].

Figure 1: DHCP Server.

1
2 DHCP lease process
A DHCP-enabled client obtains a grant for an IP address from a DHCP server.
This concept is like a lease for a certain time, once the contract expires there
is a period of grace in which the DHCP server waits for a new renewal of the
contract. contract, This protects the lease of clients in case the client and the
server are in different time zones, the internal clocks of the client and server
computers. they are not synchronized, or the client is out of the network when
the lease expires.

DHCP servers and DHCP clients communicate through a series of DHCP


messages. To obtain a grant, the DHCP client initiates a conversation with a
DHCP server using a series of these DHCP messages.

Figure 2: DHCP lease process.

• DHCPDiscover: Transmission by a DHCP client when you try to con-


nect to the network for the first time. The DHCPDiscover message re-
quests IP address information from a DHCP server.
• DHCPOffer: It is broadcast for each DHCP server that receives the
DHCPDiscover message from the client and has an IP address configura-
tion to offer the client. The DHCPOffer message contains an unpublished
IP address and additional TCP / IP configuration information, such as
the subnet mask and the default gateway. More than one DHCP server
can respond with a DHCPOffer message. The client accepts the best of-
fer, which for a Windows DHCP client is the first DHCPOffer message it
receives.
• DHCPRequest: Transmitted by a DHCP client after selecting a DHCPOf-
fer. The DHCPRequest message contains the IP address of the DHCPOf-
fer that you selected. If the customer is renewing or re-linking to a previous
lease, this package can be unicast directly to the server.
• DHCPAck: Transmitted by a DHCP server to a DHCP client recognizing
the DHCPRequest message. At this time, the server also forwards any

2
option. Upon receiving the DHCPAck, the customer can use the leased IP
address to participate in the TCP / IP network and complete the system
startup. This message is usually transmitted, because the DHCP client
does not officially have an IP address that it can use at this time. If
the DHCPAck responds to a DHCPInform, then the message is unicast
directly to the host that sent the DHCPInform message.
• DHCPNack: Transmission by a DHCP server to a DHCP client that
denies the client’s DHCPRequest message. This can occur if the requested
address is incorrect because the client moved to a new subnet or because
the DHCP client lease has expired and can not be renewed.
• DHCPDecline:Transmit from a DHCP client to a DHCP server, inform-
ing the server that the offered IP address is rejected because it seems to
be in use by another computer.

• DHCPRelease:Sent by a DHCP client to a DHCP server, waiving an IP


address and canceling the remaining lease. This is unicast to the server
that provided the lease.
• DHCPInform:Sent from a DHCP client to a DHCP server, requesting
only additional local configuration parameters; The client already has an
IP address configured.

3 DHCP service
A DHCP server supplies not only the IP address and the netmask, but also the
host name, domain name, gateway, and name server addresses for the client to
use. In addition to that, DHCP allows several parameters to be configured in
a centralized way, for example, a time server from which clients may poll the
current time or even a print server. RFC 2132 [2]

4 Development of Practice
The development of the practice will take place in the distribution of Open Suse
Leap 15, it is clear that this practice can be extended to other distributions
taking into account their respective changes.

4.1 Necessary logical equipment.


we must install the dhcp server, if it is already installed then we must update
it, also we must install the graphical configuration mode with yast, to do this
we write the following commands in the console.
Execute the following to install the protocol:

Execute the following to install the service:

3
Execute the following to configuration in graphic mode with yast :

4.2 Start service and add the service to the system boot.
dhcp is a service that must be started once it has been configured. And it must
be stopped when some new configuration is going to be done, to do this execute
the following commands.

Execute the following to start the service for the first time:

Execute the following to restart the service:

Execute the following to stop the service:

4.3 Necessary modifications in the firewall.


Clients in all subnets need to be able to communicate with the server. To define
the interfaces that the DHCP server should listen to, adjust the firewall accord-
ingly, for this we execute the following commands.

Execute the following to configure the firewall:

Run the following to reload the firewall:

4
4.4 Files and configuration directories.
• /etc/dhcpd.conf: in this file the network parameters that the dhcp
server should follow are configured.
• /etc/sysconfig/dhcpd:file is used to pass arguments to the dhcpd dae-
mon at boot time.

While the file is being modified, stop the service.

Modify this file as shown below:

Locate Listen a slightly different configuration for an internal subnet:

• The line option domain-name defines the default domain of your network.
• With the entry option domain-name-servers, specify up to three values for
the DNS servers used to resolve IP addresses into host names and vice
versa. Ideally, configure a name server on your machine or somewhere else
in your network before setting up DHCP. That name server should also
define a host name for each dynamic address and vice versa. To learn how
to configure your own name server.
• The line option broadcast-address defines the broadcast address the re-
questing client should use.
• With option routers, set where the server should send data packets that
cannot be delivered to a host on the local network (according to the source
and target host address and the subnet mask provided). Usually, espe-
cially in smaller networks, this router is identical to the Internet gateway.
option subnet-mask, specify the netmask assigned to clients. first one
defines how many seconds an IP address is leased to a requesting client

5
by default (default-lease-time) before it should apply for renewal. section
also includes a statement of the maximum period for which a machine
may keep an IP address assigned by the DHCP server without applying
for renewal (max-lease-time).

locate the following and modify it according to your needs

To identify a client configured with a static address, dhcpd uses the hardware
address (which is a global unique fixed numeric code consisting of six pairs of
octets) for the identification of all network devices (for example, 00: 30: 6E:
08: EC: 80). If the respective lines, as shown above, the DHCP daemon always
assigns the same data set to the corresponding client. The name of the respective
client (host HOSTNAME, here fantasy) is entered in the first line and the MAC
address in the second.

4.4.1 Some Useful Commands.


ip link show: shows the ip of the network card

5 Exercise
Install and configure a DHCP server, as shown throughout the development of
the practice, mount a network and try it, also configure another server using
yast.

References
[1] DHCP/openSUSE Leap 15.0”, doc.opensuse.org 2018
[2] How-does-DHCP-work/quora”, www.quora.com 2018

You might also like