2

I am working on a mock up of a PXE server for the place I work. I am trying to put the image files and configuration file in places that keep things a little more organized. Even though my dhcpd.confspecifies the configuration options needed to tell PXELinux where to look for config files it still does not find said files.

Here is what my /etc/dhcp/dhcpd.conf looks like, this is where I imagine the issue is.

option space PXE;
option PXE.mtftp-ip             code 1 = ip-address;
option PXE.mtftp-cport          code 2 = unsigned integer 16;
option PXE.mtftp-sport          code 3 = unsigned integer 16;
option PXE.mtftp-tmout          code 4 = unsigned integer 8;
option PXE.mtftp-delay          code 5 = unsigned integer 8;
option arch                     code 93 = unsigned integer 16;

option space pxelinux;
option pxelinux.magic                   code 208 = string;
option pxelinux.configfile              code 209 = text;
option pxelinux.pathprefix              code 210 = text;
option pxelinux.reboottime              code 211 = unsigned integer 32;

ddns-update-style none;

option domain-name "lab.solignis.com";
option domain-name-servers ns01.lab.solignis.com;

default-lease-time 600;
max-lease-time 7200;

authoritative;
log-facility local7;

subnet 192.168.147.0 netmask 255.255.255.0 {
        range 192.168.147.100 192.168.147.254;
        option subnet-mask 255.255.255.0;
        option routers 192.168.147.2;
        option broadcast-address 192.168.147.255;
        default-lease-time 600;
        max-lease-time 7200;

        class "pxeclients" {

                match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
                next-server 192.168.147.10;

                if option arch = 00:00 {
                        option pxelinux.configfile "common.cfg";
                        option pxelinux.pathprefix "/configs/";
                        filename "/pxelinux/images/BIOS/pxelinux.0";
                } elsif option arch = 00:06 {
                        #option pathprefix "/configs/";
                        #option configfile "/EFIx64/default";
                        filename "/images/EFIx64/syslinux.efi";
                } elsif option arch = 00:07 {
                        #option pathprefix "/configs/";
                        #option configfile "/EFIx64/default";
                        filename "/images/EFIx64/syslinux.efi";
                } elsif option arch = 00:09 {
                        #option pathprefix "/configs/";
                        #option configfile "/EFIx64/default";
                        filename "/images/EFIia32/syslinux.efi";
                }
        }

}

Parts of the config were compiled from various parts of documentation, the parts that are commented out are old pieces that I have not fixed yet disregard those. For now I just want to get standard BIOS working (arch = 00:00).

Here is what my file structure looks like for my tftpboot directory.

server01@server01:/var/lib/tftpboot$ tree
.
└── pxelinux
    ├── configs
    │   └── common.cfg
    └── images
        ├── BIOS
        │   ├── ldlinux.c32
        │   └── pxelinux.0
        ├── EFIia32
        │   └── syslinux.efi
        └── EFIx64
            └── syslinux.efi

6 directories, 5 files

I was pretty sure I have it setup right for pxelinux but it does not see the config file so something is not configured right. Can anyone provide an idea of what I misconfigured? I have been banging my head on this all day.

ianc1215
  • 1,965
  • 7
  • 34
  • 55
  • Have you made it working? I was constructing similar config, but at the end, I could not get it working with isc-dhcp. The problem was that server was not sending option 209 (config file name), but this is essential for this setup. This is because client was not explicitly requesing it. I tried to make isc-dhcp to forcibly send it using this https://askubuntu.com/a/969612/795775 method. And it did not work. Viewing dhcp packats in Wireshark showed that 209 option was not sent. However, there was no such issue with dnsmasq - it really forcibly sends an option if configured such way in config – Ashark Sep 19 '19 at 04:21

2 Answers2

2

Note that the configfile is relative to the pathprefix:

            if option arch = 00:00 {
                    option pxelinux.configfile "common.cfg";
                    option pxelinux.pathprefix "/pxelinux/configs/";
                    filename "/pxelinux/images/BIOS/pxelinux.0";

this will look for a config file called /pxelinux/configs/common.cfg on the TFTP server.

if this fails just get a Wireshark traffic capture and see the TFTP file requests and where they are pointing to.

Pat
  • 3,339
  • 2
  • 16
  • 17
  • Sigh.... I never even thought of using wireshark. Awesome idea I will try that tomorrow. – ianc1215 Oct 19 '16 at 22:15
  • Wireshark seems really too much when `grep tftp /var/log/syslog` on the tftp server should be enough to show the requested files. Maybe you need to add `--verbose` to the tftpd options (in `/etc/default/tftpd-hpa` on Debian). – mivk Jun 27 '19 at 21:48
  • Wireshark is the ultimate test even if your server does not log a thing... – Pat Jul 02 '19 at 21:07
0

I fought with this today and finally made it work. The key was this little section in the PXELINUX wiki (I had ISC dhcp-4.2.5-79.el7.centos.x86_64 on CentOS 7.8):

In ISC dhcp versions greater than 3.0, site-local option spaces start at 224, not 128 (to be compliant with RFC 3942), so you should define the PXELINUX options 208-211 as regular DHCP options, rather than site local ones. For example:

 option magic      code 208 = string;
 option configfile code 209 = text;
 option pathprefix code 210 = text;
 option reboottime code 211 = unsigned integer 32;

Inside your PXELINUX-booting group or class (wherever you have the PXELINUX-related options, such as the "filename" option), you would add, for example:

 # Always include the following lines for all PXELINUX clients
 option magic f1:00:74:7e;
 if exists dhcp-parameter-request-list {
  # Always send the PXELINUX options (specified in hexadecimal, ie: 208 = 0xd0, 209 = 0xd1, etc.)
  option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list,d0,d1,d2,d3);
 }
 # These lines should be customized to your setup
 option configfile "configs/common";
 option pathprefix "/tftpboot/pxelinux/files/";
 option reboottime 30;
 filename "/tftpboot/pxelinux/pxelinux.bin";
uli42
  • 195
  • 2
  • 9