Setting Up A Netboot Enviroment on Gentoo For OpenBSD
Given the fact I seem to be getting more Sun Sparc headless machines I think its time to have a real netboot environment set up. Currently this is geared towards Sparc and OpenBSD but theres no reasion why you can not use diffrent boot images ect..
Setting Up DHCPD on Gentoo
emerge -av dhcp
Netbooting Sparcs requires you to have a static IP address for the client. Lets set up a DHCP scope for later use and define a static IP for the netboot Edit the file :
/etc/dhcp/dhcpd.conf
Here is what I've got in mine:
# DHCP scope for undersys.net
ddns-update-style ad-hoc; # This is the default. You can set it to none
# option definitions common to all supported networks...
# You need to change this one to your own setting
option domain-name "undersys.net";
# Your name servers. You can normally find these in
# your /etc/resolv.conf file. These will be distributed to all DHCP
# clients.
option domain-name-servers 192.168.0.254;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Configuration for an internal subnet.
# Lets define a basic scope for later on..
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.40 192.168.0.60; # The range of ip addresses it will give ou
option domain-name-servers 192.168.0.254; # Change to your DNS
option domain-name "undersys.net"; # You need to change this to your own setting
option routers 192.168.0.254; # Your gateway, your machine that is connected to the internet
option broadcast-address 192.168.0.255;
default-lease-time 600;
max-lease-time 7200;
}
# Static mapping for my Sun Sparc T1
# option is where we set the boot media location, folder
host t1 {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.0.64;
option root-path "/media/openbsd";
}
# END
The above config will give us a basic scope from 192.168.0.40 to 192.168.0.60. Will also give us a static MAC to IP address map and an DHCP "option" for the boot media location. Start the DHCP Server :
/etc/init.d/dhcpd start
Lets start the service on boot :
rc-update add dhcpd default
Your DHCP server is done.
Setting up RARP
Sparc Netboot requires RARP in order to map its MAC to an IP during the PROM stages. Gentoo should allready have an RARP deamon installed via the package "net-misc/iputils". Now edit the file :
/etc/ethers
Add an entry for your system in the following format :-
# MAC Address FQDN
xx:xx:xx:xx:xx:xx t1-netboot.undersys.net
You also must edit the locat hosts or your DNS server to have the FQDN mapping, I've just used hosts file for the moment. Edit the local systems host file :
/etc/hosts
Add the following :
192.168.0.64 t1-netboot.undersys.net
From the above we can see that the IP is the Ip address from the static DHCP map. Now edit the file :
/etc/conf.d/local.start
add the following :
# Start rarpd
/usr/sbin/rarpd -v -e eth0
You will need to start this manualy first time, just use the command :
/etc/conf.d/local.start
Setting up TFTP
You'll also need a way to serve out the boot image. I use TFTP becase it works with a LOT more odd machines. Emerge the following package :
emerge -av net-ftp/atftp
The make the TFTP directory :
mkdir /tftpboot
chown nobody:nobody /tftpboot
chmod 440 /tftpboot
Then edit the file :
/etc/conf.d/local.start
Add the following :-
# Start tftp server
/usr/sbin/in.tftpd -v --daemon /tftpboot
You will need to start this manualy first time, just use the command :
/etc/conf.d/local.start
Setting up the OpenBSD boot files
Get the following files from your local OpenBSD Mirror :
- "bsd.rd" copy this into /media/openbsd
- "ofwboot.net" copy this into /tftpboot
Sun Sparc's when netbooting from PROM look for a file on the TFTP server that maches its MAC address in HEX followed by the extension. I like to create a symlink from ofwboot.net to the new file, as the new file names makes no sence ln -s ofwboot.net XXXXXXXX (Where XXXXXXXX is the IP address of the system that we set in dhcpd.conf in HEX) If this fails use TCP dump to see what file its asking for.
We should now be ready to Netboot OpenBSD on the Sparc! How to boot will come in another article..