|A d v e r t i s e m e n t
Following the recent inclusion of BSD distributions on DistroWatch, we are pleased to bring you our first BSD article - a review of the latest release of FreeBSD 5. In the first part of the story we will look at the history of BSD, compare BSD with Linux from a technical perspective, and talk about licensing considerations. The second part will bring you practical information about installing FreeBSD and its applications, followed by a handful of useful tweaks and configuration examples of various aspects of the operating system, such as the boot loader, PPP, PPPoE, firewall and printing. FreeBSD is a superb product. Even if you decide in the end that Linux serves your needs better, there is no reason not to enhance your experience with another open source UNIX and learn about many distinct qualities of the most popular BSD operating system in the process.
• Things are Not What They Seem...
• Scary Daemons
• In the beginning, there was UNIX...
• License Test
• Obtaining FreeBSD
• GRUB or GAG
• Post-Install Configuration
• Miscellaneous Tweaks
• Configuring PPP
• Configuring PPPoE
• Firewall Configuration
• The Ports Collection
• Print with CUPS
• The Final Word
|Things are Not What They Seem...
The first time I told my girlfriend that I had FreeBSD, she asked me if
it was contagious. Actually, in some ways it is. To judge from the
growing number of subscribers to the FreeBSD mailing lists, it is
definitely spreading. Although the Linux contagion has spread farther
and faster, FreeBSD looks like it's here to stay.
We are, of course, talking about an operating systems, not diseases
(even though Microsoft claims that Linux is "viral"). As the name
implies, FreeBSD is indeed free - you can download it and hand out free
copies to all and sundry without infringing anybody's copyright.
One point that needs to be clarified from the outset - FreeBSD is not a
Linux distro. Yes, on the surface, FreeBSD looks similar. You could, in
fact, kidnap a Linux geek and sit him or her down in front of a FreeBSD
box, and chances are he or she would happily play for days without
realizing that anything was amiss. Most of the usual Linux toys will
run fine on FreeBSD, including such perennial favorites as KDE, Gnome,
OpenOffice, Gimp, MPlayer, Mozilla, Mutt, Postfix, Perl, Python and
Emacs, to name a few.
Screenshot 1: FreeBSD with the KDE desktop
(full image size 304kB)
However, if our above-mentioned geek begins to dig deeper, it will soon
become apparent that something very strange is afoot. For example,
attempting to mount /dev/hda1 on the /windows directory fails - there
is no /dev/hda1 partition (but what is this weird /dev/ad0s1 thing?).
The Ethernet interface "eth0" appears to be missing, but there's one
called "vr0" - what is that? Also gone missing is the "modprobe"
command. Even more serious, vmlinuz is nowhere to be found - that is to
say, there is no Linux kernel! Finally, if our geek executes the
"uname" command, the truth will be revealed:
geek@sonic:~> uname -a
FreeBSD sonic.utopia.com 5.2-RELEASE FreeBSD 5.2-RELEASE #0: Fri
Feb 6 22:09:08 CST 2004
Despite the lack of a Linux kernel, most (but not all) Linux binaries
can be run on FreeBSD thanks to a special Linux compatibility package
(optionally) install. It's not foolproof, and a couple of my
favorite apps (Mailfilter, for example) refuse to compile. However, the
vast majority of Linux apps do work as expected.
So Linux gurus will find FreeBSD a piece of cake, right? If only. While
you can rest assured that Kmail will work as advertised, things begin
to get hairy once you dig down into that great morass known as "system
administration." On most Linux distros these days, everyday tasks like
setting up PPPoE or a firewall is a point-and-click operation that even
Grandma can manage, but on
FreeBSD expect to spend considerably more time at the command line.
I'll have more to say about the nitty gritty details of installation
and configuration below, but for now just keep it in mind that
administering a FreeBSD box is quite a different experience from what
you'll encounter with a typical Linux distro.
"Beastie," the FreeBSD mascot, is a daemon (not a demon), and FreeBSD's
motto is "the power to serve." Clearly, this is a server OS. Try an
experiment - perform a Google search on "web hosting". You'll find that
many web hosting services offer their customers a choice of three
server operating systems - Windows, Linux and FreeBSD. And
typically, web hosting on Linux or FreeBSD costs roughly half of what
it does for Windows.
Yes, Linux and FreeBSD are both major contenders in the server market,
and taken together their combined market share outstrips Windows.
However, it's a rather different story on the desktop, where Windows
still claims over 90% of the market. According to the pundits, Apple's
OSX occupies the No. 2 slot, followed by Linux (though Linux is gaining
fast and may soon overtake OSX).
By contrast, FreeBSD hardly registers a blip on the desktop radar
screen. This isn't to say that you can't run a FreeBSD desktop - plenty
of people do. It's just to say that this isn't FreeBSD's forte. You
might be able to to talk Aunt Tilley into trying Xandros, but you will
never get her to run FreeBSD - unless, of course, Aunt Tilley decides
to start a new career as a system administrator. The simple reality is
that most people who run FreeBSD as their desktop system are also the
same people who are very interested in networking.
|In the beginning, there was UNIX...
Given the similarities between FreeBSD and Linux, it's easy to assume
that they must have a similar history. In fact, the origins of these
two operating systems are significantly different.
Linux came into existence in 1991 when Linus Torvalds (then a college
student in Helsinki, Finland) started writing the Linux kernel. Later,
many others joined the effort to write the kernel and the "userland"
(that is, everything outside the kernel) but an important point to keep
in mind is that Linux is not UNIX. It could arguably be called a UNIX
clone because it resembles UNIX on the surface, but all the code was
written from scratch. And unlike UNIX, Linux never ran on mainframe
computers - it was developed on PCs. Linux source code has always been
free from day one.
FreeBSD, on the other hand, is a direct descendent from UNIX,
even though all the original UNIX code has been removed. UNIX itself
was never really free - it was the intellectual
property of AT&T. UNIX was born in 1969 - this was before PCs were
invented, so UNIX started as a mainframe OS. The earliest PCs (late
1970s) did not have hard drives or sufficient memory, so it wasn't
until the 1980s that UNIX was ported to PCs (SCO was a pioneer in this,
releasing XENIX which was later licensed to Microsoft).
UNIX eventually forked into two major flavors,
System III (later to become System V) , and Berkeley UNIX, a project of
the Computer Sciences Research Group of the University of California at
Berkeley (CSRG). This release was later dubbed the
"Berkeley Software Distribution," or BSD for short. In 1990, CSRG
released the BSD source code, excluding AT&T's proprietary code.
"open source" release was not usable (about 20% of the kernel was
missing), but William Jolitz wrote the remaining code and released it
in 1992 as 386BSD. At the same time, another group of ex-CSRG members
formed a commercial company called Berkeley Software Design Inc (BSDI),
releasing a beta version of an operating system called BSD/386.
AT&T was not pleased by the fact that CSRG
decided to release the source code into the public domain, and they
were even less amused by the commercial BSDI venture which appeared to
be a direct competitor. So in
filed a copyright infringement lawsuit against BSDI. While this legal
its way through the courts, 386/BSD basically disappeared and was
replaced by two new projects, FreeBSD and NetBSD, which were based on
the freely-released source code.
In what sounds almost like a forerunner to the SCO fiasco, it soon
became apparent that BSD no longer contained much, if any, AT&T
source code, but AT&T's UNIX was riddled with BSD code. During the
course of these events, AT&T sold their UNIX business to Novell,
and a settlement was reached in 1994.
The full details of this settlement have never been made public, but
some significant changes had to be made to the BSD code. All BSD
"vendors" (even though FreeBSD and NetBSD weren't selling anything) had
to agree to abandon what was then known as 4.3BSD-Lite and migrate to a
new version, 4.4BSD-Lite - the basis all the current BSDs
that exist today.
Shortly thereafter, Novell decided to exit the UNIX business. The UNIX
trademark was transferred to The
Open Group and the UNIX System V source code and the product
implementation (UNIXWARE) was sold to SCO. Thus, the BSDs as they exist
today have their historical roots in UNIX, but are not UNIX in the
FreeBSD can rightfully claim to
be the most popular of the BSDs at the moment, with a (rough guess) 80%
market share. Among the BSDs, FreeBSD is notable for its high
performance as a network operating system. Although originally designed
for i386 processors, there are FreeBSD ports for Sun UltraSPARC, Alpha
and AMD64, plus a (not yet completed) PowerPC port.
NetBSD is the oldest BSD (version 0.8 release was released in April
1993, about six months before the first FreeBSD). Though originally an
i386 OS, it's main claim to fame now is that it has been ported
to over 50 different platforms. NetBSD forked in 1995 to create
OpenBSD. The main
goal of OpenBSD is ironclad security.
Here's a neat little experiment. If you're sitting at a dual-boot
machine with Windows and Linux installed, mount your Windows partition
and search for strings (that is, ascii text) in file ftp.exe - for
root@sonic# mount /windows
root@sonic# cd /windows/WINDOWS/system32#
root@sonic:/windows/WINDOWS/system32# strings ftp.exe | grep
@(#) Copyright (c) 1983 The Regents of the University of
Yes, you are reading that correctly - Microsoft's ftp program contains
a copyright notice from the University of California. This is not
because Microsoft has bought the University of California (not yet,
anyway), but rather because the code in ftp.exe was copied from BSD.
This is perfectly legal. Apple has also imported plenty of BSD code -
much of the UNIX userland of OSX is copied from FreeBSD. Linux also has
pieces of BSD scattered throughout. Ditto for SCO - indeed, many say
that the source code which SCO claims that Linux "stole" from UNIX is
in fact BSD
code that SCO itself "borrowed" long ago.
The BSD license is dead simple - it allows anybody to use BSD code as
they see fit. Copyright for the code still remains with the original
authors, but the only restriction the BSD license implies is that it
does not permit you to turn around and claim that you wrote the code
yourself (SCO take note). Developers who import BSD-licensed code have
to acknowledge the original authors which is what Microsoft has done in
ftp.exe. The downside to this (though not everyone agrees that it's a
downside) is that Microsoft, Apple and SCO can take FreeBSD code -
which is open source and free - and turn it into a closed-source
proprietary product, without giving back anything in return.
The situation with Linux is significantly different. Linux adheres to
the General Public License (GPL), sometimes known as "copyleft." GPL'd
code is open source and free, but comes with a catch - if you use it to
build a new program, you have to give away the source code of your new
program and license it under the GPL. This insures that all derivative
works will remain free - you might call it the "share and share alike"
philosophy. And this is what Microsoft meant when it called the GPL
Because of the GPL, BSD developers avoid using Linux code even though
it's available to them for free. Most importantly, they keep Linux
source out of the kernel. However, there are some compromises to this
"rule". You can (optionally) add Linux source if you recompile the BSD
kernel yourself - there is, for example, an option to add support for
the Linux ext2 file system. However, outside of these few options, the
BSD kernel is GPL-free. The same is true for the BSD "userland" (the
BSD goodies outside of the kernel). On the other hand, if you enable
"Linux binary compatibility," you can (and almost certainly will)
install a whole bunch of Linux binaries on top of the BSD kernel. A
typical BSD box has plenty of GPL applications running on it.
For the end user, the license isn't (or at least, it shouldn't be) an
issue. Linux or BSD, it's free software either way. The license becomes
more of an issue if you happen to be a developer. Advocates of the BSD
license like to say that their license is freer, while GPL advocates
will say that their license ensures that free software remains free. I
won't take sides in the debate, but if you want to start a flamefest,
just wander into an online chat room and ask, "Which is better, the GPL
or the BSD license?"
Although FreeBSD can be installed over a network (you would expect that
from a network OS, wouldn't you?), the most common installation method
is by CDROM. If you have broadband, you'll probably want to download
the ISO files - go to http://www.freebsd.org/ to find details of
mirrors. If you lack broadband, quite a few online vendors such as
LinuxCD.org sell CDRs for around US$6 for a set of two. In fact, only
the first CD is needed for installation (there is an amazing amount of
software crammed onto it!). The second disk is a rescue CD. Be aware
that there are also two other available ISOs that most users don't need
- a "bootonly" (for network installs) and "miniinst" (installs a
For approximately US$40, you can purchase an "official" 4-CD set. The
two additional CDs have some extra binaries which are available online
for free, but the 4-CD set could save you some downloading time if you
need those particular applications. See the FreeBSD.org web site for
information on places that sell the 4-CD sets.
Regardless of where you obtain the software, a major issue that you'll
have to decide from the outset is which version to install. At the
moment, there are two main branches, the "production branch" (or 4.x
series), and "new technology branch" (5.x series). Excluding beta
releases, the most up-to-date versions are Production Release 4.9 and
New Technology Release 5.2.1. The names are self-descriptive - if you
are going to install FreeBSD in a production environment exposed to the
full ravages of the Internet, it's safer to go with the 4.x series. If
you want to play with the newest technology, go for the 5.x release.
You should not make the mistake of thinking that the 5.x series has
more up-to-date applications than 4.x - KDE, for example, will be the
same in both series. Rather, the differences are more subtle. For
example, the 5.x series has more hardware drivers, support for
encrypted file systems, the DevFS, SMP support, greater scalability,
For the purpose of this review, I decided to go with 5.2.1 because I
wanted to play with the new toys. But if I decided to deploy FreeBSD on
a mission critical server, I'd go with 4.9 for now. At some point in
the future, the developers will pronounce the 5.x series ready for
combat and the 4.x series will be retired, but that day has not yet
You might be tempted to pop CD No. 1 into the
drive, boot, and start installing. However, you should first take a
moment to analyze just what is currently residing on your hard drive.
Unfortunately, all the BSDs are a little bit fussy about where they can
reside. In particular, they insist on being installed in a primary
partition. This can be an issue, because on x86 PCs, each hard disk can
only accommodate a maximum of four primary partitions, or three primary
partitions and one extended partition (but the extended partition can
hold up to 64 logical partitions). I'd recommend a primary partition of
about 5GB or so for a full FreeBSD install (80 MB is minimal, but you
won't get much joy from it). If you want to set up a multi-boot system
with several operating systems, meditate for awhile about your hard
partitioning scheme before you begin - it's hard to make changes later.
So without further ado, boot the CD. FreeBSD's installer - named
"Sysinstall" - should come up. As you might expect from a network OS,
it's a text-mode installer. However, the menus are reasonably easy to
follow, and anybody with a geek orientation shouldn't find it too
Screenshot 2: Sysinstall
Nevertheless, be prepared for some surprises. Hard disk partitioning
will be your first hurdle, and FreeBSD does not
name its partitions in Linux fashion. In Linux lingo, the first ATA
(IDE) drive on a system is traditionally named /dev/hda - in FreeBSD
this will be
/dev/ad0. For SCSI drives, Linux terminology is /dev/sda, but FreeBSD
prefers /dev/da0. In Linux, an ATAPI CD drive could be /dev/hdb,
/dev/hdc or /dev/hdd depending on how it's connected to the
motherboard, but on FreeBSD the first ATAPI CD will be /dev/acd0 and
second (if it exists) will be /dev/acd1. Another little surprise is
that partitions on hard drives are called "slices" and designated "s1,
s2," and so on, so the first partition on the first IDE drive would be
/dev/ad0s1 and the second would be /dev/ad0s2.
Screenshot 3: The Fdisk partition editor
One thing that might bite you with the partitioning tool is the
notorious "geometry bug" which has plagued FreeBSD for a long time. You
an error message during the partitioning process advising you of
"incorrect geometry" and asking you to type the real one. When you are
at the screen called the "Fdisk partition editor", hit "g" (for "set
drive geometry") - this should automatically correct the problem
without you having to type in the numerical values. If you don't make
this correction, FreeBSD will most likely install fine, but your hard
disk will have a geometry error (which means that the operating system
thinks the hard disk is a different size than it really is). Although
not a fatal error, if you later install Linux on the hard drive, the
installer might notice the geometry error and abort, which could be
frustrating and has been known to cause users to start banging their
head against the wall (note that a concussion can ruin
your whole day). Hopefully, this bug will be quashed soon.
Screenshot 4: The notorious geometry bug
Once you have finished partitioning, you'll be asked about installing
the FreeBSD boot manager. You are offered three options:
1) BootMgr - Install the FreeBSD boot manager
2) Standard - Install a standard MBR (no boot
3) None - Leave the Master Boot Record untouched
Screenshot 5: To boot
or not to boot, that is the question
It's a trick question. If you bravely want to give your entire hard
disk to FreeBSD, then choose No. 2. If, on the other hand, you want to
share the hard drive with Windows, choose No. 1 - this way, every time
you boot, you'll be presented with a menu to boot the OS of your
choice. However, for my purposes, I much prefer No. 3 - I have several
Linux distros on my hard drive, and I want to use GRUB as my boot
manager. GRUB does not come with FreeBSD mainly because it cannot read
the FreeBSD file system and thus cannot be installed on FreeBSD
partitions (but it can still boot FreeBSD - more on that later).
The next screen is called the "FreeBSD Disklabel Editor." This is
another surprise - it allows you to sub-partition your primary
partitions - that is, up to eight sub-partitions can be created within
each primary partition! Neither Linux nor Windows supports such a
scheme - this is a BSD-only thing. Thus, /dev/ad0s1 can have
/dev/ad0s1a, /dev/ad0s1b, and so on up to /dev/ad0s1h. These
sub-partitions are called (confusingly) "partitions" (and remember,
what Linux calls "partitions" are called "slices" in BSD lingo).
Screenshot 6: Disklabel editor
Notice the option at the bottom of the screen: "A=Auto Defaults".
Unless you're feeling adventurous, I suggest you just hit "a" on your
keyboard and let FreeBSD create the sub-partitions for you.
Notice another option at the bottom of the screen: "S=Toggle
SoftUpdates." Soft updates is meant to enhance file system performance,
and by default it will be turned on for
each partition - it's probably best if you leave it like that. The
only reason you might want to turn it off would be to maintain backward
compatibility with older versions of FreeBSD (4.1 and earlier). Note
that there is no option to install Linux file systems such as ReiserFS
or ext3 - FreeBSD installs to its own file system and no others.
Now that your hard disk has been diced and sliced, you get to choose
just what packages you'd like to install. If you're new to FreeBSD and
want to explore, the easiest thing to do is choose "All - All system
sources, binaries and X Window system". This will give you lots of toys
to play with.
Screenshot 7: Choosing
I won't go through every detail of every option that you can choose at
this point. Presumably, if you've gotten this far, you'll be able to
figure out the rest of the installation. The menus are, for the most
|GRUB or GAG
I mentioned above that I have a whole slew of Linux distros on my hard
drive, and I prefer to boot them with the Grand Unified Boot Loader,
otherwise known as GRUB. If you already have GRUB installed, adding
FreeBSD to the list of boot options is very easy. The GRUB
configuration file should reside on one of your Linux partitions in
file /boot/grub/menu.lst. You only need to edit this file and add three
lines like this:
The only tricky part here is knowing what to put on the second line.
The stuff between the parentheses, (hd0,1,a) is GRUB lingo for "the
first hard drive, second partition, first sub-partition." You will have
to tweak these settings to match the location where you installed
FreeBSD. As long as you've got the syntax right, there's nothing else
Reboot, and the FreeBSD boot option should be available to you.
Alternatively, a lot of people prefer to boot FreeBSD with GAG. This is
a very user-friendly boot manager that will bring a smile to your face.
You can download it from http://gag.sourceforge.net/ - try it on a
floppy disk first to see if you like it.
If all of the above went well, FreeBSD should boot up and you'll find
yourself staring at the login prompt. Login as "root" - if you haven't
yet set a root password, set it now with the "passwd" command. Log-out
(by typing "exit" and log back in again as root to make sure your
password works as expected.
So you're logged in as root at the command line - what next? One nice
little feature of FreeBSD is that the installer - Sysinstall - can
be relaunched at any time from the command line (only if you're root,
of course). Sysinstall can be used for general system configuration.
You'll probably want to do this right now to configure Xwindows, set up
user accounts and networking.
Screenshot 8: Post-install configuration
So type "sysinstall" on the command line and select the menu item that
says "Configuration." You'll probably want to toggle down to where it
says "Configure XFree86 Server". One note of caution here - in every
attempt I've made to configure X under FreeBSD, I'm always given a
message at the end of the procedure that my configuration failed and
I'm asked if I would like to try again. If I do try again, I'm always
told that the configuration failed, again and again, ad nauseum. The
interesting thing is that the configuration DIDN'T fail. All I've got
to do is exit Sysinstall and I find that I can indeed start X by typing
"startx" at the command line. So I guess the motto is, "Don't believe
everything you read."
Screenshot 9: Configuring X
When you have finished playing with Sysinstall and
you've configured X, there are still a few other things you might
consider tweaking. I am not happy with the slow default key-rate in
FreeBSD, and I prefer Emacs to Vi, so I add two lines to FreeBSD's
master configuration file /etc/rc.conf, as follows:
In the proud UNIX tradition, the default shell in FreeBSD is the
C shell, but Linux refugees will no doubt feel more at home with Bash.
You can see the available installed shells in file /etc/shells:
root@sonic:~> cat /etc/shells
# $FreeBSD: src/etc/shells,v 1.5 2000/04/27 21:58:46 ache Exp $
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
(Note: Bash will be there only if you installed it. If it's not there,
pop your CD back in the drive, start Sysinstall, and follow the menus:
Configure--> Packages--> CD/DVD--> Shells--> Bash.)
The "chsh" command is used to change shells, and has this syntax:
chsh [-s newshell] [user]
So for me, as root I would type:
chsh -s /usr/local/bin/bash robert
Now that my shell has been changed to Bash, I want to install a few of
my own user tweaks. Normally such tweaks go in file ~/.bashrc, but
there is no such file by default, so you need to create it with an
editor. I put the following lines in my ~./bashrc:
PS1="\u@\h:\w> " export PS1
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
set -o noclobber
alias startx='startx -- -dpi 100'
The first two lines give me an informative prompt. The next three
aliases prevent me from accidentally deleting or overwriting a file
with the rm, cp and mv commands respectively. The "set -o noclobber" is
similar - it will prevent you from overwriting a file with "cat" for
example. My "alias startx" option gives me larger than normal fonts in
menus under Xwindows (easier on my tired eyes).
Next I turn my attention to file ~/.profile. This file already exists -
I don't have to create it from scratch - but I want to make a few
modifications. One thing I change is "PAGER=more" to "PAGER=less" - if
you do this, you'll find your man pages are easier to read. I also
add a line saying "ulimit -c 0" - this will prevent "core dumps" (large
diagnostic files created when a program crashes). If
you fail to set this option, you may occasionally find garbage files
like this in one of your user directories:
robert@sonic:~/fbsd> ls -l *.core
-rw------- 1 robert robert 13623296 Apr 23
Finally, I include my aliases, but not the startx one as it will have
here. To sum up, my modifications:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
set -o noclobber
ulimit -c 0
You must log out and log back in before any of these modifications will
take effect (alternatively, just type "exec bash" at the command line).
For Xwindows, I have a large number of choices of window managers. I
decide that as user robert I would like to run FVWM2 as my window
manager. I make this setting by creating (or modifying) file ~/.xinitrc
by adding a line like this:
If you would like to share data between a Linux partition and your
FreeBSD partition, you can optionally compile in support for the
ext2 file system. This does require recompiling the kernel, a procedure
I won't bother to explain here because it would make this (already too
long) review even longer. The FreeBSD Handbook explains in detail how
to do this. The important thing to know is that you need to add an
extra line to the kernel source that says:
After this is compiled, you mount with the mount_ext2fs command,
something like this:
mount_ext2fs /dev/ad0s5 /linux
Note that in this case, the partition being mounted (/dev/ad0s5, same
as Linux's /dev/hda5) does not need to be a primary partition. The
directory /linux is something you will have to manually create with the
To read most of the available FreeBSD documentation, it would appear
that configuring PPP is a nightmare. Actually, it's much simpler than
that if you have installed KDE. In this case, "kppp" will be available
to you. It's very easy to set up kppp, and if you're experienced with
Linux you've probably already done it. The only additional complexity
with FreeBSD is that you'll need to manually create a couple of files.
First create an empty /etc/resolv.conf - root can do so like this:
and then set the permissions to 640:
chmod 640 /etc/resolv.conf
Next, use your editor to create file /etc/ppp/options with this content:
# Options file for PPPD
Permission level should be 644:
chmod 644 /etc/ppp/options
That ought to do it. Configuring kppp itself is a point-and-click
operation. The only difference between FreeBSD and Linux is that serial
ports in Linux are named /dev/ttyS0 or /dev/ttyS1, while the FreeBSD
equivalents are /dev/cuaa0 and /dev/cuaa1.
Geeks need broadband like fish need water, so if you're fortunate
enough to live in a place where ADSL is available, you'll probably want
to set up PPPoE. The slim documentation I've seen on this makes it look
harder than it really is. As with PPP, you can start by creating an
empty file /etc/resolv.conf:
and then set the permissions to 640:
chmod 640 /etc/resolv.conf
The only other thing that needs to be done is to edit file
/etc/ppp/ppp.conf so that it reflects your settings. Before you do
this, backup the existing file (maybe to ppp.conf.original).
Below is a copy of my file ppp.conf which you can cut and paste, but
you'll have to edit five settings. In particular:
1) ANY_WORD - Choose any word you like, "aardvark" would be
fine. This is the name you are giving to this connection.
2) USER_NAME - Your user login name for this
computer, NOT the name you use to logon at the ISP.
3) ETHERNET_DEVICE_NAME - Now this is a significant. Under
Linux, your first Ethernet device is called "eth0", but under FreeBSD
the name will vary according to the chip-set used in the device. The
best way to find out is to use the "ifconfig" command, like so:
inet 192.168.0.2 netmask
0xffffff00 broadcast 192.168.0.255
fe80::20c:6eff:fe0a:ca02%vr0 prefixlen 64 scopeid 0x1
media: Ethernet autoselect
status: no carrier
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen
64 scopeid 0x3
As you can see, the name for my Ethernet device is "vr0". The device
"lo0" (Linux calls this "lo") is just the loopback device - that is to
say a virtual device that
represents the computer itself.
4) MY_NAME@MY_ISP.COM - Could be email@example.com or
5) MY_PASSWORD - The password you use to logon at your ISP.
# PPP Sample Configuration File
# Originally written by Toshiharu OHNO
# Simplified 5/14/1999 by firstname.lastname@example.org
# See /usr/share/examples/ppp/ for some examples
# $FreeBSD: src/etc/ppp/ppp.conf,v 1.8 2001/06/21 15:42:26 brian Exp $
set log Phase Chat LCP IPCP CCP tun command
ident user-ppp VERSION (built COMPILATIONDATE)
# Ensure that "device" references the correct serial port
# for your modem. (cuaa0 = COM1, cuaa1 = COM2)
# set device /dev/cuaa1
# set speed 115200
# set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
# \"\" AT
OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
set timeout 600 # 3 minute
idle timer (the default)
# request DNS info (for resolv.conf)
# edit the next three lines and replace the items in caps with
# the values which have been assigned by your ISP.
allow users USER_NAME
set device PPPoE:ETHERNET_DEVICE_NAME
set authname MY_NAME@MY_ISP.COM
set authkey MY_PASSWORD
# set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
set ifaddr 0 0
add default HISADDR
# Add a (sticky) default route
Once you've got this file set up, just make sure you
haven't changed its permissions. It should be 600 - if not so, then set
chmod 600 /etc/ppp/ppp.conf
And that's it. To start PPPoE, at the command line type:
ppp -background ANY_WORD
To stop the connection:
Of course, substitute whatever you put in ppp.conf for ANY_WORD, so if
it was "aardvark", then:
ppp -background aardvark
Unfortunately, this is what I consider to be the Achilles Heel of
FreeBSD. Actually, of all the BSDs. Of course, there is good
packet-filtering firewall software built into FreeBSD - it's called
IPFW. This is functionally equivalent to Linux's IPTABLES. Furthermore,
upcoming releases of FreeBSD will support "pf" (from OpenBSD) which has
For IPTABLES, there are several easy-to-use point-and-click utilities
which make it easy to create firewall rules (I personally use Guarddog
for this). For FreeBSD there is no equivalent - you must write your own
rules one line at a time, and this can be a painstaking and error-prone
process. Hardcore BSD users will say that writing your own rules is
very educational, and I won't argue with that. Unfortunately, most
people are not capable of writing their own rules, and there is a good
possibility of making a mistake, thus leaving your network with a
glaring security hole.
In fairness, I should point out that if you want to become a
professional system administrator, you'll need to learn about writing
firewall rules. This is in large part because firewalls are not just
used for security, but also for accounting. For example, it is thanks
to firewalls that web hosting services can keep track of how much
bandwidth their customers use.
Explaining the fine art of firewall rule writing would merit an article
in itself - I won't go there. The FreeBSD Handbook gives some guidance,
and there is dead-tree documentation that explains this topic in
detail. For those who can't deal with this, consider purchasing a
hardware router that has built-in firewall rules which you can
configure with a cute point-and-click interface.
I anticipate receiving some flames because of the above paragraphs, but
bear in mind that the whole issue could disappear overnight if somebody
writes a graphical front-end for IPFW (or the upcoming pf). If some
developer volunteers for the project, he/she/it will have my eternal
|The Ports Collection
One of the great contributions to the world made by the BSDs is the
ports collection. This is a system of installing software directly from
source. However, rather than the traditional method where you download
source tarballs and install them one-by-one, the ports system automates
the procedure. Dependencies are resolved on the fly. The ports
collection resides in the /usr/ports directory.
The best way to understand it is by example. Let's say we want to
install Gimp. First you need to be logged onto the Internet. Then open
an Xterm and "su" to root. Next, "cd /usr/ports/graphics/gimp1" then
type "make". This will cause FreeBSD to go fetch all the necessary
sources files for Gimp and place them in /usr/ports/distfiles. When
everything has been downloaded, type "make install" to install the
files. If you ever want to uninstall, go back to
/usr/port/graphics/gimp1 and type "make deinstall". It's that simple.
|Print with CUPS
The FreeBSD Handbook goes on for page after page explaining in
excruciating detail how to get a printer to work. By default, FreeBSD
uses the LPD spooling system, a very UNIXy thing with a long history.
However, if you've been working with Linux for awhile you should be
familiar with CUPS.
CUPS can be found in the good old reliable ports collection. Although
setting up CUPS to work with FreeBSD is not terribly difficult,
documentation on this task is close to non-existent and many people are
left scratching their heads. Ditto for this writer, but fortunately I
had some help and eventually figured it out. And so now I'm going to
reveal to the world just how to do it.
• STEP 1:
You've got to install four packages from ports. You can find them here:
root@sonic:# ls -d1 /usr/ports/print/cups*
• STEP 2:
Create a directory for the CUPS log files:
root@sonic:# mkdir /var/log/cups
• STEP 3:
On FreeBSD, CUPS stores its executable files in /usr/local/bin/ whereas
the traditional lp executables are in /usr/bin/. Because /usr/bin/
in the command path before /usr/local/bin/, your CUPS files will not be
able to execute. For example:
root@sonic:# which lpr
This problem is handily solved by making file /usr/bin/lp*
non-executable, like this:
root@sonic:~> chmod -x /usr/bin/lp*
Now, let's try the previous command again:
root@sonic:# which lpr
Success! This is what we want.
(Note: FreeBSD developers are aware of the above-mentioned path
problem, and it will probably be fixed eventually. So in future
versions, you may be able to eliminate Step 3.)
• STEP 4:
You need to set up a script that starts the CUPS daemon on bootup.
There is a sample startup script which you can just copy and make
executable, like this:
cp cups.sh.sample cups.sh
chmod 755 cups.sh
You could reboot now to start the daemon, but since you're in this
directory anyway, you could start it manually:
• STEP 5:
This part is just like Linux. Open up a browser (Mozilla or Konqueror
will do) and type this url:
This will bring you to the CUPS configuration menu. You'll be asked to
login (login as root and use the root password), then it's simple
point-and-click stuff that you should be able to figure out yourself.
Done! Don't forget to turn on the printer.
|The Final Word
Despite some hiccups, I have been enjoying my experience with FreeBSD
immensely. Most Linux distros which I install for the purpose of
writing reviews only have a short life expectancy on my hard disk -
they will soon be deleted to make room for newer toys. However, I've
decided that my FreeBSD installation is a keeper (along with several
other Linux distros, of course).
I'm finding that FreeBSD is very educational, not in the least because
it's very well-documented (see "FreeBSD Handbook" and "Books" in the
sidebar on the right-hand side of this page). It also helps that the
community is great - I wouldn't have lasted long without the guidance
of some very
helpful individuals on the FreeBSD-questions mailing list.
I should also mention that FreeBSD is very fast. Bootup and shutdown
are both fast, but it's even more
impressive that many Linux apps seem to run faster on FreeBSD than on
As a desktop OS, FreeBSD leaves much to be desired - I won't be
recommending it to Aunt Tilley anytime soon. However, if you are
seriously interested in networking, this is one OS you should
definitely take a look at.
|Copyright (C) 2004
Verbatim copying and distribution of this article is permitted in any
medium, provided this copyright notice is preserved.
|Note: If you'd like to discuss this article, please do so on the DistroWatch Weekly page, or at Daemon News.
|27 April 2004
|About the author...
|Formerly a well-known travel writer, now
a happy hacker running a Windows-free network.
|The author would like to thank Matthew
Seaman, Lowell Gilbert and Greg Lehey for their technical assistance.
|Asus A7v8x-x mainboard, VIA KT-400 chipset
|AMD Athlon 1600
|nVidia Riva TNT2 64, 32MB
|256 MB, DDR-RAM
|Seagate 40 GB, 7200 RPM
|VIA Technologies VT6102 [Rhine-II]
|SoundBlaster PCI 64
|25 February 2004
|"New Technology" (Development)
|• i386 processor or above
• minimum 16MB RAM (128MB recommended)
• minimum 80MB hard disk space (3GB recommended)
• Floppy drive (only if system cannot boot CD)
• Sun UltraSPARC
• Intel ia64
• PowerPC (pending)
|• Outstanding networking capabilities
• Linux binary compatibility mode
• Helpful user community
• "No strings attached" license
|• apache 1.3.29
• bind 9.2.3
• emacs 21.3
• gcc 3.4.0
• gtk+ 2.2.4
• kdebase 3.1.4
• mozilla 1.6
• mysql 4.0.16
• opera 7.23
• perl 5.8.3
• php 4.3.6
• postfix 2.0.16
• python 2.3.3
• ruby 1.6.8
• samba 3.0.0
• XFree86 4.3.0
|• Download - free
• 2-disk CDR sets typically US$6 to US$8
• 4-disk CDROM sets US$35 to US$40
• support info
• mailing lists
• searchable archives
|A simple method to install
software from source (much of it Linux apps). Ports contain any patches
necessary to make the original application source code compile and run
on FreeBSD. The collection currently holds over 10,700 ports.
|Daemons are programs that are not
directly invoked, but rather lie dormant in the background waiting for
some condition to take place - only then does the program spring into
action. Due to its imaginative resemblance to a demon lurking in the
shadows, the term daemon did in fact really derive from the word
"demon". As an afterthought it was reworked to be an abbreviation for
"Disk And Execution MONitor". FreeBSD's really cool logo is
Beastie, the daemon.
|Free Tech Guides
C/C++ Essential Training
In this FREE video course, Bill Weinman dissects the anatomy of C and C++, from variables to functions and loops, and explores both the C Standard Library and the C++ Standard Template Library.