Contents Introduction to the text version i Preface xxxiii The second edition xxxiii Conventions used in this book xxxiv Describing the keyboard xxxv Acknowledgements xxxvi Book reviewers, first edition xxxvi Book reviewers, second edition xxxvii How this book was written xxxviii Chapter 1: Introduction 1 How to use this book 1 FreeBSD features 5 A little history 8 Other free UNIX-like operating systems 10 FreeBSD and Linux 10 Other documentation on FreeBSD 12 Reading the handbook 13 The online manual 15 GNU info 17 The FreeBSD community 17 Support 17 Reporting bugs 18 The Berkeley daemon 18 Chapter 2: Before you install 23 Hardware requirements 23 Laptops 24 Drivers 24 The CD-ROM distribution 27 The Installation CD-ROM 28 The Live File System 30 The CVS Repository 30 The Ports Collection 30 PC hardware 31 How the system detects hardware 31 Disks 33 PC BIOS and disks 34 Logical and physical disk drives 35 Making the file systems 40 Using a boot manager 40 Interaction with MS-DOS 41 Sharing a disk with MS-DOS 41 Using compressed MS-DOS file systems from FreeBSD 41 Running MS-DOS binaries under FreeBSD 42 IDE disks 42 Chapter 3: Quick Installation 45 Making things easy for yourself 45 FreeBSD alone on the disk 47 Installing XFree86 48 FreeBSD shared with MS-DOS 49 Chapter 4: Installing FreeBSD 51 Preparing the data for installation 51 Preparing a boot floppy 51 Creating floppies for a floppy installation 53 Installing via FTP 54 Installing via NFS 55 Installing from a MS-DOS partition 56 Installing from tape 56 Installing from a FreeBSD partition 56 Booting the install kernel 57 Booting from CD-ROM 57 Booting from floppy 57 Installing from a running MS-DOS system 58 Boot messages 58 UserConfig: Modifying the boot configuration 60 Starting UserConfig from hard disk 62 Probing the hardware 63 Using sysinstall 67 Kinds of installation 67 Creating space on disk 68 Specifying disk labels 72 Selecting distributions 76 Selecting the installation medium 78 Installing via FTP 78 Installing via NFS 79 Installing from floppy disk 79 Performing the installation 79 Network services 81 Setting up network interfaces 81 Other network options 82 Machine Configuration 82 Rebooting the new system 82 Where to put /var and /tmp 83 Upgrade installation 84 Changing configuration 84 Installing additional software 84 Chapter 5: Shared OS Installation 85 Repartitioning with FIPS 85 Repartitioning--an example 87 Installing FreeBSD on a second partition 91 Chapter 6: Installation Problems 95 If things go wrong 95 Problems with CD-ROM installation 95 Install tries to install from floppy 96 Device timeout on ed Ethernet boards 96 Devices at IRQ 9 don't work 96 Can't boot 97 Can't find correct geometry 97 Kernel doesn't find Matsushita/Panasonic CD-ROM 98 Can't install from tape 98 System hangs during boot 99 Root file system fills up 100 Panic 100 Fixit: fixing a broken installation 102 Chapter 7: The Ports Collection 103 How to install a package 104 Building a port 105 Installing ports during system installation 105 Install ports from the first CD-ROM 105 Installing ports from the ports CD-ROM 106 Ports via FTP 106 What's in that port? 108 Ports via CVSup 109 Getting the source archive 109 Building the port 110 Port dependencies 110 Getting common software 111 Maintaining ports 112 Submitting a new port 114 Chapter 8: Setting up X11 115 For the impatient 115 Installing XFree86 115 The XFree86 distribution 116 The X Server 116 Installing XFree86 manually 118 Assigning a virtual terminal to X 120 Configuring X for Your Hardware 121 Identifying the hardware 121 Running xf86config 122 Chapter 9: XFree86 configuration in depth 135 X configuration: the theory 135 How TVs and monitors work 135 How monitors differ from TVs 137 How to fry your monitor 138 The CRT controller 139 The XF86Config mode line 141 XF86Config 145 The Files section 145 The Keyboard section 146 The Pointer section 147 The Device section 149 Configuring the Monitor and its Modes 152 The Monitor section 152 The Screen section 154 Chapter 10: Making friends with FreeBSD 157 Users and groups 158 Choosing a user name 160 Adding users 160 Adding or changing passwords 162 The super user 163 Login classes 164 Referring to other classes 166 Using login classes 167 Using the shell 167 Command line editing 169 Environment variables 174 Shell startup files 177 Changing your shell 178 Processes 180 What processes do I have running? 180 What processes are running? 181 top 183 Daemons 183 cron 184 Stopping processes 185 Single user mode 186 Shutting down the system 188 Rebooting 189 Starting the system 189 Timekeeping 190 The TZ environment variable 191 Keeping the correct time 191 Chapter 11: File systems 193 File systems 193 Permissions 193 Directory structure 200 FreeBSD devices 203 Creating new device nodes 204 File system types 207 Mounting file systems 207 Unmounting file systems 209 Overview of FreeBSD devices 209 Virtual terminals 212 Pseudo-terminals 213 Chapter 12: Disks 215 Adding a hard disk 215 Disk hardware installation 216 Formatting the disk 218 Using sysinstall 219 Doing it the hard way 222 Creating a partition table 222 Labelling the disk 229 Disklabel 230 Things that can go wrong 236 Creating the file systems 237 Editing disk labels 238 Mounting the file systems 239 Recovering from disk data errors 239 Chapter 13: Tapes, backups and floppy disks 241 Backing up your data 241 What backup medium? 241 Tape devices 242 Backup software 242 tar 243 Using floppy disks under FreeBSD 246 Formatting a floppy 247 File systems on floppy 248 Microsoft file systems 250 Other uses of floppies 251 Accessing Microsoft floppies 252 Chapter 14: Printers 255 Printer configuration 256 Testing the printer 256 Configuring /etc/printcap 257 Spooler filters 258 Starting the spooler 260 Testing the spooler 260 Troubleshooting 261 Using the spooler 262 Removing print jobs 263 PostScript 264 Installing ghostscript and ghostview 265 Viewing with ghostview 265 Printing with ghostscript 266 Chapter 15: Setting up your FreeBSD desktop 269 The hardware 269 The display board and monitor 269 The keyboard 270 The mouse 270 Running X 271 Configuring xdm 271 Running xinit 272 Stopping X 272 Changing screen resolution 272 Selecting pixel depth 273 Customizing X 273 Navigating the desktop 276 Mouse menus 276 Mouse key functions on the root window 278 Use of colour 279 Network windowing 279 Installing the sample desktop 280 The shell 281 The Emacs editor 281 Chapter 16: Rebuilding the kernel 285 Configuring I/O devices 286 The kernel build directory 286 The Configuration File 288 Naming the kernel 296 Kernel Options 298 Networking 301 Network interfaces 302 Network interfaces 304 Console, Bus Mouse, and X Server 305 Mice and Serial and Parallel Ports 307 Basic Controllers and Devices 309 Disk controllers 311 SCSI Device Support 314 SCSI options 315 SCSI host adapters 316 File system Options 317 Sound boards 319 Pseudo-devices 321 Joystick, PC Speaker, Miscellaneous 322 Building and installing the new kernel 324 Making Device Nodes 327 Chapter 17: Keeping up to date with FreeBSD 329 FreeBSD releases 329 FreeBSD-RELEASE 329 FreeBSD-STABLE 329 FreeBSD-CURRENT 330 The repository 331 Getting updates from the net 332 How to get the updates 333 CVSup 333 Which CVSup server? 335 Running cvsup 335 Other possible cvsupfiles 335 CTM 336 Getting deltas by mail 338 Getting deltas with ftp 339 Creating the source tree 339 The tags 340 Updating an existing tree 343 Making a new world 343 Putting it all together 346 Living with FreeBSD-CURRENT 347 ps doesn't work any more! 348 Build kernels with debug symbols 348 Solving problems in FreeBSD-CURRENT 349 Problems with CVS 350 Can't find directory 350 Chapter 18: Emulating other operating systems 351 Emulating Linux 352 Running the Linux emulator 352 Installing the Linux libraries 353 SCO UNIX emulation 353 Emulating Microsoft Windows 354 Chapter 19: Networks and the Internet 355 Network layering 357 The link layer 358 The network layer 360 The transport layer 360 Port assignment and Internet services 362 The Internet daemon 364 Kinds of network connection 365 Ethernet 366 The reference network 371 Chapter 20: Configuring the local network 373 Network configuration with sysinstall 373 Manual network configuration 374 Setting the host name 374 Describing your network 375 Checking the interface configuration 376 The configuration files 377 What we can do now 377 Routing 377 Adding routes automatically 379 Adding routes manually 380 ISP's route setup 381 Looking at the routing tables 382 Flags 383 Packet forwarding 384 Configuration summary 384 Chapter 21: Connecting to the Internet 387 The physical connection 387 ISDN 388 Establishing yourself on the Internet 390 Which domain name? 391 Preparing for registration 391 Registering a domain name 392 Getting IP addresses 392 Choosing an Internet Service Provider 393 Who's that ISP? 393 Questions to ask an ISP 394 Making the connection 398 Chapter 22: Serial communications and modems 401 Terminology 402 Asynchronous and synchronous communication 402 Asynchronous communication 402 Synchronous communication 403 Serial ports 404 Connecting to the port 404 When can I send data? 406 Modems 407 Modem speeds 408 Data compression 409 The link speed 409 Dialling out 410 Modem commands 410 Dialling out manually 413 Dialing out--an example 414 Dialling in 416 Chapter 23: Configuring PPP 419 Quick setup 420 How PPP works 420 The interfaces 421 Dialling 421 Negotiation 422 Who throws the first stone? 422 Authentication 424 Which IP addresses on the link? 425 The net mask for the link 427 Static and dynamic addresses 427 Setting a default route 428 Autodial 428 The information you need to know 429 Setting up User PPP 429 The ppp configuration files 430 /etc/ppp/ppp.conf 431 Negotiation 432 Requesting LQR 433 Authentication 433 Dynamic IP configuration 434 Setting the default route 435 Default routes for dynamic addresses 436 Running User ppp 436 How long do we stay connected? 437 Automating the process 438 Configuration summary 439 Setting up Kernel PPP 440 Dialling 442 Who throws the first stone? 443 Authentication 443 Dynamic IP configuration 444 Setting the default route 444 Running Kernel PPP 444 Automating the process 445 Timeout parameters 445 Configuration summary 446 Dialin PPP 447 Chapter 24: UUCP and SLIP 450 Login authentication 450 Adding the users 451 UUCP 452 How UUCP works 453 Setting up UUCP 454 UUCP configuration files 454 Testing the connection 457 SLIP 460 What we need to know 460 Dialling out with SLIP 460 SLIP dialin 463 Putting it all together 466 Problems 468 Chapter 25: The Domain Name Service 469 Domains and zones 470 Zones 471 Setting up a name server 471 Passive DNS usage 471 Name server on a standalone system 472 Name server on an end-user network 474 The SOA record 474 The A records 475 The NS records 475 Nicknames 476 The MX records 476 The HINFO records 477 Putting it all together 477 Reverse lookup 478 The distant view: the outside world 479 The named.boot file 480 Secondary name servers 482 The next level up: delegating zones 483 china.example.org 483 example.org with delegation 484 Messages from named 486 DNS tools 487 nslookup 487 named-xfer 491 Checking DNS for correctness 492 Chapter 26: Firewalls and IP aliasing 493 Security and firewalls 493 ipfw: defining access rules 495 Actions 496 Writing rules 496 Configuration files 497 Trying it out 502 IP aliasing 502 IP aliasing software 502 natd 503 Choosing an IP address for the LAN 504 Chapter 27: Network debugging 505 Network debug tools 505 ping 505 traceroute 507 tcpdump 508 How to approach network problems 511 The link layer 511 The network layer 514 No connection 517 Transport and Application layers 520 Chapter 28: The Network File System 523 Setting up NFS 523 NFS 524 NFS client 524 Mounting remote file systems 525 Where to mount NFS file systems 527 Mounting NFS file systems automatically 528 NFS server 528 /etc/exports 529 Setup in /etc/rc.conf 530 NFS strangenesses 531 No devices 531 Just one file system 532 Chapter 29: Basic network access 533 telnet and rlogin 534 telnet 534 rlogin 535 rsh 537 Using telnet for other services 538 ftp and rcp 538 ftp 538 mget 540 prompt 541 reget 541 user 542 idle 543 rcp 543 telnet and ftp servers 543 anonymous ftp 545 Restricting access and logging 546 Secure interactive connections 548 What ssh does 548 Running ssh 550 Chapter 30: Electronic Mail 551 Electronic mail 551 Mail user agents 551 mail 552 Other MUAs 552 mutt 553 Replying to a message 555 How to send and reply to mail 556 mutt configuration 558 Mail aliases 558 Mail headers 559 Who gets the mail? 561 sendmail 562 Running sendmail at boot time 564 Talking to sendmail 564 Aliases revisited 565 Downloading mail from your ISP 566 POP: the Post Office Protocol 567 popper: the server 567 popclient: the client 568 Mailing lists: majordomo 569 Chapter 31: The World-Wide Web 571 Web browsers 571 Netscape 572 Running Netscape 573 Setting up a web server 573 Configuring apache 574 The configuration files 574 httpd.conf 574 Proxy web servers 575 Caching 576 Virtual Hosts 576 Running apache 577 Stopping apache 577 Chapter 32: HylaFAX 579 Setting up HylaFAX 579 Selecting a fax modem 580 Flow control 580 Choosing a tty Device 580 Using faxsetup to Configure a Server Machine 580 Using faxaddmodem to Configure Modems 582 Testing the modem 587 Starting HylaFAX 589 Checking fax system status 589 Restarting the hfaxd daemon 590 Sending a fax 590 The destination 591 The document 591 The cover sheet 591 How to omit the cover sheet 593 Chapter 33: Connecting to non-IP networks 595 Samba 595 Installing the samba software 596 smbd and nmdb: the Samba daemons 596 Running the daemons from inetd 597 The configuration file 598 The [global] section 598 The [homes] section 599 The [printers] section 599 Other sections: service descriptions 599 Creating the configuration file 600 Testing the installation 601 Displaying Samba status 603 adding_user 497 adduser 499 aliases 503 apropos 504 arp 505 BASH 507 boot 575 cal 578 calendar 580 cat 584 cdcontrol 586 cdplay 590 CHAT 592 chflags 600 chmod 602 cmp 605 comcontrol 607 comsat 609 cp 610 CPIO 613 cron 619 crontab 620 crontab 622 csh 625 CVS 632 date 656 dd 660 df 664 DIFF 666 DIFF3 672 disklabel 675 diskpart 679 disktab 681 dmesg 684 DNSQUERY 685 du 687 dump 689 ethers 694 exports 695 fdformat 698 fdisk 700 find 706 fingerd 713 fsck 715 fstab 719 ftp 722 ftpd 738 FVWM 744 getty 771 gettytab 773 GHOSTVIEW 780 GREP 799 group 803 GS 805 GZIP 812 hostname 819 hosts 820 hosts.equiv 821 ifconfig 823 inetd 827 inetd.conf 832 info 837 init 840 ipcrm 843 ipcs 844 ipfw 846 IPXrouted 853 kbdcontrol 855 ld.so 857 ln 860 login 862 login.conf 864 lpd 870 lpq 873 lpr 875 lprm 878 lptcontrol 880 ls 881 mail 885 mailq 897 MAJORDOMO 898 man 902 mesg 904 mkdir 905 mknod 906 modems 908 more 910 mount 914 mount_cd9660 919 mount_msdos 921 mount_nfs 924 mrouted 928 Mutt 936 mv 939 NAMED-XFER 941 NAMED 943 NAMED.RELOAD 950 natd 951 NDC 958 netstat 960 networks 964 newfs 965 nfsd 970 nfsiod 971 nfsstat 972 NMBD 973 NSLOOKUP 977 ntpdate 983 ntpq 985 ntptrace 992 passwd 994 phones 1003 ping 1004 pkg_add 1009 portmap 1014 ppp 1015 PPPD 1054 PPPSTATS 1074 printcap 1078 protocols 1083 ps 1084 pstat 1091 rarpd 1096 rcp 1098 RCS 1100 remote 1105 resolver 1107 rexecd 1110 .rhosts 1112 rlogin 1114 rm 1117 rmail 1119 rmdir 1120 route 1121 routed 1125 rpc 1134 rpc.lockd 1135 rpc.rquotad 1137 rpc.rstatd 1138 rpc.rusersd 1139 rpc.rwalld 1140 rpc.sprayd 1141 rpc.statd 1142 rpc.yppasswdd 1144 rpcgen 1148 rpcinfo 1153 rsh 1155 rshd 1157 RSTAT_SVC 1160 rup 1161 ruptime 1162 rwall 1163 rwho 1164 rwhod 1165 SAMBA 1168 savecore 1172 scsi 1174 scsiformat 1177 SEND-PR 1178 sendmail 1181 services 1189 sh 1190 shutdown 1213 sio 1215 slattach 1220 sliplogin 1224 SMB.CONF 1228 SMBCLIENT 1289 SMBRUN 1305 SMBSTATUS 1307 SMBTAR 1309 SORT 1311 spray 1314 SSH 1315 startslip 1329 STARTX 1332 stty 1334 su 1343 sysctl 1346 talkd 1350 tar 1351 TCPDUMP 1359 tcpslice 1376 telnet 1379 telnetd 1394 TESTPARM 1401 TESTPRNS 1403 tftp 1405 tftpd 1407 time 1409 timed 1410 TOP 1413 TRACEROUTE 1418 tty 1423 ttys 1424 tunefs 1426 TWM 1428 tzsetup 1453 umount 1454 uname 1456 uucico 1457 uucp 1461 uucpd 1464 uustat 1465 uux 1471 uuxqt 1475 VI 1477 vidcontrol 1499 vipw 1501 vmstat 1502 what 1505 whereis 1506 which 1508 who 1509 X 1510 XF86Config 1528 XF86_Accel 1541 XF86_Mono 1557 XF86_SVGA 1563 XF86_VGA16 1572 XFree86 1575 XINIT 1585 xntpd 1588 Appendix A: Terminology 1605 Appendix B: FreeBSD configuration files 1607 /etc/rc.conf 1607 Other configuration files 1613 /etc/aliases 1613 /etc/csh.cshrc, /etc/csh.login, /etc/csh.logout 1613 /etc/crontab 1613 /etc/daily 1613 /etc/disktab 1613 /etc/fstab 1614 /etc/gettytab 1616 /etc/group 1616 /etc/login.conf 1616 /etc/manpath.config 1616 /etc/master.passwd 1616 /etc/monthly 1616 /etc/motd 1616 /etc/passwd 1617 /etc/printcap 1617 /etc/profile 1617 /etc/pwd.db 1617 /etc/rc 1617 /etc/rc.i386 1617 /etc/rc.local 1617 /etc/rc.pccard 1618 /etc/rc.serial 1618 /etc/sendmail.cf 1618 /etc/shells 1618 /etc/spwd.db 1618 /etc/syslog.conf 1618 /etc/termcap 1618 /etc/ttys 1619 /etc/weekly 1620 Network configuration files 1620 /etc/exports 1620 /etc/rc.firewall 1620 /etc/ftpusers 1620 /etc/host.conf 1620 /etc/hosts 1621 /etc/hosts.equiv 1621 /etc/hosts.lpd 1622 /etc/inetd.conf 1622 /etc/named.boot 1622 /etc/networks 1622 /etc/protocols 1622 /etc/rc.network 1622 /etc/services 1623 Obsolete configuration files 1623 /etc/sysconfig 1623 /etc/netstart 1623 Appendix C: Command equivalents 1625 Appendix D: Contents of the Ports Collection 1629 Appendix E: Bibliography 1689 The 4.4BSD manuals 1689 Users' guides 1690 Administrators' guides 1690 Programmers' guides 1691 Hardware reference 1691 Resources on the net 1692 Appendix F: License agreements 1693 The Berkeley License 1693 The GNU General Public License 1695