You are on page 1of 8

Republic of the Philippines

NUEVA VIZCAYA STATE UNIVERSITY


Bayombong, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: SAM101-1st-SY2020-2021

College: COLLEGE OF INDUSTRIAL TECHNOLOGY


Campus: Bambang

DEGREE PROGRAM BSInTe COURSE NO. SAM101


SPECIALIZATION Networking COURSE TITLE System Administration and Maintenance
YEAR LEVEL IV TIME FRAME 10hrs. WK NO. 5-6 IM NO. 6

I. UNIT TITLE/CHAPTER TITLE


Dynamic host Configuration Service
Network Time Service

II. LESSON TITLE / (OUTLINE)


I. Dynamic host Configuration Service
1. DHCP Overview
2. DORA Process
3. DHCP Components
II. Network Time Service
1. NTP Overview
2. NTP Servers
3. NTP Client

III. LESSON OVERVIEW


This section reviews the hierarchy of DHCP as well as NTP. You will understand how the
BOOTP and DHCP processes work, as well as the steps for incorporating DHCP service into a
camp. It is important to understand how to configure DHCP and NTP servers to run these
services, as well as how to configure clients to connect appropriately to those services. This
should be understood from both a theory standpoint and a hands-on one. In addition, testing,
troubleshooting, and performance baselining are all important aspects of network services.

In this lesson, we will explore how to install and configure DHCP and NTP Servers. By
mastering these skills and concepts, you will gain another level of experience on your way to
being a network engineer.

IV. DESIRED LEARNING OUTCOMES


The students should be able to:
• discuss the use of DHCP Service;
• create a DHCP Service
• Configure a NTP Server and NTP Client;

V. LESSON CONTENT
DYNAMIC HOST CONFIGURATION PROTOCOL
DHCP is the Dynamic Host Configuration Protocol. It sends IP information to clients automatically,
making configuration of IP addresses on the network easier and automated. This protocol uses a four-
step process known as DORA when disseminating IP addresses, and it employs ports 67 and 68.

Dynamic Host Configuration Protocol (DHCP) allows properly configured client computers to
obtain IP addresses automatically from a DHCP server. This is done so that a network administrator does
not have to manually configure IP addresses on all the computers on a network individually. The DHCP
server takes care of this task quickly and automatically. This protocol therefore reduces the amount of
system administration, allowing devices to be added to the network with little or no manual intervention.
The IP information obtained might include the following:
• IP addresses • DNS server addresses
• Subnet masks • Other advanced options
• Gateway addresses

NVSU-FR-ICD-05-00 (081220) Page 1 of 8


“In accordance with section 185. Fair use of copyrighted works of Republic Act 8293, the copyrighted works included in this material may be reproduced for educational purposes
only and not for commercial distribution.”
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bayombong, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: SAM101-1st-SY2020-2021

The primary reason DHCP is needed is to simplify the management of IP addresses on networks.
No two hosts can have the same IP address, and configuring them manually will likely lead to errors.
Even on small networks manually assigning IP addresses can be confusing, particularly with mobile
devices that require IP addresses on a non-permanent basis. Also, most users aren’t technically proficient
enough to locate the IP address information on a computer and assign it. Automating this process makes
life easier for users and the network administrator.

When a new computer is configured to use DHCP and then attached to the network, it contacts
the DHCP server. The DHCP server leases an IP address to that new computer via DHCP. The length
of a lease is set on the DHCP server by a network administrator.

For example, a lease given to a desktop computer might be from several days to several weeks,
because the computer is permanently attached to the network.

In addition to the IP address, DHCP also assigns the subnet mask, default gateway address,
domain name server (DNS) address and other pertinent configuration parameters. Request for comments
(RFC) 2131 and 2132 define DHCP as an Internet Engineering Task Force (IETF)- defined standard
based on the BOOTP protocol.

To accommodate IPv6, DHCPv6 is available for installation on modern server operating systems,
such as Windows Server 2008 and Server 2008 R2. Network administrators can combine DHCP (for
IPv4) and DHCPv6 to integrate both kinds of communications on a network. IPv6 uses either stateful or
stateless autoconfiguration. Stateful autoconfiguration means that a host’s IPv6 address is obtained
through DHCPv6 and a DHCPv6 server, such as Windows Server 2008 R2 configured in the role of a
DHCPv6 server. In stateless autoconfiguration, the network host assigns its own IP address without
obtaining it from a DHCPv6 server.

How a DHCP Server Assigns IP Addresses


Static IP addresses are manually assigned by the network administrator, whereas dynamic IP
addresses are automatically assigned by a DHCP server each time a computer connects to the network.
Because it’s unmanageable to keep up with static IP address assignments, most network administrators
choose to use dynamic IP addressing. If a computer configured to use DHCP first connects to the network
and is unable to lease an IPv4 address from the DHCP server, it uses an Automatic Private IP Addressing
(APIPA) address in the address range 169.254.0.1 through 169.254.255.254.

Components of DHCP
According to networkworld.com, When working with DHCP, it’s important to understand all of the
components. Below is a list of them and what they do:

• DHCP server: A networked device running the DCHP service that holds IP addresses and related
configuration information. This is most typically a server or a router but could be anything that
acts as a host, such as an SD-WAN appliance.
• DHCP client: The endpoint that receives configuration information from a DHCP server. This can
be a computer, mobile device, IoT endpoint or anything else that requires connectivity to the
network. Most are configured to receive DHCP information by default.
• IP address pool: The range of addresses that are available to DHCP clients. Addresses are
typically handed out sequentially from lowest to highest.
• Subnet: IP networks can be partitioned into segments known as subnets. Subnets help keep
networks manageable.
• Lease: The length of time for which a DHCP client holds the IP address information. When a lease
expires, the client must renew it.
• DHCP relay: A router or host that listens for client messages being broadcast on that network and
then forwards them to a configured server. The server then sends responses back to the relay
agent that passes them along to the client. This can be used to centralize DHCP servers instead
of having a server on each subnet.

NVSU-FR-ICD-05-00 (081220) Page 2 of 8


“In accordance with section 185. Fair use of copyrighted works of Republic Act 8293, the copyrighted works included in this material may be reproduced for educational purposes
only and not for commercial distribution.”
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bayombong, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: SAM101-1st-SY2020-2021

Benefits of DHCP servers


According to networkworld.com, In addition to simplified management, the use of a DHCP server
provides other benefits. These include:

• Accurate IP configuration: The IP address configuration parameters must be exact and when
dealing with inputs such as “192.168.159.3”, it’s easy to make a mistake. Typographical errors
are typically very difficult to troubleshoot and the use of a DHCP server minimizes that risk.
• Reduced IP address conflicts: Each connected device must have an IP address. However, each
address can only be used once and a duplicate address will result in a conflict where one or both
of the devices cannot be connected. This can happen when addresses are assigned manually,
particularly when there are a large number of endpoints that only connect periodically, such as
mobile devices. The use of DHCP ensures that each address is only used once.
• Automation of IP address administration: Without DHCP, network administrators would need to
assign and revoke addresses manually. Keeping track of which device has what address can be
an exercise in futility as it’s nearly impossible to understand when devices require access to the
network and when they leave. DHCP allows this to be automated and centralized so network
professionals can manage all locations from a single location.
• Efficient change management: The use of DHCP makes it very simple to change addresses,
scopes or endpoints. For example, an organization may want to change its IP addressing scheme
from one range to another. The DHCP server is configured with the new information and the
information will be propagated to the new endpoints. Similarly, if a network device is upgraded
and replaced, no network configuration is required.

DHCP poses security risks


• The DHCP protocol requires no authentication so any client can join a network quickly. Because
of this, it opens up a number of security risks, including unauthorized servers handing out bad
information to clients, unauthorized clients being given IP addresses and IP address depletion
from unauthorized or malicious clients.
• Since the client has no way of validating the authenticity of a DHCP server, rouge ones can be
used to provide incorrect network information. This can cause denial-of-service attacks or man-
in-the-middle attacks where a fake server intercepts data that can be used for malicious purposes.
Conversely, because the DHCP server has no way of authenticating a client, it will hand out IP
address information to any device that makes a request. A threat actor could configure a client
to continually change its credentials and quickly exhaust all available IP addresses in the scope,
preventing company endpoints from accessing the network.
• The DHCP specification does addresses some of these issues. There is a Relay Agent
Information Option that enables engineers to tag DHCP messages as they arrive on the network.
This tag can be used to control access to the network. There is also a provision to authenticate
DHCP messages, but key management can be complicated and has held back adoption. The use
of 802.1x authentication, otherwise known as network access control (NAC), can be used to
secure DHCP. Most of the leading network vendors support NAC, and it has become significantly
simpler to deploy.

Source: https://www.networkworld.com/article/3299438/dhcp-defined-and-how-it-works.html

What is DORA Process in DHCP?


DORA is a process which is used by DHCP in order to provide an IP address to hosts or client
machine. The DORA process has four messages.
• Discover
• Offer
• Request
• Acknowledgment

Now, take a look at the below diagram. This diagram will show you how the client and server
exchange these messages.

NVSU-FR-ICD-05-00 (081220) Page 3 of 8


“In accordance with section 185. Fair use of copyrighted works of Republic Act 8293, the copyrighted works included in this material may be reproduced for educational purposes
only and not for commercial distribution.”
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bayombong, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: SAM101-1st-SY2020-2021

DHCP DORA Process


Now, we will take a look at exactly what happens when DHCP client requests an IP address
from DHCP Server. There are some messages which are exchanged between the DHCP Server and
Client. These messages are explained below.
Keypoint: All DHCP Messages are broadcast at Network Layer (i.e Layer 3).

DHCP Discover Message – The Dora First Message


Discover Message is the first message of the DORA process. In this message, the DHCP client
wants to discover a DHCP Server and hence sends a DHCP Discover message. Different fields of
Discover message are :
Source IP: 0.0.0.0
Destination IP: 255.255.255.255
Source MAC: DHCP Client Machine MAC Address
Destination MAC: FF:FF:FF:FF:FF:FF
Hence, we can say that the DHCP Discover message always broadcast at the network and data
link layer.

DHCP Offer Message – The Dora Second Message


As soon as DHCP Server receives Client Discover message, the DHCP server reply to DHCP
client as an offer message.
Source IP: DHCP Server IP Address
Destination IP: 255.255.255.255
Source MAC: DHCP Server Machine MAC Address
Destination MAC: DHCP client MAC Address

Now, as you can see, still the Destination IP address in the DHCP Offer Message header has a
broadcast IP address. This is because the client didn’t get an IP address from DHCP Server. But, this
time, this message is broadcast at Network Layer only.

DHCP Request Message – The Dora Third Message


Now, the DHCP client machine receives the DHCP Offer message and replies with a DHCP
request message. This message basically tells the DHCP server that I’m fine with this IP address.
Please allocate this IP address to me. The DHCP Request Message header has the following main
fields:
Source IP: 0.0.0.0
Destination IP: 255.255.255.255
Source MAC: DHCP Client Machine MAC Address
Destination MAC: DHCP Server MAC Address

Now, as you can see, still Client Source IP address is 0.0.0.0. This is because the client still
didn’t get an IP address from DHCP Server. Also, this message has broadcast only at the network layer
of the OSI Model.

NVSU-FR-ICD-05-00 (081220) Page 4 of 8


“In accordance with section 185. Fair use of copyrighted works of Republic Act 8293, the copyrighted works included in this material may be reproduced for educational purposes
only and not for commercial distribution.”
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bayombong, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: SAM101-1st-SY2020-2021

DHCP Acknowledge Message – The Dora Fourth Message


DHCP acknowledge message is the last message of the DORA process. It is sent by the DHCP
Server to DHCP Client. This message is a reply to the DHCP Request message. This message header
has the following main fields:
Source IP: DHCP Server IP Address
Destination IP: 255.255.255.255
Source MAC: DHCP Server Machine MAC Address
Destination MAC: DHCP client MAC Address

After this message, the DHCP client will get an IP address. This message has broadcast at the
network layer but unicast on the Data Link layer.

Source: https://www.gns3network.com/what-is-dora-process-in-dhcp/

B. NTP Server
NTP server can be configured by WinBox in menu System - NTP Server or in command line
system/ntp/server. NTP server service is not included in default set of packages so it needs to be
ownloaded and installed manually with ntp.npk package. ntp.npk package is NOT required to provide
router with sNTP client as this is already built into system package!

If package is successfully installed then it can be simply enabled with Manycast support.
/system ntp server
set broadcast=no enabled=yes manycast=yes multicast=no

Local NTP servers need to be synchronized from Stratum 1 or Stratum 2 public servers. Pick
some from public list.
/system ntp client
set enabled=yes primary-ntp=1.2.3.4 secondary-ntp=5.6.7.8

Benefits:
Router doesn't need direct access to internet and public NTP servers. Allow control of a primary
source of clock for your router on only two main routers (primary and secondary) It can reduce traffic
and the load of some public NTP servers by local time caching.

RouterOS supports the setting of two servers for NTP client, primary and secondary. It's better to
setup and use two servers for redundancy if it is feasible. NTP servers should be located in independent
locations with high availability near main gateways.

NTP Client
Now the local NTP servers can be configured on every router in the local network:

/system ntp client


set enabled=yes primary-ntp=192.168.0.1 secondary-ntp=192.168.1.1
Also you should set the correct time zone according to your location on every router.
/system clock
set time-zone-name=CET

Source: https://wiki.mikrotik.com/wiki/Setup_local_NTP_servers

VI. LEARNING ACTIVITIES


MikroTik DHCP Server configuration
Generally, every MikroTik router has a built-in DHCP service. So, if you have a MikroTik router
and you want to enable a DHCP server in your network with MikroTik router to reduce your administrator
task, keep reading the rest of this article where I will show you how to configure a DHCP server in your
MikroTik router.

NVSU-FR-ICD-05-00 (081220) Page 5 of 8


“In accordance with section 185. Fair use of copyrighted works of Republic Act 8293, the copyrighted works included in this material may be reproduced for educational purposes
only and not for commercial distribution.”
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bayombong, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: SAM101-1st-SY2020-2021

Before going to start configuring a DHCP server in MikroTik router, I will show you a basic network
diagram where a MikroTik router is working as a DHCP server as well as it is working as a network
gateway. I hope, your network is almost same like the below network diagram and you want to enable a
DHCP server in your MikroTik router.

In the above network diagram, the first interface (ether1 port) of MikroTik router is connected to
an ISP for accessing internet and this interface is known as WAN port. All the LAN users are connected
to second interface (ether2 port) of MikroTik router through a network switch. We will now enable DHCP
server in this second interface so that all the LAN users will get network information (IP, Subnet mask,
Gateway and DNS) dynamically from this DHCP server to access internet. But before enabling DHCP
server in MikroTik router, you have to complete MikroTik router basic configuration. Basic configuration
includes WAN and LAN IP assigning, Gateway IP assigning, DNS configuration and NAT rule creation.
If you are a new MikroTik user, please spend some time to study my previous article about MikroTik
Router Basic Configuration using Winbox and complete the basic configuration of your MikroTik router
and then follow my below steps to enable DHCP server in your MikroTik router.

1. Go to IP > DHCP Server menu from your winbox. DHCP Server window will appear.
2. In DHCP Server window, click on DHCP Setup button and choose the interface (in this article:
ether2) in which you want to setup DHCP server from DHCP Server Interface drop-down menu
and then click on Next button.
3. Now put your LAN network block in DHCP Address Space input box and click Next button. DHCP
client/LAN user will get IP from this network.
4. Choose gateway address for the given network in Gateway for DHCP Network input box and then
click Next button.
5. Provide IP range from which your DHCP client/LAN user will get IP in Address to Give Out input
box and click Next button.
6. Provide preferred DNS server IP and click Next button.
7. Now provide IP lease time and click Next button. Default lease time is 3 days.
8. DHCP setup is complete now and a successful message will be shown.
9. Now connect any IP device (Desktop, Laptop, Smartphone etc.) to your network. Automatically
an IP will be allocated for that device from your MikroTik DHCP server. Click Leases tab and
observe IP lease status of that DHCP client.
If you follow the above steps carefully, your MikroTik router will turn into a DHCP server and your
LAN users will now be able to obtain IP information from your MikroTik DHCP server. However, if you
face any problem to enable DHCP server in your MikroTik router, watch my below video about DHCP
Server configuration in MikroTik Router. I hope, it will help you to configure your MikroTik DHCP server
successfully.
Source: https://systemzone.net/dhcp-server-configuration-in-mikrotik-router/
Video: https://www.youtube.com/watch?v=05mIZWxthXs

NVSU-FR-ICD-05-00 (081220) Page 6 of 8


“In accordance with section 185. Fair use of copyrighted works of Republic Act 8293, the copyrighted works included in this material may be reproduced for educational purposes
only and not for commercial distribution.”
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bayombong, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: SAM101-1st-SY2020-2021

B. System Time and the NTP Protocol


NTP Client Setup
Having the system time set accurately is important for many purposes, especially logging and
troubleshooting. Since RouterBOARDs do not have an onboard battery to keep the clock running, setting
up the NTP client should be a part of your standard configuration.

The function of the NTP client is to query an NTP server and get the current time and then set
the local clock. The actual displayed time on the RouterBOARD system will be dependent on the local
time setting on the device.

Example – Setting Up the NTP Client


The NTP client is part of the default packages so there is no package that needs to be added,
simply select System and NTP Client. To have the device query a public Internet time server, set the
NTP Client to Enabled, select the Mode as “unicast” and set the Primary NTP Server to a DNS resolvable
name or IP address. I suggest “us.pool.ntp.org” for U.S. based systems. Adding a secondary NTP server
is optional and you can consider one like time.windows.com. Using us.pool.ntp.org and simply
pool.ntp.org will typically yield two different NTP servers. Once the router is connected to the Internet,
the DNS server will resolve the DNS name and then these NTP servers will be queried for the current
date and time.

System Clock
Setting up the NTP client will not ensure the local clock is accurate for local time so you must
set your time zone on the Clock setting to ensure your clock information is meaningful.

Advanced NTP Server Setup


This process is not needed for a basic setup. If you do not want to use an Internet based time
server, or if you simply want to run your own, that is possible by adding the NTP Server optional package
found in the package NTP. See Chapter 3 for instructions on Package Management. Once the NTP
package has been added and the router rebooted, the NTP server can be configured.

NVSU-FR-ICD-05-00 (081220) Page 7 of 8


“In accordance with section 185. Fair use of copyrighted works of Republic Act 8293, the copyrighted works included in this material may be reproduced for educational purposes
only and not for commercial distribution.”
Republic of the Philippines
NUEVA VIZCAYA STATE UNIVERSITY
Bayombong, Nueva Vizcaya
INSTRUCTIONAL MODULE
IM No.: SAM101-1st-SY2020-2021

Example – Enabling NTP Server


1. Download the “optional packages” zip file from mikrotik.com.
2. Unzip the package on your desktop.
3. Drag the NTP package into the files window.
4. Reboot the router. Once the router reboots, click the System button and then NTP

Server and enable the NTP server for the protocol of your choice(s). Typically checking “enabled” is
the only setting required. Other routers in your network will now be able to access this router as their NTP
server.

VII. EVALUATION (Note: Not to be included in the student’s copy of the IM)

VIII. ASSIGNMENT

IX. REFERENCES

Discher, S. R. W. (2011). RouterOS by example: understanding MikroTik RouterOS through real life
applications. MicroTik.

Installing Mikrotik RouterOS under VirtualBox. Abi Paudel's.


http://abiadonis.blogspot.com/2014/11/installing-mikrotik-routeros-under.html.

Admin, P. by, & says:, V. (2020, October 2). DORA Process in DHCP - Explained in detail. GNS3
Network. https://www.gns3network.com/what-is-dora-process-in-dhcp/.
Kerravala, Z. (2018, August 21). DHCP defined and how it works. Network World.
https://www.networkworld.com/article/3299438/dhcp-defined-and-how-it-works.html.
Manual:IP/DHCP Server. Manual:IP/DHCP Server - MikroTik Wiki.
https://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Server.
Sayeed, A. (2020, January 4). DHCP Server configuration in MikroTik Router. System Zone.
https://systemzone.net/dhcp-server-configuration-in-mikrotik-router/.
Setup local NTP servers. Setup local NTP servers - MikroTik Wiki.
https://wiki.mikrotik.com/wiki/Setup_local_NTP_servers.

NVSU-FR-ICD-05-00 (081220) Page 8 of 8


“In accordance with section 185. Fair use of copyrighted works of Republic Act 8293, the copyrighted works included in this material may be reproduced for educational purposes
only and not for commercial distribution.”

You might also like