How unit 5 is examined
This unit covers DHCP (leases, scopes, allocation, configuration, clients) and Linux server case studies; no topic was asked in recent papers, so learn each definition and its key points.
DHCP Introduction
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>DHCP (Dynamic Host Configuration Protocol) automatically gives each host on a network its IP address, subnet mask, default gateway and DNS server.</mark>
Key points.
- DHCP works on a client-server model over UDP, with the server on port 67 and the client on port 68.
- The exchange has four steps, DORA: Discover, Offer, Request, Acknowledge.
- It removes manual configuration, so it avoids typing errors and duplicate IP addresses.
- On Linux the server daemon is
dhcpd, configured in/etc/dhcp/dhcpd.conf.
DHCP Leased Time
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>A lease is the fixed period for which a DHCP server lets a client use an assigned IP address.</mark>
Key points.
- The lease time is set on the server with
default-lease-timeandmax-lease-time, both in seconds. - At 50% of the lease the client tries to renew (T1), and at 87.5% it tries to rebind with any server (T2).
- If the lease expires unrenewed, the address returns to the pool and can be given to another client.
- Short leases suit networks with many roaming clients, and long leases suit stable networks.
DHCP Scopes
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>A scope is the range of IP addresses, with its subnet mask and options, that a DHCP server may lease to clients on one subnet.</mark>
Key points.
- Each subnet needs its own scope, declared in
dhcpd.confas asubnet ... netmask ... { range ...; }block. - A scope also carries options such as router, DNS servers and lease time.
- Addresses that are fixed, such as servers and printers, are excluded from the range or reserved.
- A scope is the administrative unit for planning capacity, so its size must exceed the number of clients.
DHCP IP Address
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>DHCP IP assignment is the process by which the server picks a free address from the scope and binds it to a client's MAC address for a lease.</mark>
Key points.
- The server records each binding (IP, MAC, lease end) in the lease file
dhcpd.leases. - Before offering, the server checks that the address is unused, so conflicts are avoided.
- A client that had an address earlier normally gets the same one again on renewal.
- Along with the address, the server sends the mask, gateway and DNS server as options.
Allocation Types
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>DHCP allocates addresses in three ways: dynamic, automatic and manual (static) allocation.</mark>
Key points.
- Dynamic allocation leases an address for a limited time, and the address is reused after expiry.
- Automatic allocation assigns a free address permanently, with no expiry.
- Manual allocation gives a fixed address chosen by the administrator and tied to the client's MAC address.
- Dynamic suits ordinary clients, and manual suits servers and printers that need a stable address.
Planning DHCP Deployment
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>Planning a DHCP deployment means deciding the number of servers, the scopes, the lease times and the fault-tolerance before installing the service.</mark>
Key points.
- First count the subnets and clients, then size each scope with spare addresses.
- Decide which hosts need static addresses and exclude them from the dynamic range.
- Choose lease times by client behaviour, and place a DHCP relay agent where a subnet has no server.
- Use two servers with split scopes so that one failure does not stop address assignment.
DHCP Configuration files
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>The main DHCP server configuration file is /etc/dhcp/dhcpd.conf (older systems: /etc/dhcpd.conf), which holds global options, subnets and host entries.</mark>
Key points.
- Global lines such as
default-lease-time 600;andoption domain-name-servers 8.8.8.8;apply to all subnets. - A subnet block defines the range and router:
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
}
- A
hostblock withhardware ethernetandfixed-addressreserves an address for one MAC. - Active leases are stored in
/var/lib/dhcpd/dhcpd.leases.
Automatic Startup of DHCP Server
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>Automatic startup makes the dhcpd service start by itself at every boot, without the administrator starting it.</mark>
Key points.
- On systemd systems,
systemctl enable dhcpdsets the service to start at boot, andsystemctl start dhcpdstarts it now. - On older SysV systems,
chkconfig dhcpd ondoes the same job. systemctl status dhcpdconfirms that the server is running.- Always check the syntax of
dhcpd.confbefore restarting, because a bad file stops the service.
Configuration of DHCP Clients
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>A DHCP client is configured to obtain its network settings from a server instead of using fixed values.</mark>
Key points.
- On Linux, setting
BOOTPROTO=dhcpin the interface fileifcfg-eth0makes the interface a DHCP client. - The client program is
dhclient, anddhclient eth0requests a lease manually. - In Windows, choose "Obtain an IP address automatically" in the adapter's IPv4 properties.
dhclient -rreleases the current lease.
Manually Configuring the DHCP
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>Manual configuration means installing the DHCP server and editing its files by hand instead of using a graphical tool.</mark>
Key points.
- Install the package with
yum install dhcp(orapt install isc-dhcp-server). - Edit
dhcpd.confto declare the subnet, range, router, DNS and lease time. - Name the serving interface (for example in
/etc/sysconfig/dhcpd), then runsystemctl start dhcpd. - Test from a client with
dhclient, and read the log ordhcpd.leasesto confirm the lease.
Installation of Linux
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>Linux installation is the process of copying the operating system from boot media onto a disk and configuring it for first use.</mark>
Key points.
- Boot from a DVD or USB, then select language, keyboard and time zone.
- Partition the disk, with at least a root
/partition and a swap partition. - Choose the packages, set the hostname and network, and create the root password and a user.
- Install the boot loader (GRUB), reboot and log in.
Customization of Linux
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>Customization means adjusting the installed Linux system to the user's or server's needs.</mark>
Key points.
- Add or remove software with the package manager, for example
yumorapt. - Set the network, hostname, users and groups, and the time zone.
- Tune the desktop, shell (
~/.bashrc) and startup services withsystemctl. - Rebuild the kernel with only the needed modules to make the system smaller and faster.
Installation of SAMBA, APACHE, TOMCAT, Send MAIL, Postfix
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>These are packages that turn a Linux machine into a file server (Samba), web server (Apache), Java servlet server (Tomcat) and mail server (Sendmail or Postfix).</mark>
Key points.
- Samba shares files and printers with Windows using the SMB protocol, and it is configured in
/etc/samba/smb.conf. - Apache (
httpd) serves web pages on port 80 and is configured inhttpd.conf. - Tomcat runs Java servlets and JSP, and it listens on port 8080 by default.
- Sendmail and Postfix send mail over SMTP (port 25), and Postfix is the simpler and more secure choice, configured in
main.cf.
Implementation of DNS, LDAP services, Firewall, Proxy server
<span style="display:inline-block;padding:.16em .6em;border:1.5px solid currentColor;border-radius:999px;font-size:.68em;font-weight:700;letter-spacing:.06em;text-transform:uppercase;opacity:.75">Not asked since 2022</span>
Definition. <mark>These are network services on Linux: DNS resolves names to addresses, LDAP is a directory service, a firewall filters packets and a proxy relays client requests.</mark>
Key points.
- DNS uses BIND (
named), configured innamed.confwith zone files that map names to IP addresses. - LDAP uses OpenLDAP (
slapd) to keep users and resources in a directory for central login. - The firewall uses
iptables(orfirewalld) rules to accept or drop packets by address and port. - The proxy server uses Squid, which caches web pages and controls user access.
Last-minute revision
- DHCP gives IP, mask, gateway and DNS automatically; the four steps are DORA.
- The DHCP server uses UDP port 67 and the client uses UDP port 68.
- A lease is the time an address is loaned; renew at 50% (T1), rebind at 87.5% (T2).
- A scope is the address range for one subnet.
- The allocation types are dynamic, automatic and manual.
- The server file is
/etc/dhcp/dhcpd.confand the leases are indhcpd.leases. - Start at boot with
systemctl enable dhcpd. - The client uses
BOOTPROTO=dhcpand thedhclientcommand. - Samba is for files, Apache for web (port 80), Tomcat for servlets (port 8080), Postfix for mail (port 25).
- BIND is DNS, OpenLDAP is LDAP, iptables is the firewall and Squid is the proxy.
Memory hooks
- DORA: Discover, Offer, Request, Acknowledge.
- Ports 67 and 68: the server is 67 and the client is 68 (the client is bigger by one).
- Allocation types: Dynamic is temporary, Automatic is permanent, Manual is fixed by MAC.
- SAMBA = SMB for Windows, AP-ache = web, TOM-cat = Java, POST-fix = mail.
- BIND, slapd, iptables, Squid: DNS, LDAP, firewall, proxy.
Coverage checklist
- DHCP Introduction: no past questions.
- DHCP Leased Time: no past questions.
- DHCP Scopes: no past questions.
- DHCP IP Address: no past questions.
- Allocation Types: no past questions.
- Planning DHCP Deployment: no past questions.
- DHCP Configuration files: no past questions.
- Automatic Startup of DHCP Server: no past questions.
- Configuration of DHCP Clients: no past questions.
- Manually Configuring the DHCP: no past questions.
- Installation of Linux: no past questions.
- Customization of Linux: no past questions.
- Installation of SAMBA, APACHE, TOMCAT, Send MAIL, Postfix: no past questions.
- Implementation of DNS, LDAP services, Firewall, Proxy server: no past questions.