Tuesday, October 25, 2011

HowTo - Booting with PXE DHCP TFTP NFS using only Knoppix

The goal of this project is to configure a complete PXE environment using only Knoppix. Why only Knoppix? Because it's easy to do and a great place to start learning about PXE. We will get two machines running, one as the PXE server and the other as a diskless client.
  • We are using Knoppix 6.7.1
  • For clients we will use virtual clients (in this case I'm running them on VMware Workstation).
  • We are using a completely isolated Ethernet test network.
  • You need to know basic IPv4 concepts with DHCP and how to change the boot order of your client machines. Chances are if your reading this howto you've got the basics down cold.
Before you get started, please take a quick look at the definitions in the blog posting just preceding this one. You really do need to be clear on the basics of what goes into the PXE process.
Machine #1: DHCP, TFTP, and NFS on Knoppix configured as a terminal server
Note: Do this on a separate network from your default DHCP server. If you have two DHCP servers running on the same wire it's gonna' get ugly.
Boot the Knoppix from the live CD. For a little bit of security you may want to set a root password before proceeding.
The network interface should NOT have come up at this point because you shouldn't have any other DHCP servers running. The following steps will bring the network interface up with a static IP.
OK, here we go with the fun stuff:
  • Open the menu and select Preferences → Start KNOPPIX Terminal Server. You will be shown a brief explanation window describing what the terminal server does. We are not going to deal with any security issues here.
  • From the Terminal Server menu choose setup (Re)configure server and (re)start. This means restart the Terminal Server services, not the whole computer.
  • Choose your NIC from the available network Devices. If you don't have network adapter showing here you need to step back and get the networking to work before proceeding with this PXE project. If you have more than one NIC just be sure to choose the one one your test network segment.
  • Configure the NIC. You probably know this, but don't obtain your address automatically. Your test network should not have any other running DHCP server, so click the No button, then set the IP address. The buttons on my screen covered the text entry box so if you're typing blind just put an IP address. Keep in mind that Knoppix will automatically set your network mask based on the class (A,B, or C) of the IP address you use. I didn't see any option to use CIDR notation. Once you have the IP address set click Close to close the network configuration.
  • Set the DHCP IP address pool range. Knoppix is calling this the IP Address range for clients, but I call it the DHCP pool. The default is probably just fine, unless you want to test a bunch of clients at the same time.
  • Client hardware is where you choose various NIC models to support on your PXE clients. If you have a specific old NIC that you need to use then choose it here, otherwise just click OK.
  • Next we are given a few options. From a security point of view you should really disable root access on the client, but for testing purposes I am unchecking it. (FYI: Disabling root on the client is done when the client mounts the root file system with the nosuid option, which prevents passwd from running with sufficient rights to change a password.) I also suggest leaving IP masquerading turned on for now.
  • Finally we have the opportunity to change the client boot parameters. I just accepted the defaults. In my experience Knoppix almost always gets this right; your mileage may vary.
  • Now start that Terminal Server! We are done setting up the server side.
The following is a list of all the processes that Knoppix started for this terminal server:
root 3882 1 0 09:35 ? 00:00:00 /usr/sbin/dhcpd -q ethO
root 3894 1 0 09:35 ? 00:00:00 in.tftpd -l -s / tftpboot
daemon 3917 1 0 09:35 ? 00:00:00 /sbin/portmap
statd 3933 1 0 09:35 ? 00:00:00 /sbin/ rpc.statd
root 3937 2 0 09:35 ? 00:00:00 [nfsiod]
root 3943 1 0 09:35 ? 00:00:00 /usr/sbin/rpc.idmapd
root 3962 2 0 09:35 ? 00:00:00 [lockd]
root 3963 2 0 09:35 ? 00:00:00 [ nfsd4]
root 3964 2 0 09:35 ? 00:00:00 [nfsd4- callbacks]
root 3965 2 0 09:35 ? 00:00:00 [nfsd]
root 3966 2 0 09:35 ? 00:00:00 [nfsd]
root 3967 2 0 09:35 ? 00:00:00 [nfsd]
root 3968 2 0 09:35 ? 00:00:00 [nfsd]
root 3969 2 0 09:35 ? 00:00:00 [nfsd]
root 3970 2 0 09:35 ? 00:00:00 [nfsd]
root 3971 2 0 09:35 ? 00:00:00 [nfsd]
root 3972 2 0 09:35 ? 00:00:00 [nfsd]
root 3976 1 0 09:35 ? 00:00:00 /usr/sbin/rpc.mountd --manage-gids
knoppix 4009 2439 0 09:35 pts/0 00:00:00 ps -A -f
Knoppix is now running DHCP, TFTP, and NFS. Most of the items listed here, including lockd, rpc, nfsd4, and nfsd, are for NFS support. This everything we need to boot some PXE clients.

Machine #2: The PXE client
The instructions for this part are really short and sweet. Configure your machine's BIOS to boot via PXE as the first boot device, then turn it on. As long as the client can find the DHCP server it should just boot right up.

No comments:

Post a Comment