The NetBSD Guide

The NetBSD Developers

All brand and product names used in this guide are or may be trademarks or registered trademarks of their respective owners.

NetBSD® is a registered trademark of The NetBSD Foundation, Inc.

Published: 2007/06/09 14:31:03

$NetBSD: index.html,v 1.5 2007/06/12 20:29:28 dsieger Exp $


Table of Contents

Purpose of this guide
I. About NetBSD
1. What is NetBSD?
1.1. The story of NetBSD
1.2. NetBSD features
1.3. Supported platforms
1.4. NetBSD's target users
1.5. Applications for NetBSD
1.6. The philosophy of NetBSD
1.7. How to get NetBSD
II. System installation and related issues
2. Installation
2.1. Documentation
2.2. The layout of a NetBSD installation
2.3. Installation
2.3.1. Keyboard
2.3.2. Geometries
2.3.3. Partitions
2.3.4. Hard disk space requirements
2.3.5. Retry
3. Example Installation
3.1. Introduction
3.2. Preparing the installation
3.3. Creating the installation floppy
3.4. Last preparatory steps
3.5. Beginning the installation
3.6. Partitions
3.7. Disklabel
3.8. Creating a disklabel
3.9. The disk preparation process
3.10. Choosing the installation media
3.11. Installing from CD-ROM and DVD
3.12. Installing via FTP
3.13. Extracting sets
3.14. System configuration
4. The first boot
4.1. If something went wrong
4.2. Login
4.3. Changing the keyboard layout
4.4. The man command
4.5. Changing the root password
4.6. Changing the shell
4.7. System time
4.8. Basic configuration in /etc/rc.conf
4.9. Enabling FFS soft-dependencies
4.10. Rebooting the system
5. The second boot
5.1. dmesg
5.2. Mounting the CD-ROM
5.3. Mounting the floppy
5.4. Accessing a DOS/Windows partition
5.5. Adding users
5.6. Shadow passwords
5.7. Stopping and rebooting the system
6. rc.d System
6.1. The rc.d Configuration
6.2. The rc.d Scripts
6.3. The Role of rcorder and rc Scripts
6.4. Additional Reading
III. System configuration, administration and tuning
7. Editing
7.1. Introducing vi
7.1.1. The vi interface
7.1.2. Switching to Edit Mode
7.1.3. Switching Modes & Saving Buffers to Files
7.1.4. Yanking and Putting
7.1.5. Navigation in the Buffer
7.1.6. Searching a File, the Alternate Navigational Aid
7.1.7. A Sample Session
7.2. Configuring vi
7.2.1. Extensions to .exrc
7.2.2. Documentation
7.3. Using tags with vi
8. X
8.1. What is X?
8.2. Configuration
8.3. The mouse
8.4. The keyboard
8.5. The monitor
8.6. The video card
8.6.1. XFree 3.x
8.6.2. XFree86 4.x
8.7. Starting X
8.8. Customizing X
8.9. Other window managers
8.10. Graphical login with xdm
9. Linux emulation
9.1. Emulation setup
9.1.1. Configuring the kernel
9.1.2. Installing the Linux libraries
9.1.3. Installing Acrobat Reader
9.2. Directory structure
9.3. Emulating /proc
9.4. Using Linux browser plugins
9.5. Further reading
10. Audio
10.1. Basic hardware elements
10.2. BIOS settings
10.3. Configuring the audio device
10.4. Configuring the kernel audio devices
10.5. Advanced commands
10.5.1. audioctl(1)
10.5.2. mixerctl(1)
10.5.3. audioplay(1)
10.5.4. audiorecord(1)
11. Printing
11.1. Enabling the printer daemon
11.2. Configuring /etc/printcap
11.3. Configuring Ghostscript
11.4. Printer management commands
11.5. Remote printing
12. Using removable media
12.1. Initializing and using floppy disks
12.2. How to use a ZIP disk
12.3. Reading data CDs with NetBSD
12.4. Reading multi-session CDs with NetBSD
12.5. Allowing normal users to access CDs
12.6. Mounting an ISO image
12.7. Using video CDs with NetBSD
12.8. Using audio CDs with NetBSD
12.9. Creating an MP3 (MPEG layer 3) file from an audio CD
12.10. Using a CD-R writer with data CDs
12.11. Using a CD-R writer to create audio CDs
12.12. Creating an audio CD from mp3s
12.13. Copying an audio CD
12.14. Copying a data CD with two drives
12.15. Using CD-RW rewritables
12.16. DVD support
12.17. Creating ISO images from a CD
12.18. Getting volume information from CDs and ISO images
13. The cryptographic device driver (CGD)
13.1. Overview
13.1.1. Why use disk encryption?
13.1.2. Logical Disk Drivers
13.1.3. Availability
13.2. Components of the Crypto-Graphic Disk system
13.2.1. Kernel driver pseudo-device
13.2.2. Ciphers
13.2.3. Verification Methods
13.3. Example: encrypting your disk
13.3.1. Preparing the disk
13.3.2. Scrubbing the disk
13.3.3. Creating the cgd
13.3.4. Modifying configuration files
13.3.5. Restoring data
13.4. Example: encrypted CDs/DVDs
13.4.1. Introduction
13.4.2. Creating an encrypted CD/DVD
13.4.3. Using an encrypted CD/DVD
13.5. Suggestions and Warnings
13.5.1. Using a random-key cgd for swap
13.5.2. Warnings
13.6. Further Reading
14. Concatenated Disk Device (CCD) configuration
14.1. Install physical media
14.2. Configure Kernel Support
14.3. Disklabel each volume member of the CCD
14.4. Configure the CCD
14.5. Initialize the CCD device
14.6. Create a 4.2BSD/UFS filesystem on the new CCD device
14.7. Mount the filesystem
15. NetBSD RAIDframe
15.1. RAIDframe Introduction
15.1.1. About RAIDframe
15.1.2. A warning about Data Integrity, Backups, and High Availability
15.1.3. Getting Help
15.2. Setup RAIDframe Support
15.2.1. Kernel Support
15.2.2. Power Redundancy and Disk Caching
15.3. Example: RAID-1 Root Disk
15.3.1. Pseudo-Process Outline
15.3.2. Hardware Review
15.3.3. Initial Install on Disk0/wd0
15.3.4. Preparing Disk1/wd1
15.3.5. Initializing the RAID Device
15.3.6. Setting up Filesystems
15.3.7. Setting up kernel dumps
15.3.8. Migrating System to RAID
15.3.9. The first boot with RAID
15.3.10. Adding Disk0/wd0 to RAID
15.3.11. Testing Boot Blocks
15.4. Testing kernel dumps
16. Pluggable Authentication Modules (PAM)
16.1. About
16.2. Introduction
16.3. Terms and conventions
16.3.1. Definitions
16.3.2. Usage examples
16.4. PAM Essentials
16.4.1. Facilities and primitives
16.4.2. Modules
16.4.3. Chains and policies
16.4.4. Transactions
16.5. PAM Configuration
16.5.1. PAM policy files
16.5.2. Breakdown of a configuration line
16.5.3. Policies
16.6. PAM modules
16.6.1. Common Modules
16.6.2. FreeBSD-specific PAM Modules
16.6.3. NetBSD-specific PAM Modules
16.7. PAM Application Programming
16.8. PAM Module Programming
16.9. Sample PAM Application
16.10. Sample PAM Module
16.11. Sample PAM Conversation Function
16.12. Further Reading
17. Tuning NetBSD
17.1. Introduction
17.1.1. Overview
17.2. Tuning Considerations
17.2.1. General System Configuration
17.2.2. System Services
17.2.3. The NetBSD Kernel
17.3. Visual Monitoring Tools
17.3.1. The top Process Monitor
17.3.2. The sysstat utility
17.4. Monitoring Tools
17.4.1. fstat
17.4.2. iostat
17.4.3. ps
17.4.4. vmstat
17.5. Network Tools
17.5.1. ping
17.5.2. traceroute
17.5.3. netstat
17.5.4. tcpdump
17.6. Accounting
17.6.1. Accounting
17.6.2. Reading Accounting Information
17.6.3. How to Put Accounting to Use
17.7. Kernel Profiling
17.7.1. Getting Started
17.7.2. Interpretation of kgmon Output
17.7.3. Putting it to Use
17.7.4. Summary
17.8. System Tuning
17.8.1. Using sysctl
17.8.2. memfs & softdeps
17.8.3. LFS
17.9. Kernel Tuning
17.9.1. Preparing to Recompile a Kernel
17.9.2. Configuring the Kernel
17.9.3. Building the New Kernel
17.9.4. Shrinking the NetBSD kernel
18. NetBSD Veriexec subsystem
18.1. How it works
18.2. Signatures file
18.3. Generating fingerprints
18.4. Strict levels
18.5. Veriexec and layered file systems
18.6. Kernel configuration
19. Bluetooth on NetBSD
19.1. Introduction
19.2. Supported Hardware
19.3. System Configuration
19.4. Human Interface Devices
19.4.1. Mice
19.4.2. Keyboards
19.5. Serial Connections
19.6. Audio
19.6.1. SCO Audio Headsets
19.6.2. SCO Audio Handsfree
19.7. Object Exchange
19.8. Troubleshooting
20. Console drivers
20.1. wscons
20.1.1. wsdisplay
20.1.2. wskbd
20.1.3. wsmouse
20.2. pccons
21. Miscellaneous operations
21.1. Creating a custom install/boot floppies for i386
21.2. Synchronizing the system clock with NTP
21.3. Installing the boot manager
21.4. Deleting the disklabel
21.5. Speaker
21.6. Forgot root password?
21.7. Adding a new hard disk
21.8. Password file is busy?
21.9. How to rebuild the devices in /dev
IV. Networking and related issues
22. Introduction to TCP/IP Networking
22.1. Audience
22.2. Supported Networking Protocols
22.3. Supported Media
22.3.1. Serial Line
22.3.2. Ethernet
22.4. TCP/IP Address Format
22.5. Subnetting and Routing
22.6. Name Service Concepts
22.6.1. /etc/hosts
22.6.2. Domain Name Service (DNS)
22.6.3. Network Information Service (NIS/YP)
22.6.4. Other
22.7. Next generation Internet protocol - IPv6
22.7.1. The Future of the Internet
22.7.2. What good is IPv6?
22.7.3. Changes to IPv4
23. Setting up TCP/IP on NetBSD in practice
23.1. A walk through the kernel configuration
23.2. Overview of the network configuration files
23.3. Connecting to the Internet with a modem
23.3.1. Getting the connection information
23.3.2. resolv.conf and nsswitch.conf
23.3.3. Creating the directories for pppd
23.3.4. Connection script and chat file
23.3.5. Authentication
23.3.6. pppd options
23.3.7. Testing the modem
23.3.8. Activating the link
23.3.9. Using a script for connection and disconnection
23.3.10. Running commands after dialin
23.4. Creating a small home network
23.5. Setting up an Internet gateway with IPNAT
23.5.1. Configuring the gateway/firewall
23.5.2. Configuring the clients
23.5.3. Some useful commands
23.6. A common LAN setup
23.7. Connecting two PCs through a serial line
23.7.1. Connecting NetBSD with BSD or Linux
23.7.2. Connecting NetBSD and Windows NT
23.7.3. Connecting NetBSD and Windows 95
24. The Internet Super Server inetd
24.1. Overview
24.2. What is inetd?
24.3. Configuring inetd - /etc/inetd.conf
24.4. Services - /etc/services
24.5. Protocols - /etc/protocols
24.6. Remote Procedure Calls (RPC) - /etc/rpc
24.7. Allowing and denying hosts - /etc/hosts.{allow,deny}
24.8. Adding a Service
24.9. When to use or not to use inetd
24.10. Other Resources
25. The Domain Name System
25.1. DNS Background and Concepts
25.1.1. Naming Services
25.1.2. The DNS namespace
25.1.3. Resource Records
25.1.4. Delegation
25.1.5. Delegation to multiple servers
25.1.6. Secondaries, Caching, and the SOA record
25.1.7. Name Resolution
25.1.8. Reverse Resolution
25.2. The DNS Files
25.2.1. /etc/namedb/named.conf
25.2.2. /etc/namedb/localhost
25.2.3. /etc/namedb/zone.127.0.0
25.2.4. /etc/namedb/diverge.org
25.2.5. /etc/namedb/1.168.192
25.2.6. /etc/namedb/root.cache
25.3. Using DNS
25.4. Setting up a caching only name server
25.4.1. Testing the server
26. Mail and news
26.1. postfix
26.1.1. Configuration of generic mapping
26.1.2. Testing the configuration
26.1.3. Using an alternative MTA
26.2. fetchmail
26.3. Reading and writing mail with mutt
26.4. Strategy for receiving mail
26.5. Strategy for sending mail
26.6. Advanced mail tools
26.7. News with tin
27. Introduction to the Common Address Redundancy Protocol (CARP)
27.1. CARP Operation
27.2. Configuring CARP
27.3. Enabling CARP Support
27.4. CARP Example
27.5. Advanced CARP configuration
27.6. Forcing Failover of the Master
28. Miscellaneous networking topics
28.1. Bridge
28.1.1. Bridge example
28.2. Network File System (NFS)
28.2.1. NFS setup example
28.3. Setting up NFS automounting for /net with amd(8)
28.3.1. Introduction
28.3.2. Actual setup
28.4. IPv6 Connectivity & Transition via 6to4
28.4.1. Getting 6to4 IPv6 up & running
28.4.2. Obtaining IPv6 Address Space for 6to4
28.4.3. How to get connected
28.4.4. Security Considerations
28.4.5. Data Needed for 6to4 Setup
28.4.6. Kernel Preparation
28.4.7. 6to4 Setup
28.4.8. Quickstart using pkgsrc/net/hf6to4
28.4.9. Known 6to4 Relay Routers
28.4.10. Tunneling 6to4 through an IPFilter firewall
28.4.11. Conclusion & Further Reading
V. Building the system
29. Obtaining the sources
29.1. Preparing directories
29.2. Terminology
29.3. Downloading tarballs
29.3.1. Downloading a NetBSD release
29.3.2. Downloading snapshots from a NetBSD stable branch
29.3.3. Downloading the NetBSD-current development branch
29.3.4. Downloading a pkgsrc-200xQy stable branch
29.3.5. Downloading the pkgsrc-current development branch
29.4. Fetching by CVS
29.4.1. Getting CVS
29.4.2. Fetching a NetBSD release
29.4.3. Fetching a NetBSD stable branch
29.4.4. Fetching the NetBSD-current development branch
29.4.5. Fetching a pkgsrc-200xQy stable branch
29.4.6. Fetching the pkgsrc-current development branch
29.4.7. Saving some cvs(1) options
29.5. Sources on CD (ISO)
30. Crosscompiling NetBSD with build.sh
30.1. Building the crosscompiler
30.2. Configuring the kernel manually
30.3. Crosscompiling the kernel manually
30.4. Crosscompiling the kernel with build.sh
30.5. Crosscompiling the userland
30.6. Crosscompiling the X Window System
30.7. Changing build behaviour
30.7.1. Changing the Destination Directory
30.7.2. Static Builds
30.7.3. Using build.sh options
30.7.4. make(1) variables used during build
31. Compiling the kernel
31.1. Requirements and procedure
31.2. Installing the kernel sources
31.3. Creating the kernel configuration file
31.4. Building the kernel manually
31.4.1. Configuring the kernel manually
31.4.2. Generating dependencies and recompiling manually
31.5. Building the kernel using build.sh
31.6. Installing the new kernel
31.7. If something went wrong
32. The package collection
A. Information
A.1. Where to get this document
A.2. Guide history
B. Contributing to the NetBSD guide
B.1. Translating the guide
B.1.1. What you need to start a translation
B.1.2. Writing XML/DocBook
B.2. Sending contributions
B.3. XML/DocBook template
C. Getting started with XML/DocBook
C.1. What is XML/DocBook
C.2. Installing the necessary tools
C.3. Using the tools
C.4. Language-specific notes
C.4.1. Enabling hyphenation for the Italian language
C.5. Links
D. Acknowledgements
D.1. Original acknowledgements
D.2. Current acknowledgements
D.3. Licenses
D.3.1. Federico Lupi's original license of this guide
D.3.2. Networks Associates Technology's license on the PAM article
D.3.3. Joel Knight's license on the CARP article
E. Bibliography
Bibliography

List of Figures

2.1. Partitions
3.1. Selecting the language
3.2. The main menu of the installation program
3.3. Confirming you want to install NetBSD
3.4. Choosing a hard disk
3.5. Full or custom installation
3.6. Selecting distribution sets
3.7. Choosing the partitioning scheme
3.8. Choosing a unit of measure
3.9. fdisk
3.10. Partition options
3.11. Installing the boot selector
3.12. Choosing if partitions should be edited
3.13. Setting partition sizes
3.14. The disklabel editor
3.15. The disklabel editor
3.16. Naming the NetBSD disk
3.17. Last chance before hitting the disk
3.18. Creating the filesystems
3.19. Selecting a bootblock
3.20. Choosing the verbosity of the extraction process
3.21. Installation media
3.22. CD-ROM/DVD installation
3.23. Which network interface to configure
3.24. Choosing network media options
3.25. Using DHCP for network configuration
3.26. Entering and configuring network data
3.27. Confirming network parameters
3.28. Which directory to use for downloading
3.29. Defining the set's source place
3.30. An error happened during download
3.31. Downloading installation sets
3.32. Extracting set files
3.33. Deleting sets after extraction?
3.34. Set extraction completed
3.35. Selecting your system's time zone
3.36. Selecting a password encryption scheme
3.37. Setting the root password now or later?
3.38. Setting the root password
3.39. Choosing a shell for the root account
3.40. Congratulations
3.41. Reboot the system to finish installation
15.1. RAID-1 Disk Logical Layout
15.2. Perform generic install onto Disk0/wd0
15.3. Setup RAID Set
15.4. Reboot using Disk1/wd1 of RAID
15.5. Mirror Disk1/wd1 back to Disk0/wd0
15.6. Award BIOS i386 Boot Disk1/wd1
15.7. Award BIOS i386 Boot Disk0/wd0
22.1. IPv4-addresses are divided into more significant network- and less significant hostbits
22.2. Our demo-network
22.3. Attaching one subnet to another one
22.4. IPv6-addresses are divided into more significant network- and less significant hostbits, too
22.5. IPv6-addresses have a similar structure to class B addresses
22.6. Several interfaces attached to a link result in only one scope ID for the link
23.1. Network with gateway
26.1. Structure of the mail system
28.1. A frequently used method for transition is tunneling IPv6 in IPv4 packets
28.2. 6to4 derives an IPv6 from an IPv4 address
28.3. Request and reply can be routed via different gateways in 6to4
28.4. Enabling packet forwarding is needed for a 6to4 router

List of Tables

16.1. PAM chain execution summary
18.1. Veriexec fingerprints tools
18.2. Veriexec access type aliases

List of Examples

11.1. /etc/printcap
11.2. /usr/local/libexec/lpfilter
11.3. /etc/printcap
11.4. /usr/local/libexec/lpfilter-ps
23.1. resolv.conf
23.2. nsswitch.conf
23.3. Connection script
23.4. Chat file
23.5. Chat file with login
23.6. /etc/ppp/options
23.7. ppp-start
23.8. ppp-stop
23.9. /etc/hosts
25.1. strider's /etc/hosts file
25.2. localhost
29.1. .cvsrc