Skip to content
CS-505 · Linux (LAB)/Quick Revision Short Notes

Linux (LAB) (CS-505) - Unit 5 Short Notes

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.

  1. DHCP works on a client-server model over UDP, with the server on port 67 and the client on port 68.
  2. The exchange has four steps, DORA: Discover, Offer, Request, Acknowledge.
  3. It removes manual configuration, so it avoids typing errors and duplicate IP addresses.
  4. 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.

  1. The lease time is set on the server with default-lease-time and max-lease-time, both in seconds.
  2. At 50% of the lease the client tries to renew (T1), and at 87.5% it tries to rebind with any server (T2).
  3. If the lease expires unrenewed, the address returns to the pool and can be given to another client.
  4. 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.

  1. Each subnet needs its own scope, declared in dhcpd.conf as a subnet ... netmask ... { range ...; } block.
  2. A scope also carries options such as router, DNS servers and lease time.
  3. Addresses that are fixed, such as servers and printers, are excluded from the range or reserved.
  4. 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.

  1. The server records each binding (IP, MAC, lease end) in the lease file dhcpd.leases.
  2. Before offering, the server checks that the address is unused, so conflicts are avoided.
  3. A client that had an address earlier normally gets the same one again on renewal.
  4. 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.

  1. Dynamic allocation leases an address for a limited time, and the address is reused after expiry.
  2. Automatic allocation assigns a free address permanently, with no expiry.
  3. Manual allocation gives a fixed address chosen by the administrator and tied to the client's MAC address.
  4. 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.

  1. First count the subnets and clients, then size each scope with spare addresses.
  2. Decide which hosts need static addresses and exclude them from the dynamic range.
  3. Choose lease times by client behaviour, and place a DHCP relay agent where a subnet has no server.
  4. 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.

  1. Global lines such as default-lease-time 600; and option domain-name-servers 8.8.8.8; apply to all subnets.
  2. 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;
}
  1. A host block with hardware ethernet and fixed-address reserves an address for one MAC.
  2. 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.

  1. On systemd systems, systemctl enable dhcpd sets the service to start at boot, and systemctl start dhcpd starts it now.
  2. On older SysV systems, chkconfig dhcpd on does the same job.
  3. systemctl status dhcpd confirms that the server is running.
  4. Always check the syntax of dhcpd.conf before 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.

  1. On Linux, setting BOOTPROTO=dhcp in the interface file ifcfg-eth0 makes the interface a DHCP client.
  2. The client program is dhclient, and dhclient eth0 requests a lease manually.
  3. In Windows, choose "Obtain an IP address automatically" in the adapter's IPv4 properties.
  4. dhclient -r releases 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.

  1. Install the package with yum install dhcp (or apt install isc-dhcp-server).
  2. Edit dhcpd.conf to declare the subnet, range, router, DNS and lease time.
  3. Name the serving interface (for example in /etc/sysconfig/dhcpd), then run systemctl start dhcpd.
  4. Test from a client with dhclient, and read the log or dhcpd.leases to 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.

  1. Boot from a DVD or USB, then select language, keyboard and time zone.
  2. Partition the disk, with at least a root / partition and a swap partition.
  3. Choose the packages, set the hostname and network, and create the root password and a user.
  4. 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.

  1. Add or remove software with the package manager, for example yum or apt.
  2. Set the network, hostname, users and groups, and the time zone.
  3. Tune the desktop, shell (~/.bashrc) and startup services with systemctl.
  4. 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.

  1. Samba shares files and printers with Windows using the SMB protocol, and it is configured in /etc/samba/smb.conf.
  2. Apache (httpd) serves web pages on port 80 and is configured in httpd.conf.
  3. Tomcat runs Java servlets and JSP, and it listens on port 8080 by default.
  4. 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.

  1. DNS uses BIND (named), configured in named.conf with zone files that map names to IP addresses.
  2. LDAP uses OpenLDAP (slapd) to keep users and resources in a directory for central login.
  3. The firewall uses iptables (or firewalld) rules to accept or drop packets by address and port.
  4. 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.conf and the leases are in dhcpd.leases.
  • Start at boot with systemctl enable dhcpd.
  • The client uses BOOTPROTO=dhcp and the dhclient command.
  • 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.
Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in