HomeCurrent ProjectsInterestsResumeE-mail

<< Back to Soekris net4501 FreeBSD Router Project Page

How to Install FreeBSD 4.x
 on a Soekris net4501 Using PXE
  By Michael R. Brumm

Although steps specific to the net4501 are included in this tutorial, if those steps are ignored, this document could be used to install FreeBSD on any normal PC.

This document assumes a clean install of FreeBSD on the computer which will become the PXE server. The PXE client and server must also both be connected to the same ethernet segment. The resulting configuration will result in lessened security on the PXE server, so ensure that the PXE server is isolated either with a firewall or physically isolated from the Internet.

This tutorial also configures a DNS server and NAT routing on the PXE server which, although not completely necessary, are very useful for installing software on the PXE client.

Configure the comBIOS on the net4501
The net4501 does not have any video or keyboard interface, and its comBIOS uses the serial port for the primary console interface instead. The net4501 comBIOS is configured to use a default baud rate of 19200bps on the serial port, however the FreeBSD PXE loader, bootloader, and kernel assume 9600bps by default on serial consoles. To avoid confusion, set the comBIOS to use 9600bps.

Connect the serial port on the net4501 to the serial port of a computer using a null modem cable (also known as a serial crossover cable). Run a terminal emulation program on the computer and connect to the serial port using the following settings:

    VT100 terminal emulation
    19200 bps port speed
    8 data bins
    no parity
    1 stop bit
    XON/XOFF flow control

Turn on the net4501 and you should see the comBIOS begin the boot sequence. Hold the "CTRL" and "P" keys until the monitor program shows a command prompt. At the command prompts, type the following:

    set ConSpeed=9600
    set BootDelay=1
    reboot

Now set your terminal emulation software to use 9600bps.

Install the DHCP Server on the PXE Server

    cd /usr/ports/net/isc-dhcp3-server
    make
    make install

Configure the DHCP Server on the PXE Server
In /usr/local/etc/dhcpd.conf, add the following (this assumes the ethernet adapter connected to the PXE client is configured statically with the IP 10.222.0.1):

    ddns-update-style none;
    subnet 10.222.0.0 netmask 255.255.255.0 {
           range 10.222.0.10 10.222.0.100;
           option routers 10.222.0.1;
           option domain-name-servers 10.222.0.1;
           filename "pxeboot";
           option root-path "/cdrom";
    }

Configure NAT on the PXE Server

In /etc/ipnat.rules, add:

    map lnc0 10.222.0.0/24 -> 0/32 proxy port ftp ftp/tcp mssclamp 1440
    map lnc0 10.222.0.0/24 -> 0/32 portmap tcp/udp auto mssclamp 1440
    map lnc0 10.222.0.0/24 -> 0/32 mssclamp 1440

In /etc/rc.conf, make sure a default route is specified, for example:

    defaultrouter="-interface lnc0" # useful when your Internet IP is dynamic
    or
    defaultrouter="1.2.3.4" # useful when you have a static IP address

Mount the CD-ROM on the PXE Server

Put FreeBSD CD-ROM in the CD-ROM drive and type:

    mount /cdrom

Edit /etc/fstab to remove the "noauto" on /cdrom.

Configure the TFTP Directory on the PXE Server

    mkdir /tftpboot
    cp /cdrom/kernel /tftpboot
    cp -R /cdrom/boot /tftpboot

Configure the Boot Loader to use the Serial Console

In /tftpboot/boot/loader.conf, add this line:

    console="comconsole"

Fix the Terminal Emulation for the Serial Console

In /usr/src/sys/boot/i386/libi386/Makefile, comment out this line to turn off cons25 emulation:

    CFLAGS+= -DTERM_EMU

Recompile the PXE and Boot Loaders to use TFTP on the PXE Server

In /etc/make.conf, add this line:

    LOADER_TFTP_SUPPORT= YES

Recompile and copy the loaders to the TFTP directory using these commands:

    cd /usr/src/sys/boot
    make clean
    make depend
    make
    cp i386/pxeldr/pxeboot /tftpboot
    cp i386/loader/loader /tftpboot/boot

Configure NFS for CD-ROM on the PXE Server

In /etc/exports (for NFS), add this line:

    /cdrom -alldirs,ro

Enable Services on the PXE Server

Uncomment the first tftp line in /etc/inetd.conf

In /etc/rc.conf, add the following lines:

    gateway_enable="YES"
    dhcpd_enable="YES"
    ipnat_enable="YES"
    inetd_enable="YES"
    named_enable="YES"
    nfs_server_enable="YES"

Reboot the PXE Server

    shutdown -r now

Boot and Install FreeBSD on the PXE Client
Install your CompactFlash storage device into the net4501.

While connected via the serial console using terminal emulation, turn on the net4501 and hold the "Ctrl" and "P" keys to access the comBIOS monitor. At the monitor command prompt, type:

    boot f0

This will cause the net4501 to boot using PXE and begin the FreeBSD installation.

In the FreeBSD installation options, set the media type to NFS, use 10.222.0.1:/cdrom as the source.

Configure the FreeBSD Installation for the net4501
When you are asked to choose your terminal setting, choose VT100.

When you are asked if you want to "Visit the general configuration menu for a chance to set any last options?" (near the end of the installation procedure), select yes, then select TTYs and edit the /etc/ttys file to allow the serial console and turn off the video consoles:

    ttyd0 "/usr/libexec/getty std.9600" vt100 on secure

    ttyv0 "/usr/libexec/getty Pc" cons25 off secure
    # Virtual terminals
    ttyv1 "/usr/libexec/getty Pc" cons25 off secure
    ttyv2 "/usr/libexec/getty Pc" cons25 off secure
    ttyv3 "/usr/libexec/getty Pc" cons25 off secure
    ttyv4 "/usr/libexec/getty Pc" cons25 off secure
    ttyv5 "/usr/libexec/getty Pc" cons25 off secure
    ttyv6 "/usr/libexec/getty Pc" cons25 off secure
    ttyv7 "/usr/libexec/getty Pc" cons25 off secure

Configure SSHD to Allow Root Access
After installing FreeBSD, it is much easier to use SSH to connect to the net4501 than use the serial console, so I suggest enabling root access in /etc/ssh/sshd_config by adding the following line:

    allow root

 

<< Back to Soekris net4501 FreeBSD Router Project Page

 

All Material Copyright © Michael R. Brumm