Installing OpenBSD from the network using PXE

In this post I will explain how to configure a OpenBSD server ready to install other servers entirely using the LAN. We use dhcp daemon and tftp daemon.

DHCP will configure network and tftp will provide pxeboot and bsd.rd installation files.

We also prepare apache to provide installation packages. After this tutorial if you follow official openbsd manual, installation is very simple. Just chose http install, set your http server ip and set openbsd43 folder, select packages and that's all. I wish you find it useful.

Preparing dhcpd

    
  # echo 'option domain-name "forniol.cat";
             option routers 192.168.1.1;
             option subnet-mask 255.255.255.0;
             option broadcast-address 192.168.1.255;
             option domain-name-servers 208.67.220.220;
             server-name "DHCPserver";
             server-identifier 192.168.1.1;

             default-lease-time 120;
             max-lease-time 120;

             subnet 192.168.1.0 netmask 255.255.255.0 {
                 filename "pxeboot";
                 range 192.168.1.36 192.168.1.250;
             }' > /etc/dhcpd.conf
  
  # /usr/sbin/dhcpd
  Executing dhcp server
  

Preparing tftpd

    
  # vi /etc/inetd.conf
    move down to line "#tftp dgram udp wait root ..."
    Push esc and type "d"
    Press space
    doing this, # shout disapear
    Push esc and type ":wq!"
    save and quit
  # ps aux | grep inetd | grep -v -e 'ps' -e 'grep inetd' | awk '{print $2}' > pid_inetd ; 
  # kill -9 `cat pid_inetd` && rm pid_inetd
  Killing inetd server
  # /usr/sbin/inetd
  Start inetd again
  

Preparing files to load on boot

  # mkdir -p /tftpboot/etc
  # cp /bsd.rd /tftpboot
  # cp /usr/mdec/pxeboot /tftpboot
  # echo "set image /bsd.rd" > /tftpboot/etc/boot.conf
  

Preparing httpd

    
  # mkdir /var/www/htdocs/openbsd43
  

Copy all installation files inside this directory. The one's marked are mandatory.
Look at this page (http://www.openbsd.org/ftp.html) and download the following files from a mirror.

    
    [x] base43.tgz
    [x] bsd
    [x] comp43.tgz
    [x] etc43.tgz
    [x] index.txt
    [x] man43.tgz
    [x] misc43.tgz
    [ ] game43.tgz
    [ ] bsd.mp
    [ ] bsd.rd
    [ ] xbase43.tgz
    [ ] xetc43.tgz
    [ ] xfont43.tgz
    [ ] xserv43.tgz
    [ ] xshare43.tgz
  
  # /usr/sbin/httpd
  It executes the http daemon
  

Make services to start on load

  
# echo "/usr/sbin/dhcpd" >> /etc/rc.local
# echo "/usr/sbin/httpd" >> /etc/rc.local

Having all that stuff configured and running just power on any computer where you want to install openbsd and select boot PXE. Ensure there's no other dhcp server running on that network.