LPIC-2 Handbook

Table of Contents

  1. The LPI 201 Exam

  2. The LPI 202 Exam

  3. Appendix

  4. Index

  5. Answers to Review Questions


The LPI 201 Exam

Starting a System

Summary
Exam Essentials
Review Questions

Maintaining the System

Summary
Exam Essentials
Review Questions

Mastering the Kernel

Summary
Exam Essentials
Review Questions

Managing the Filesystem

Summary
Exam Essentials
Review Questions

Administering Advanced Storage Devices

Summary
Exam Essentials
Review Questions

Summary
Exam Essentials
Review Questions


The LPI 202 Exam

Organizing Email Services

Summary
Exam Essentials
Review Questions

Directing DNS

Summary
Exam Essentials
Review Questions

Offering Web Services

Summary
Exam Essentials
Review Questions

Sharing Files

Summary
Exam Essentials
Review Questions

Managing Network Clients

Summary
Exam Essentials
Review Questions

Setting Up System Security

Summary
Exam Essentials
Review Questions

Starting a System

The Linux Boot Process

Commands:

Enterprise Information:

Following the Boot Process

Commands:

Enterprise Information:

Viewing the Boot Process

Commands:

Enterprise Information:

The Firmware Startup

Commands:

Enterprise Information:

The BIOS Startup

Commands:

Enterprise Information:

The UEFI Startup

Commands:

Enterprise Information:

Linux Bootloaders

Commands:

Enterprise Information:

Alternative Bootloaders

Commands:

Enterprise Information:

Secure Bootloaders

Commands:

Enterprise Information:

Process Initialization

Commands:

Enterprise Information:

System Recovery

Commands:

Enterprise Information:

Maintaining the System

Keeping Users Informed

Commands:

Enterprise Information:

Looking at Fluid Messaging

Commands:

Enterprise Information:

Looking at Static Messaging

Commands:

Enterprise Information:

Backing Up the System

Commands:

Enterprise Information:

Developing a Backup Strategy

Commands:

Enterprise Information:

Performing Backups

Commands:

Enterprise Information:

Installing Programs from Source

Commands:

Enterprise Information:

Obtaining the Installation Files

Commands:

Enterprise Information:

Unpacking the Installation Files

Commands:

Enterprise Information:

Reading Installation Documentation

Commands:

Enterprise Information:

Compiling Preparation

Commands:

Enterprise Information:

Compiling the Program

Commands:

Enterprise Information:

Completing the Installation

Commands:

Enterprise Information:

Managing Resource Usage

Commands:

Enterprise Information:

Measuring Resource Usage

Commands:

Enterprise Information:

Predicting Resource Usage

Commands:

Enterprise Information:

Troubleshooting Resource Usage

Commands:

Enterprise Information:

Mastering the Kernel

What Is the Kernel?

Information:

Enterprise Information:

The Kernel Features

Information:

Enterprise Information:

Parts of the Kernel

Information:

Enterprise Information:

Kernel Versions

Information:

Enterprise Information:

Compiling a Kernel

Information:

Enterprise Information:

Obtaining Source Code

Commands:

Enterprise Information:

Creating the Configuration File

Commands:

Enterprise Information:

Compiling and Installing the Kernel

Commands:

Enterprise Information:

Compiling and Installing Modules

Commands:

Enterprise Information:

Creating an Initial RAM Disk

Commands:

Enterprise Information:

Booting the New Kernel

Commands:

Enterprise Information:

Creating a Kernel Package

Commands:

Enterprise Information:

Maintaining the Kernel

Commands:

Enterprise Information:

Working with Module Files

Commands:

Enterprise Information:

Module Commands

Commands:

Enterprise Information:

Working with Hardware

Commands:

Enterprise Information:

Automatically Detecting Hardware

Commands:

Enterprise Information:

Troubleshooting the Kernel

Commands:

Enterprise Information:

Managing the Filesystem

Operating the Linux Filesystem

Information:

Enterprise Information:

Understanding Filesystem Structures

Information:

Enterprise Information:

Understanding Filesystem Types

Information:

Enterprise Information:

Making a Filesystem

Commands:

Enterprise Information:

Attaching a Filesystem

Commands:

Enterprise Information:

Exploring Additional Filesystem Topics

Information:

Enterprise Information:

Looking at Memory-Based Linux Filesystems

Information:

Commands:

Enterprise Information:

Looking at the Btrfs Filesystem

Information:

Enterprise Information:

Exploring Btrfs Subvolumes

Information:

Commands:

Enterprise Information:

Exploring Btrfs Snapshots

Information:

Commands:

Enterprise Information:

Looking at Optical Filesystems

Information:

Commands:

Enterprise Information:

Looking at Swap Filesystems

Information:

Commands:

Enterprise Information:

Looking at Network-Based Filesystems

Information:

Commands:

Enterprise Information:

Understanding Auto-Mounting

Information:

Commands:

Enterprise Information:

Looking at Encrypted Filesystems

Information:

Commands:

Enterprise Information:

Maintaining Linux Filesystems

Information:

Enterprise Information:

Adjusting a Filesystem

Information:

Commands:

**

Enterprise Information:**

Checking and Repairing a Filesystem

Information:

Commands:

Enterprise Information:

Using SMART

SMART (Self-Monitoring, Analysis, and Reporting Technology) is a system built into modern hard drives (HDDs) and solid-state drives (SSDs) to monitor and report on the health and performance of the storage device. It helps in predicting potential failures before they occur, thereby reducing the risk of data loss. Here’s a deeper look into SMART:

Key Features of SMART

  1. Health Monitoring:

    • SMART collects various data points about the drive’s performance and health, including temperature, error rates, and usage statistics.
  2. Failure Prediction:

    • By analyzing SMART data, the system can predict imminent hardware failures, allowing for proactive replacement or backup.
  3. Diagnostics:

    • SMART provides diagnostic information that can be used to troubleshoot issues with the drive. This includes error logs and performance metrics.
  4. Alerts and Reporting:

    • SMART can be configured to alert users about potential issues. Some monitoring tools and utilities provide detailed reports and recommendations based on SMART data.

Key SMART Attributes

SMART attributes are specific metrics or data points collected by the drive. Each attribute has a different significance and threshold value. Here are some common SMART attributes:

SMART Commands

1. View SMART Status:
To check the SMART status of a drive and view detailed information:

smartctl -a /dev/sdX

Replace /dev/sdX with the appropriate device identifier.

2. Run SMART Tests:
SMART supports running self-tests to check the drive’s health.

3. Check SMART Log:
To view the SMART log and error history:

smartctl -l error /dev/sdX

4. Enable/Disable SMART Monitoring:
To enable or disable SMART monitoring on a drive:

smartctl -s on /dev/sdX
smartctl -s off /dev/sdX

Interpreting SMART Data

SMART Tools

Several tools can help you work with SMART data:

Enterprise Considerations

  1. Proactive Monitoring:

    • Implement regular SMART monitoring as part of your IT infrastructure management. Automate alerts for critical SMART attributes to ensure timely intervention.
  2. Data Backup:

    • Always maintain regular backups of important data. SMART can predict failures, but it’s not infallible, and having backups minimizes the impact of unexpected drive failures.
  3. Drive Replacement Policies:

    • Establish policies for replacing drives based on SMART data and other performance indicators. Preemptive drive replacement based on SMART warnings can prevent data loss and downtime.
  4. Integration with Monitoring Systems:

    • Integrate SMART monitoring with enterprise monitoring systems to centralize health checks and alerts.

By leveraging SMART, you can improve the reliability of your storage systems, anticipate potential issues, and safeguard your data against unexpected drive failures.nd data loss.

Here’s a concise guide with Linux commands and tools to handle and attempt to fix bad sectors:

1. Identify Bad Sectors

2. Backup Data

3. Repair Filesystem

4. Mark Bad Sectors

5. Reallocate Bad Sectors

Modern drives automatically reallocate bad sectors when they are marked. Ensure you have the latest firmware and run a full scan to let the drive’s firmware handle it.

6. Monitor Drive Health

Administering Advanced Storage Devices

Configuring RAID

Information:

Enterprise Information:

Commands:

Understanding RAID

Information:

Enterprise Information:

Implementing RAID on Linux

Commands:

Enterprise Information:

Managing a RAID Array

Commands:

Enterprise Information:

Adjusting Storage Devices

Information:

Commands:

Enterprise Information:

Testing and Tuning Drives

Commands:

Enterprise Information:

Implementing iSCSI

Information:

Commands:

Enterprise Information:

Managing Logical Volumes (LVM)

Information:

Commands:

Supporting Logical Volumes

Commands:

Enterprise Information:

Understanding the Device Mapper

Information:

Commands:

Enterprise Information:

Networking Basics

Information:

Enterprise Information:

The Physical Layer

Information:

Commands:

Enterprise Information:

The Network Layer

Information:

Commands:

Enterprise Information:

The Transport Layer

Information:

Commands:

Enterprise Information:

The Application Layer

Information:

Commands:

Enterprise Information:

Configuring Network Features

Information:

Commands:

Enterprise Information:

Network Configuration Files

Information:

Commands:

Enterprise Information:

Graphical Tools

Information:

Commands:

Enterprise Information:

Command-Line Tools

Information:

Commands:

Enterprise Information:

Basic Network Troubleshooting

Information:

Commands:

Enterprise Information:

Checking the Log Files

Information:

Commands:

Enterprise Information:

Viewing the ARP Cache

Information:

Commands:

Enterprise Information:

Sending Test Packets

Information:

Commands:

Enterprise Information:

Testing Network Routes

Information:

Commands:

Enterprise Information:

Testing Client/Server Connectivity

Information:

Commands:

Enterprise Information:

Finding Host Information

Information:

Commands:

Enterprise Information:

Network Security

Information:

Commands:

Enterprise Information:

Advanced Network Troubleshooting

Information:

Commands:

Enterprise Information:

Viewing Open Network Connections

Information:

Commands:

Enterprise Information:

Viewing Network Statistics

Information:

Commands:

Enterprise Information:

Scanning the Network

Information:

**

Commands:**

Enterprise Information:

Capturing Network Traffic

Information:

Commands:

Enterprise Information:

Organizing Email Services

The Linux Mail System

Information:

Enterprise Information:

Mail Transfer Agent (MTA)

Information:

Commands:

Enterprise Information:

Mail Delivery Agent (MDA)

Information:

Commands:

Enterprise Information:

Mail User Agent (MUA)

Information:

Commands:

Enterprise Information:

Email Protocols

Information:

Simple Mail Transfer Protocol (SMTP)

Information:

Commands:

Enterprise Information:

Post Office Protocol (POP3)

Information:

Commands:

Enterprise Information:

Internet Message Access Protocol (IMAP)

Information:

Commands:

Enterprise Information:

Using Email Servers

Information:

Using Sendmail

Information:

Commands:

Enterprise Information:

Using Postfix

Information:

Commands:

Enterprise Information:

Local Email Delivery

Information:

Commands:

Enterprise Information:

Procmail Basics

Information:

Commands:

Enterprise Information:

Sieve

Information:

Commands:

Enterprise Information:

Remote Email Delivery

Information:

Using Courier

Information:

Commands:

Enterprise Information:

Using Dovecot

Information:

Commands:

Enterprise Information:

Directing DNS

Configuring a DNS Server

Information:

Commands:

Enterprise Information:

Understanding DNS and BIND

Information:

Enterprise Information:

Configuring DNS on Linux

Information:

Commands:

Enterprise Information:

Starting, Stopping, and Reloading BIND

Commands:

Enterprise Information:

Configuring BIND Logging

Information:

Commands:

Enterprise Information:

Creating and Maintaining DNS Zones

Information:

Commands:

Enterprise Information:

Exploring BIND Zone Files

Information:

Commands:

Enterprise Information:

Managing BIND Zones on Linux

Commands:

Enterprise Information:

Securing a DNS Server

Information:

Setting Up Basic Security

Commands:

Enterprise Information:

Jailing BIND

Information:

Commands:

Enterprise Information:

Using DNSSEC

Information:

Commands:

Enterprise Information:

Connecting via TSIG

Information:

Commands:

Enterprise Information:

Apache Web Server

**1. Managing Apache Service

**2. Configuration and Performance

**3. Security and Access Control

**4. Logging and Monitoring

Nginx Web Server

**1. Managing Nginx Service

**2. Configuration and Performance

**3. Security and Access Control

**4. Logging and Monitoring

**5. Additional Tools and Tips

Samba

**1. Understanding Samba

**2. Configuring Samba

**3. Troubleshooting Samba

NFS (Network File System)

**1. Understanding NFS

**2. Configuring NFS

**3. Securing NFS

**4. Troubleshooting NFS

FTP Servers

**1. Understanding FTP

**2. Configuring vsftpd (Very Secure FTP Daemon)

**3. Configuring Pure-FTPd

**4. Troubleshooting FTP

1. Assigning Network Addresses

**1.1 Static IP Address Assignment

2. The DHCP Standard

**2.1 Overview

3. Linux DHCP Software

**3.1 Common DHCP Servers:

4. Installing a Linux DHCP Server

**4.1 On Debian/Ubuntu:

sudo apt-get update
sudo apt-get install isc-dhcp-server

**4.2 On Red Hat/CentOS:

sudo yum install dhcp

5. Configuring a DHCP Server

**5.1 Edit DHCP Configuration File:

**5.2 Start and Enable DHCP Service:

6. Configuring Clients

**6.1 Obtain IP Address via DHCP:

7. Authentication Service

**7.1 PAM Basics

**7.1.1 Overview:

**7.2 Configuring PAM

**7.2.1 Edit PAM Configuration Files:

**7.2.2 Example PAM Configuration:

8. Network Directories

**8.1 LDAP Basics

**8.1.1 Overview:

**8.2 The OpenLDAP Server

**8.2.1 Install OpenLDAP:

**8.2.2 Configure OpenLDAP:

9. Implementing LDAP Clients

**9.1 Install LDAP Client:

**9.2 Configure LDAP Client:

**9.3 Test LDAP Client:

Setting Up System Security

1. Server Network Security

**1.1 Understanding Server Network Security

**1.2 Best Practices:

2. Port Scanning

**2.1 Purpose of Port Scanning

**2.2 Common Tools:

**2.3 Example Commands:

3. Intrusion Detection Systems (IDS)

**3.1 Overview of IDS

**3.2 Popular IDS Tools:

4. External Network Security

**4.1 Protecting External Interfaces

**4.2 Tools and Techniques:

5. Using iptables

**5.1 Introduction to iptables

**5.2 Basic Commands:

**5.3 Example Configuration:

6. Routing in Linux

**6.1 Basic Routing Concepts

**6.2 Common Commands:

7. Connecting Securely to a Server

**7.1 OpenSSH

**7.1.1 Overview

**7.1.2 Basic Commands:

**7.1.3 Configuration:

**7.2 OpenVPN

**7.2.1 Overview

**7.2.2 Basic Commands:

8. Security Resources

**8.1 US-CERT (United States Computer Emergency Readiness Team)

**8.2 SANS Institute

**8.3 Bugtraq