Lecture 10 - Network Systems
Lecture 10 - Network Systems
MCS 2205
8302
Network Programming
DHCP, DNS
11/13/23 1
DHCP
2
Introduction
3
Definition of DHCP (Dynamic Host Configuration Protocol):
DHCP is a network protocol used to automatically assign and manage IP
addresses, subnet masks, default gateways, DNS servers, and other network
configuration parameters to devices on a network.
It operates on the client-server model, where DHCP servers manage and
allocate IP addresses to clients dynamically.
Purpose and Importance of DHCP:
Simplifies IP address management: DHCP automates the process of IP address
assignment, reducing the manual effort required to configure devices.
Efficient resource utilization: It optimizes IP address usage by dynamically
allocating and deallocating addresses as needed, minimizing IP conflicts.
Centralized configuration: DHCP allows for centralized management of
network configurations, making it easier to update and maintain consistent
settings across the network.
Scalability: DHCP scales well for networks with varying numbers of devices,
providing a flexible solution for networks of different sizes.
Introduction
4
DHCP Workflow:
Client requests an IP address from the DHCP server using DHCPDISCOVER
message.
DHCP server responds with a DHCPOFFER message, proposing an IP
address and other configuration parameters.
Client requests the offered IP address by sending a DHCPREQUEST
message.
DHCP server acknowledges the request with a DHCPACK message,
confirming the IP address lease.
The client uses the leased IP address for a specified duration (lease time), after
which it may request a renewal.
Key Components:
DHCP Server: Manages and assigns IP addresses and configuration
parameters to clients.
DHCP Client: Device requesting an IP address and network configuration
from the DHCP server.
DHCP Relay Agent: Forwards DHCP messages between clients and DHCP
servers in different network segments.
Introduction
5
Advanced Configurations:
Additional configurations like options, classes, and subclasses can be defined
for more granular control over DHCP behavior.
Comments and Syntax:
Use # to add comments in the configuration file for explanatory notes.
Ensure proper syntax and structure adherence to avoid configuration errors.
Example DHCP Configuration
12
Explanation:
Defines a subnet with a range of IP addresses (192.168.1.100 to
192.168.1.200).
Sets the default gateway (router) to 192.168.1.1.
Provides DNS server addresses (Google DNS) to clients for name resolution.
Reserves IP address 192.168.1.50 for a host with a specific MAC address.
Monitoring DHCP Server
13
Monitoring Tools:
systemctl:
Use systemctl to view the status of the DHCP server:
sudo systemctl status isc-dhcp-server displays the server's status,
including whether it's active, its PID, and recent logs.
Log Monitoring:
Monitor the DHCP server logs in real-time using the tail
command:
sudo tail -f /var/log/syslog provides a continuous display of new
entries in the syslog, including DHCP-related events.
Logs Location:
DHCP server logs are typically stored in /var/log/syslog or
/var/log/messages.
DHCP Scope Exhaustion
14
Definition:
DHCP scope exhaustion refers to a situation where a DHCP server has
depleted its available pool of IP addresses to assign to clients within a given
subnet or scope.
Causes:
Inadequate Address Range:
Allocating a limited range of IP addresses for a large number of clients can lead
to exhaustion.
Long Lease Durations:
Extended lease durations can tie up addresses for a long time, limiting
availability for new clients.
Connected Devices:
Rogue DHCP clients – Scope exhaustion attacks
Statically assigned IPs can consume addresses without proper tracking.
DNS
15
Introduction
16
Definition of DNS:
DNS, or Domain Name System, is a hierarchical and distributed
naming system used to translate human-readable domain names into IP
addresses (and vice versa) required for internet communication.
Purpose of DNS:
DNS serves as the phone book of the internet, enabling users to access
websites, send emails, and connect to various online services using
easily memorable domain names instead of complex IP addresses.
How DNS Works:
Clients send DNS queries to DNS servers (recursive resolver,
authoritative, or root) to resolve domain names to IP addresses.
The DNS query follows a series of recursive and iterative steps to find
the correct IP address associated with the given domain name.
DNS Components
17
DNS Hierarchy:
The DNS hierarchy is organized in a tree-like structure, where each
node represents a domain. Domains are organized into levels, including
the top-level domain (TLD), second-level domain, subdomains, and
individual hostnames.
Example: www.example.com consists of the subdomain www, the
second-level domain example, and the top-level domain .com.
Root DNS Servers:
The root DNS servers are a crucial component of the DNS
infrastructure.
There are 13 root DNS servers globally, each represented by a letter (A
through M), and they are maintained by different organizations
worldwide.
These servers are responsible for directing queries to the appropriate
TLD DNS servers based on the top-level domain requested.
DNS Components
18
named.conf:
Navigate to the named.conf.local file usually located at
/etc/bind/named.conf.local.
Define forward and reverse zones for your domains.
Example forward zone configuration: