Linux in general, Fedora Core 4 andRed Hat Enterprise Linux in particular, are very powerful operating systemsthat can be used at the enterprise level as a full-fledged server.. Chapter
Trang 2Terry Collings and Kurt Wall
Networking and System
Administration
Third Edition
Trang 4Red Hat ® Linux ® Networking and System Administration
Third Edition
Trang 6Terry Collings and Kurt Wall
Networking and System
Administration
Third Edition
Trang 7Red Hat ® Linux ® Networking and System Administration, Third Edition
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard Indianapolis, IN 46256
www.wiley.com
Copyright © 2005 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada
ISBN-13: 978-0-7645-9949-1 ISBN-10: 0-7645-9949-6 Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted
in any form or by any means, electronic, mechanical, photocopying, recording, scanning
or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authoriza- tion through payment of the appropriate per-copy fee to the Copyright Clearance Center,
222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600 Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publish- ing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317)
572-4355, or online at http://www.wiley.com/go/permissions
Limit of Liability/Disclaimer of Warranty:The publisher and the author make no sentations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties
repre-of fitness for a particular purpose No warranty may be created or extended by sales or promotional materials The advice and strategies contained herein may not be suitable for every situation This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services If professional assistance is required, the services of a competent professional person should be sought Neither the publisher nor the author shall be liable for damages arising herefrom The fact that an organization or Website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make Further, readers should be aware that Internet Websites listed in this work may have changed or disappeared between when this work was written and when it is read For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S at (800) 762-2974, outside the U.S at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats Some content that appears
in print may not be available in electronic books.
Trademarks:Wiley, the Wiley Publishing logo and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc and/or its affiliates in the United States and other countries, and may not be used without written permission Red Hat is a regis- tered trademark of Red Hat, Inc Linux is a registered trademark of Linus Torvalds All other trademarks are the property of their respective owners Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.
Trang 8Terry Collingsis the owner of TAC Technology, located in eastern nia He provides Linux consulting and training services to a variety of clients.Terry has been an adjunct faculty member at several colleges in his areawhere he has taught A + and Network + certification courses He also has taughtcourses on Unix, Linux, TCP/IP, and Novell Netware.
Pennsylva-Terry is the author of Red Hat Enterprise Linux 4 For Dummies and has
co-authored and contributed to several other Linux books He has been a
tech-nical editor for the following books: KDE Bible, The Samba Book, Unix Weekend
Crash Course, Red Hat Linux 9 For Dummies, Solaris 9 For Dummies, Fedora Linux
2 For Dummies, and Linux Timesaving Techniques For Dummies.
Kurt Wallfirst touched a computer in 1980 when he learned FORTRAN on anIBM mainframe of forgotten vintage; things have improved since then A pro-fessional technical writer by trade, a historian by training, and an all-aroundLinux guy by avocation, Kurt’s work history is diverse These days, Kurt works
in the Customer Engineering group at TimeSys Corporation in Pittsburgh,Pennsylvania His primary responsibilities include building and maintain-ing TimeSys’s Developer Exchange and working with portal customers andusers He also fixes broken servers, writes documentation, and builds TimeSyssoftware
Kurt, who dislikes writing about himself in the third person, receives entirelytoo much e-mail at kwall@kurtwerks.com
About the Authors
v
Trang 9Quality Control Technicians
Amanda BriggsJohn GreenoughSusan MoritzJoe Niesen
Proofreading and Indexing
TECHBOOKS Production Services
Trang 10This book is dedicated to my wife, Nancy, and daughter, Sabrina,
who bring joy and wonder every day.
—Terry Collings
To my new wife, Kelly, who is indeed flesh
of my flesh and bone of my bone.
—Kurt Wall
Trang 12Red Hat produces the most popular distribution of Linux currently in use It is
a robust, reliable operating system that can run on a variety of hardware, frompersonal computers to large mainframes Linux in general, Fedora Core 4 andRed Hat Enterprise Linux in particular, are very powerful operating systemsthat can be used at the enterprise level as a full-fledged server Linux functionsequally well at the enterprise-workstation level for typical user applications,
as well as on home PCs For those of us dissatisfied with the reliability andsecurity of other commercially available operating systems, Fedora Core 4 andRed Hat Enterprise Linux are a pleasant alternative
How This Book Is Organized
This book is divided into five parts and one appendix, each covering a specificarea of functionality in a typical Fedora Core 4 and Red Hat Enterprise Linuxsystem In this book, the third edition, we have added more chapters thatcover areas we discussed in the first and second editions in more detail or thatexplore material not covered in the first or second editions With this edition,the book now contains 35 chapters and a rather large appendix, a considerableincrease in content since the first edition was released three years ago Wewant to emphasize that this book is useful for users of Fedora Core, the opensource community–based Linux project supported by Red Hat, as well as users
of Red Hat Enterprise Linux
Preface
ix
Trang 13Part I: System and Network Administration Defined
This part sets the stage and defines the role of a system administrator, ning with an explanation of the duties of a system administrator and continu-ing through installing your system and finishing with descriptions of the filesystem and system configuration files Chapter 1 explains some of the com-mon tasks an administrator may perform, such as installing servers and appli-cation software, managing user accounts, and backing up and restoring files.Chapter 2 details the steps involved in planning and implementing a network,including security and disaster-recovery considerations Chapter 3 covers allthe steps required to install Fedora Core or Red Hat Enterprise Linux on a localsystem using the most typical installation method Chapter 4 gives youinstructions on using Kickstart to perform system installations on remote sys-tems Chapter 5 gives you an introduction to the GNOME and KDE graphicaluser environments and helps you find your way around the desktop Chap-ter 6 teaches you about the startup and shutdown process of your system,including the GRUB boot loader and the init process In Chapter 7, you explorethe details of the file system hierarchy and learn about other supported filesystems Part I ends with Chapter 8, which lists the system and network con-figuration files and explains the purpose of each file
begin-Part II: Network Services
This part of the book is where you learn about the networking services able in Fedora Core and Red Hat Enterprise Linux Beginning with Chapter 9,you learn about the X Window system used to provide a graphical workingenvironment as well as font management Chapter 10 tells you how to config-ure your printers to use the Common Unix Printing System (CUPS), thedefault printing system used by Fedora Core and Red Hat Enterprise Linux InChapter 11, you learn about the TCP/IP protocol suite and how to configure it
avail-on your system Chapter 12 explains the cavail-onfiguratiavail-on of the Network FileSystem (NFS) used to share files with other Linux or UNIX computers on yournetwork Chapter 13 gives you the details about the Network Information Sys-tem (NIS) and configuration instructions If you have computers runningMicrosoft Windows NT, 2000, or XP, you will want to read Chapter 14 to learnhow to share files with them using Samba Chapter 14 also provides instruc-tions on connecting a client to Novell networks so you can share files withthese systems as well Chapter 15 gives you the details of installing and con-figuring an Oracle database on your server In Chapter 16 you learn about set-ting up a VNC server to provide remote access with a graphical interface.Chapter 17 is all about convenience and some of the convenience services you
Trang 14can provide with your system The last chapter in this part, Chapter 18, givesyou some helpful tips for optimizing the services discussed in Part II.
Part III: Internet Services
Internet services are somewhat different from network services on an internalnetwork, and Chapter 19 begins this part by explaining what we mean byInternet services Included in this chapter is an explanation of the Xinetd andTCP wrappers configuration files The ability to convert domain names to IPaddresses is a fundamental part of providing Internet services Chapter 20explains how to configure BIND on your system to provide this service Thenext three chapters provide installation and configuration instructions forthree commonly used Internet services Chapter 21 describes the process ofsending e-mail and how to configure Sendmail, the most commonly used mailtransfer agent, as well as Postfix, which is quickly gaining popularity Chapter
22 explains setting up an FTP server on your system Chapter 23 covers themost widely used Web server, Apache, and explains the configuration process
In Chapter 24 you learn about other common Web services that you can vide The last chapter in Part III, Chapter 25, provides some optimizationinformation for the services covered in this part of the book
pro-Part IV: System Administration
The goal of this part of the book is to provide enough information so you have
a fundamental understanding of the tasks required to maintain your systemand ensure that it runs well Chapter 26 explains the up2date program that isincluded with Fedora Core and Enterprise Linux that you can use to keep yoursystem updated Also covered is the Red Hat Network, a subscription serviceavailable with Red Hat Enterprise Linux that you can use to keep your systemcurrent You can register your systems with Red Hat and then receive auto-matic notifications of updated or new software that can be installed Some-times it is advantageous to upgrade or recompile your kernel for your specificneeds Chapter 27 discusses the pros and cons of making changes and pro-vides instructions to recompile your kernel If you would rather do your sys-tem configuration from a command prompt instead of using many of theavailable GUI tools, Chapter 28 is for you This chapter provides commandprompt configuration instructions, as well as instructions to create scripts toautomate many routine administration tasks Chapter 29 tells you all you need
to know to effectively manage the users and groups on your system In ter 30, you learn how to install and upgrade software packages on your sys-tem And in the last chapter in this part, Chapter 31, you explore the process ofbacking up the files on your system and how to restore them
Chap-Preface xi
Trang 15Part V: System Security and Problem Solving
Most of the last part of the book deals with performance monitoring and ing, and securing your system, with a final chapter on general system trou-bleshooting Maintaining a secure system is a critical area of concern forsystem administrators Chapter 32 explains the basic steps involved in moni-toring your system’s performance to keep it running as quickly as it should.Chapter 33 addresses a new topic in this edition, SELinux, the access-basedsecurity system developed by the National Security Agency Continuing thediscussion of security, Chapter 34 gives you an explanation of firewalls andInternet security and the risks involved with connections from outside yournetwork You also learn about LDAP and Kerberos and their role in networksecurity The last chapter in this part, Chapter 35, provides some general trou-bleshooting tips and techniques and lists some problems you may encounterduring normal operation of your system and the steps to take to solve theproblems discussed
tun-Appendix A
This appendix is new to this edition We had a lot of information about shellscripting and couldn’t find a good place for it in the parts, so we put it here Ifyou want to become a shell-scripting pro, read this section
How to Use This Book
Our intention in this book is to cover the Fedora Core and Red Hat EnterpriseLinux operating system in enough detail to provide the answers you need Thebook is divided into the parts previously discussed to make it easy for you to
go to the specific part for the topic you need to learn about You can use thebook as a reference for whatever you need to know about a particular topic
Using This Book’s Icons
Look for the following margin icons to help you get the most out of this book:
T I P Tips provide special information or advice.
C A U T I O N Caution icons warn you of a potential problem or error.
Trang 16C R O S S - R E F E R E N C E Cross-references direct you to related information in another section or chapter.
N OT E Notes highlight areas of interest or special concern related to a topic.
Conventions
This book uses the following conventions for explanations of how to do things
on your computer:
■■ Italic type introduces new technical terms It also indicates replaceable
arguments that you should substitute with actual values — the text makes clear the distinction between new terms and replaceablearguments
con-■■ Bold shows a command you type
■■ Monospaced textdistinguishes commands, options, and argumentsfrom surrounding explanatory content
■■ Keys to press in combination are shown as in this example:
Ctrl+Alt+Delete means to press all three keys at the same time
■■ The term click means to press the left mouse button once Double-clickmeans to press the left button twice in quick succession Right-clickmeans to press the right mouse button once Drag means to hold downthe left mouse button and move the mouse while holding down thebutton
Preface xiii