NetBSD

From OptionC

Table of contents

General

  • Where do I start?

A good place to start is NetBSD Documentation (http://www.netbsd.org/Documentation/), specifically The NetBSD Guide (http://www.netbsd.org/guide/en/) and Other FAQs and HOWTOs (http://www.netbsd.org/Documentation/misc/).

Most of the system configuration is handled in "/etc/rc.conf". Browsing through "/etc/defaults/rc.conf" will give you a good idea of what available. Just copy from that to your "rc.conf" file and edit as appropriate.

If you don't use the installer (and just partition the drive and unpack the archives), you'll have to put "rc_configured=YES" into in to this file or you'll be dropped in to single user when you boot.

Many of the options are of the form "service=YES/NO", where service is the name of a startup script in "/etc/rc.d". Many packages will add scripts to that directory, and it will be necessary to add them to "rc.conf" to get them to start (there's a setting in "/etc/mk.conf" that will make pkgsrc do this automatically, but i don't know what it is).

  • Where are the log files?

Most are in "/var/log"

  • What level of user access should I give myself?

When you first install, the only account will be "root". When you log in as root, it gives you a message to the effect of "this is a bad idea". I usually set up an account for myself

useradd -m myname
passwd myname

and then add myself to the group "wheel" in "/etc/group", so i can "su" to become root. I also install "sudo" from "pkgsrc/security".

  • How do I set up X?

If you use the installer, you get options for "basic install" or "basic install with X". It sholud also be possible to install it later by unpacking the archives from the install disk (but I don't have the exact command at hand right now). My understanding is, this is a fork of XFree86 maintained spceficially by and for NetBSD. The only window manager you get is "twm". Many more are available in "pkgsrc". The "X.org" server is also in "pkgsrc".

Note that X is installed in the somewhat non-standard "/usr/X11R6". This can (rarely) confuse some "configure" scripts and such.

Networking

A good place to start is The NetBSD Network FAQ (http://www.netbsd.org/Documentation/network/).

  • How do I configure a static IP address?

Create an "ifconig.###" file in "/etc", where ### is the interface to be configured. The contents of the file get fed to "ifconfig" at boot. A simple one would be:

inet 192.168.0.253

Note that NetBSD doesn't have a default "eth0" interface. Each interface will be named something like "ex0", "fxp1" etc, where the letters indicate the driver used, and the number is the number of the card (per driver). An exception to this is "wi0", which always seems to be your wireless card (if you have one). A good way to find out the names of the interfaces is to look through the output of "dmesg". The GENERIC kernel seems to come with drivers for most common cards.

The hostname and gateway can either be set in the file "/etc/mygate" and "/etc/myname" (old way), or specified in "/etc/rc.conf".

hostname=machinename
defaultroute=192.168.0.1
  • How do I configure DHCP?

In "/etc/rc.conf"

dhclient=YES    #dhclient_flags="ex0"

The flags are optional can specifiy interfaces. It used to be necessary to have a n "/etc/dhclient.conf" file (an empty one to get the defaults), but that doesn't seem to be the case anymore.

There is a script in "/etc/rc.d" that can be used to start and stop dhcp.

/etc/rc.d/dhclient STOP
/etc/rc.d/dhclient START
  • I have a wireless card. How do I find out if it's supported and configure it?

A good reference is Using WaveLAN IEEE under NetBSD (http://www.netbsd.org/Documentation/network/wavelan.html).

That said, the simplest way is to stick it in and see what pops up on the console (or in dmesg). "DEVICE NOT CONFIGURED" means you're out of luck. NetBSD support for wireless cards used to seem a little spotty, though it may be better now. Still, the focus seems to be more on "older hardware" than "newer".

Once you have one that works, "ifconfig" can be used to configure most of the settings (so they can also be set in an "/etc/ifconfig.wi0" file). "wiconfig" is still useful for things like scanning for available networks.

sudo wiconfig wi0 -D

Ususally, dhcp can take care of most of the work.

Bringing the interface up and down on suspend/sleep/resume is handled by apm. The scripts go in "/etc/apm". There is a sample script in "/usr/share/examples/apm/". See also NetBSD Documentation:Power Management (http://www.netbsd.org/Documentation/power-mgmt/#hints).

  • Should I use a personal firewall?

Package management

How do I get stuff?

What package should I use for...

  • Word processing
  • E-mail client
  • Web browser
  • Thin Clients
  • Multi-media stuff
    • Burning DVDs:
    • Watching video and movies
    • Image Viewing:
    • Listening to music

Caveats

Most of the material presented here is relevant to the 3.x release of NetBSD. Some of the configuration and such is different in the 2.x series. Also, most if does not come from a "NetBSD guru", just someone that has spent a lot of time using NetBSD and poking it with a stick to see what would happen.