PXE boot notes (part 2, DHCP)

So, having deployed a VM in part 1, I needed to make it do useful stuff…

Running through a PXE boot process in order, what happens first? Well, the device utilising PXE needs to get on the network – so firstly it needs an ethernet card (obviously). We’ll leave that bit as an exercise for the reader; in my case it was a blade system so we made sure the appropriate profile was applied to the hardware we were using and gave it an ethernet card (more than one, actually).

And when it boots, the PXE process starts and looks for… a BOOTP server. So here’s where the DHCP server comes in.

The basics, in /etc/dhcp/dhcpd.conf (locations may vary according to distro in use):

option domain-name "[YOUR DOMAIN HERE]";
option domain-name-servers [COMMA SEPARATED NAMESERVER LIST];
default-lease-time 86400;
max-lease-time 604800;
ddns-update-style none;

allow booting;                            # <- REALLY IMPORTANT
allow bootp;                              # <- REALLY IMPORTANT
option option-128 code 128 = string;
option option-129 code 129 = text;
next-server 10.30.110.40;                 # <- TFTP server
filename "/pxelinux.0";                   # <- PXE loader

authoritative;

subnet 10.30.110.0 netmask 255.255.255.0 {
 option routers 10.30.110.1;
 range 10.30.110.41 10.30.110.49;
}

host centos1a { hardware ethernet 00:AA:BB:CC:DD:00; fixed-address 10.30.110.21; option host-name "centos1a"; }
host centos2a { hardware ethernet 00:AA:BB:CC:DD:01; fixed-address 10.30.110.22; option host-name "centos2a"; }
host centos3a { hardware ethernet 00:AA:BB:CC:DD:02; fixed-address 10.30.110.23; option host-name "centos3a"; }
host centos4a { hardware ethernet 00:AA:BB:CC:DD:03; fixed-address 10.30.110.24; option host-name "centos4a"; }
host centos5a { hardware ethernet 00:AA:BB:CC:DD:04; fixed-address 10.30.110.25; option host-name "centos5a"; }
host centos6a { hardware ethernet 00:AA:BB:CC:DD:05; fixed-address 10.30.110.26; option host-name "centos6a"; }
host centos1b { hardware ethernet 00:AA:BB:C1:DD:00; fixed-address 10.30.110.27; option host-name "centos1b"; }
host centos2b { hardware ethernet 00:AA:BB:C1:DD:01; fixed-address 10.30.110.28; option host-name "centos2b"; }
host centos3b { hardware ethernet 00:AA:BB:C1:DD:02; fixed-address 10.30.110.29; option host-name "centos3b"; }
host centos4b { hardware ethernet 00:AA:BB:C1:DD:03; fixed-address 10.30.110.30; option host-name "centos4b"; }
host centos5b { hardware ethernet 00:AA:BB:C1:DD:04; fixed-address 10.30.110.31; option host-name "centos5b"; }
host centos6b { hardware ethernet 00:AA:BB:C1:DD:05; fixed-address 10.30.110.32; option host-name "centos6b"; }

The platform was using 6 blades in each location, each in a different chassis, so their base MAC addresses differed slightly.

A quick

systemctl enable dhcpd
systemctl start dhcpd

and we’re up and running. Sort of. Obviously we haven’t done the other magic bits yet, but we’ll get to them shortly – in Part 3.

Advertisements

2 comments

  1. Pingback: PXE boot notes (part 3, TFTP) « Random Ramblings

  2. Pingback: PXE boot notes (storage test platform) « Random Ramblings


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s