1. Trang chủ
  2. » Công Nghệ Thông Tin

Linux Quick Fix Notebook docx

696 65 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 696
Dung lượng 8,31 MB

Nội dung

PRAISE FOR LINUX QUICK FIX NOTEBOOK “Where has this book been all my professional life? It is about time someone wrote this book. The author covers many basic, practical issues that other authors omit in a format that makes for a great troubleshooting reference and for casual perusing. There are a lot of books available that give a broad overview of system and network administration, and there are a lot of detailed books on each specific topic covered in this book, but I don’t know of any other place where I can get so much useful, practical information on such a wide range of topics in such a concise and readable form. I will highly recommend it to my friends and colleagues who are trying to manage their own systems. I am anxious to show it to our instructors who teach data communications and networks as a possible text or lab manual.” —Ron McCarty, instructor and program chair, Computer Science, Penn State Erie “This book takes a very unique approach and is very flexible. It offers a great deal to the home user, students, small businesses—all the way to any Linux sys admin that needs a handy reference. I found it very refreshing in terms of style, stated goals, presentation, ease of use, direction, and the “present and future” value of the content. In other words the author is very current and knowledgeable. I would recommend this book to every level from programmer to manager.” —Joe Brazeal, Information Technician III, Southwest Power Pool “This book is an excellent resource for new Linux administrators. I was impressed with the comprehensive set of 35 topic chapters, making this book a very useful reference. I know of no other work like this.” —George Vish II, Linux curriculum program manager and senior education consultant, Hewlett-Packard Education “I would recommend this book to novice Linux users and administrators. It covers a lot of topics, and makes it easy for readers to follow along.” —Bret Strong, education consultant, Hewlett-Packard Company “Linux Quick Fix Notebook is a well-written guide to designing, installing, and maintain- ing Linux servers. Many Linux reference texts are just simple rewrites of Linux ¨man¨ and ¨info¨ pages, but this book addresses the real issues that systems administrators encounter when working with Linux. The author provides a pedagogical guide to learn- ing Linux server administration. In addition, the book includes step-by-step information so that users can quickly take advantage of the best that open source software has to offer today. I would recommend this book to both beginning and intermediate users of Linux.” —Joseph Naberhaus, Professor of Networking, Universidad Del Mar 00Harrison_FM.qxd 2/25/05 12:38 PM Page i 00Harrison_FM.qxd 2/25/05 12:38 PM Page ii Linux ® Quick Fix Notebook 00Harrison_FM.qxd 2/25/05 12:38 PM Page iii B RUCE P ERENS ’ O PEN S OURCE S ERIES http://www.phptr.com/perens ◆ C++ GUI Programming with Qt 3 Jasmin Blanchette, Mark Summerfield ◆ Managing Linux Systems with Webmin: System Administration and Module Development Jamie Cameron ◆ Understanding the Linux Virtual Memory Manager Mel Gorman ◆ Implementing CIFS: The Common Internet File System Christopher Hertel ◆ Embedded Software Development with eCos Anthony Massa ◆ Rapid Application Development with Mozilla Nigel McFarlane ◆ The Linux Development Platform: Configuring, Using, and Maintaining a Complete Programming Environment Rafeeq Ur Rehman, Christopher Paul ◆ Intrusion Detection with SNORT: Advanced IDS Techniques Using SNORT, Apache, MySQL, PHP, and ACID Rafeeq Ur Rehman ◆ The Official Samba-3 HOWTO and Reference Guide John H. Terpstra, Jelmer R. Vernooij, Editors ◆ Samba-3 by Example: Practical Exercises to Successful Deployment John H. Terpstra 00Harrison_FM.qxd 2/25/05 12:38 PM Page iv Linux ® Quick Fix Notebook Peter Harrison Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris Madrid • Capetown • Sydney • Tokyo • Singapore • Mexico City 00Harrison_FM.qxd 2/25/05 12:39 PM Page v Many of the designations used by manufacturers and sellers to distinguish their prod- ucts are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in con- nection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U. S. Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the U. S., please contact: International Sales international@pearsoned.com Visit us on the Web: www.phptr.com Library of Congress Number: 2004117224 Copyright © 2005 Pearson Education, Inc. Printed in the United States of America. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently avail- able at http://www.opencontent.org/openpub/). ISBN 0-13-186150-6 Text printed in the United States on recycled paper at R.R. Donnelley and Sons Company in Crawfordsville, Indiana. First printing, March 2005 00Harrison_FM.qxd 3/1/05 4:08 PM Page vi Dedicated to Diana “Turn off the light and come to bed.” Blaze and Jade “Daddy, can we stop being quiet now?” Jack and Barbara By my side every day. 00Harrison_FM.qxd 2/25/05 12:39 PM Page vii 00Harrison_FM.qxd 2/25/05 12:39 PM Page viii Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxxi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xl About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xli Part 1 The Linux File Server Project 1 Why Host Your Own Site? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 In This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 Our Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 Alternatives to In-House Web Hosting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 Virtual Hosting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Dedicated Hosting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Factors to Consider Before Hosting Yourself . . . . . . . . . . . . . . . . . . . . . . . . . .6 Is In-House Hosting Preferred? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 How to Migrate From an External Provider . . . . . . . . . . . . . . . . . . . . . . . . . . .8 In-House Server Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10 2 Introduction to Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 In This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 The OSI Networking Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12 An Introduction to TCP/IP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 TCP Is a Connection-Oriented Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . .14 How TCP Establishes a Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 UDP, TCP’s “Connectionless” Cousin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 TCP and UDP Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 The TCP/IP Time to Live Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 The ICMP Protocol and Its Relationship to TCP/IP . . . . . . . . . . . . . . . . . .16 ix 00Harrison_FM.qxd 2/25/05 12:39 PM Page ix How IP Addresses Are Used to Access Network Devices . . . . . . . . . . . . . . .17 Private IP Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 The localhost IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18 Network Address Translation (NAT) Makes Private IPs Public . . . . . . . .18 Port Forwarding with NAT Facilitates Home-Based Web Sites . . . . . . . .19 DHCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 How DNS Links Your IP Address to Your Web Domain . . . . . . . . . . . . . . .20 IP Version 6 (IPv6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21 How Subnet Masks Group IP Addresses into Networks . . . . . . . . . . . . . . . .21 Calculating the Number of Addresses Assigned to a Subnet . . . . . . . . . . .22 Calculating the Range of Addresses on Your Network . . . . . . . . . . . . . . . .22 Subnet Masks for the Typical Business DSL Line . . . . . . . . . . . . . . . . . . .24 The Physical and Link Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 Networking Equipment Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 Network Interface Cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 The Two Broad Types of Networking Equipment . . . . . . . . . . . . . . . . . . .27 Connectivity Using Hubs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 Using Switches as a Faster Alternative to Hubs . . . . . . . . . . . . . . . . . . . .29 Local Area Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 How Routers Interconnect LANs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 How Simple Routing Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 Default Gateways, the Routers of Last Resort . . . . . . . . . . . . . . . . . . . . . .31 Firewalls Help Provide a Secure Routing Environment . . . . . . . . . . . . . .31 Additional Introductory Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32 The File Transfer Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32 Linux Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 3 Linux Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 In This Chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 How to Configure Your NIC’s IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . .36 Determining Your IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36 Changing Your IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37 Multiple IP Addresses on a Single NIC . . . . . . . . . . . . . . . . . . . . . . . . . . .39 IP Address Assignment for a Direct DSL Connection . . . . . . . . . . . . . . . .40 IP Address Assignment for a Cable Modem Connection . . . . . . . . . . . . . .45 How to Activate/Shut Down Your NIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 How to View Your Current Routing Table . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 How to Change Your Default Gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46 How to Configure Two Gateways . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47 Adding Routes from the Command Line . . . . . . . . . . . . . . . . . . . . . . . . . . .47 Adding Routes with /etc/sysconfig/network-scripts/ Files . . . . . . . . . . .48 How to Delete a Route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49 Changing NIC Speed and Duplex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49 Using mii-tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49 Using ethtool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 x Contents 00Harrison_FM.qxd 2/25/05 12:39 PM Page x [...]... have to purchase additional specialist books on each topic Linux Quick Fix Notebook takes these “advanced sections” and expands them sufficiently to provide a practical tutorial guide on how to do basic configuration of many popular Linux back-office applications with command-bycommand instructions To avoid confusion between the many flavors of Linux, each with its own GUI interface, this guide exclusively... outlined in a logical step-by-step fashion Chapter 13 Linux Wireless Networking Coverage of how to install, configure, and test a wireless network that includes Linux servers PART 2 The Linux Web Site Project Chapter 14 Linux Firewalls Using iptables Security is an essential part of Web life This chapter gives an explanation of the most popular Linux- based firewall software with step-by-step examples... as your Linux administration role expands Explanations are given not as a lecturer, but as a trusted and experienced coworker The chapters have a logical flow of information starting with concise backgrounders and ending with a troubleshooting section They cover these essential topics: Software installation Networking setup and troubleshooting Samba for Windows files on Linux servers Linux- to -Linux file... one-paragraph discussions Chapter 3 Linux Networking A practical guide to configuring a network interface and simple Internet routing using Linux Chapter 4 Simple Network Troubleshooting Very detailed yet simply explained coverage of the various methods you can use to identify network trouble spots Chapter 5 Troubleshooting Linux with syslog Explanations on how to view and use Linux system error messages as... know on installing Linux software using popularly available RPM installation files Chapter 7 The Linux Boot Process Explanations of how Linux starts up after turning on the power switch Coverage of how to activate/deactivate the startup of various important system programs when the system boots up Details on how to choose between using the graphical and regular text interfaces on the Linux VGA console... RPMs 192 Installing the RPMs 193 Linux- WLAN Post Installation Steps 194 Start Linux- WLAN 196 Testing Linux- WLAN 196 Linux- WLAN Encryption for Security 197 Troubleshooting Your Wireless LAN ... PM Page xvi xvi Contents Networking with Linux Wireless Tools 189 Using iwconfig for Wireless Tools Configuration 189 Permanent Wireless Tools Configuration 190 Wireless Tools Encryption 191 Networking with Linux- WLAN 191 Linux- WLAN Preparation ... tasks needed to be done It provides all the expected screen output when configuring the most commonly used Linux applications to help assure readers that they are doing the right thing The notebook also includes many of the most commonly encountered errors with explanations of their causes and how to fix them ® 00Harrison_FM.qxd 2/25/05 12:39 PM Page xxxii xxxii Preface PREREQUISITES The book’s format... or home network and shows you how to set up the Linux servers most businesses need Three sections have been created to make this process easier The first starts as an introduction to networking and extends into using Linux as a main departmental server The next section expands on this knowledge to show you how to create, manage, and monitor your own Linux- based Web site running on a simple DSL or cable... 203 Unknown Device Errors 203 A Common Problem with Linux- WLAN and Fedora Core 1 204 Wireless Networks In Businesses 205 Conclusion 206 Part 2 The Linux Web Site Project 14 Linux Firewalls Using iptables 209 In This Chapter . Hewlett-Packard Company Linux Quick Fix Notebook is a well-written guide to designing, installing, and maintain- ing Linux servers. Many Linux reference texts. PRAISE FOR LINUX QUICK FIX NOTEBOOK “Where has this book been all my professional life? It is about

Ngày đăng: 18/03/2014, 01:20

TỪ KHÓA LIÊN QUAN

w