Saturday, October 3, 2009

PXE Boot | OpenBSD | Soekris

SET UP A PXE BOOT SERVER ON THE NETWORK
  • Install OpenBSD on a box with more than one network interface. Set the server up on the network with the primary interface active and configured to talk on the network.
  • Configure the 2nd interface on a private subnet for dhcp and tftp use by the new PXE box.

SET UP ACCESS TO THE BOOT SERVER
  • edit /etc/sysctl.conf /etc/rc.conf and enable packet filtering and forwarding
  • edit pf.conf to resemble the following simple, limited access structure
ext_if="sis0"
int_if="sis1"
set skip on lo
scrub in all
nat on $ext_if from !($ext_if) -> ($ext_if:0)
block in
pass out
pass quick on $int_if no state
pass in quick on $ext_if proto tcp from 159.212.48.138 to ($ext_if) port ssh
antispoof quick for { lo $int_if }


GET THE PXE FILES
  • This box needs to download or acquire the latest PXE boot files from the OpenBSD project.
  • If you need to go through a proxy, you should set env variable like following example.
export http_proxy="http://proxy.blah.com:8080"
  • You can check this with the env command.
  • Then use wget specifying the --proxy-user=username and --proxy-password=password as needed. An example follows:
wget --proxy-user=someuser --proxy-password=p4ssw0rd http://openbsd.mirrors.hoobly.com/4.3/i386/pxeboot
  • You will also need to get the ramdisk kernel bsd.rd
  • The Files can also be transfered from another server where they were downloaded. scp is recommended.

SET UP DHCP TO BOOT THE PXE BOX
  • add something like the following to your dhcp.conf file, note the filename "pxeboot"; directive - this should be set to the name of your PXE boot file.

shared-network LOCAL-NET {
option domain-name "boot.net";
option domain-name-servers 159.212.72.72, 159.212.99.99;

subnet 10.0.10.0 netmask 255.255.255.0 {
option routers 10.0.10.1;
filename "pxeboot";
range 10.0.10.100 10.0.10 150;
default-lease-time 3600;
max-lease-time 10800;
}
}

  • make sure to set your hostname.* file for the 2nd interface to the corresponding IP address of the option routers setting, in this example 10.0.10.1
  • add the name of your 2nd interface to the dhcp.interfaces file
  • start dhcpd manually with the following (user your own device name)
dhcpd sis1
  • check for dhcpd running with
ps aux | grep dhcpd
  • if it's not running, check for errors with
cat /var/log/messages | grep -i dhcp


SET UP TFTP TO SERVE THE FILES
  • uncomment (remove the #) the line in /etc/inetd.conf as follows:
#tftp dgram udp wait root /usr/libexec/tftpd tftpd -s /tftpboot
  • create the directory in the above line /tftpboot
  • place the pxeboot and bsd.rd files in the /tftpboot directory
  • you may want to create an etc subdir and put a boot.conf file in it.
  • sample /tftpboot/etc/boot.conf for a soekris install would looke like this:
stty com0 19200
set tty com0
  • either use a line in the boot.conf to specify the bsd.rd or rename the file bsd.rd to simply bsd
  • restart inetd (not sure if this is needed, but I did it)
pkill inetd
inetd

SOEKRIS INSTALL
  • Plug a crossover cable in to the 2nd interface of your INSTALL SERVER and the primary interface of the server you wish to install on.
  • Boot the new server and enter the boot BIOS by typing CTL-P on a Soekris box.
  • Give the PXE boot command
boot f0
  • Its a regular OpenBSD install from here.

No comments: