OpenWRT as PXE Server for Raspberry Pi

HI,

I am trying to setup my openWRT router which is used as main router, DHCP and DNS server and firewall in my local network as PXE server to boot a Raspberry Pi 4B diskless. The boot image and the root file system is placed on a NAS which should operate as TFTP and NFS server.

Unfortunately I am not able to make this running. The Raspberry pi requests an IP from the DHCP server but afterwards it sends TFTP request to the main router but not to the NAS.

The openWRT router was configured by LuCI but instead of a screenshot here is the PXE part of /etc/config/dhcp:

config boot
        option serveraddress '192.168.148.227'
        option networkid 'eth0.96'
        option force '1'
        option servername 'n2200'
        list dhcp_option '43,Raspberry Pi Boot'

192.168.148.227 is the IP of the NAS.

And here is an extraction from what I see afterwards with

tcpdump -i eth0.96 port 67 or port 68 or port 69 -e -n -vv

12:21:24.994158 54:af:97:fb:4b:7d > dc:a6:32:2e:7d:77, ethertype IPv4 (0x0800), length 369: (tos 0xc0, ttl 64, id 11250, offset 0, flags [none], proto UDP (17), length 355)
    192.168.96.1.67 > 192.168.96.100.68: [udp sum ok] BOOTP/DHCP, Reply, length 327, xid 0x2ee7ce84, Flags [none] (0x0000)
          Your-IP 192.168.96.100
          Server-IP 192.168.96.1
          Client-Ethernet-Address dc:a6:32:2e:7d:77
          Vendor-rfc1048 Extensions
            Magic Cookie 0x63825363
            DHCP-Message Option 53, length 1: ACK
            Server-ID Option 54, length 4: 192.168.96.1
            Lease-Time Option 51, length 4: 43200
            RN Option 58, length 4: 21600
            RB Option 59, length 4: 37800
            Subnet-Mask Option 1, length 4: 255.255.240.0
            BR Option 28, length 4: 192.168.111.255
            Default-Gateway Option 3, length 4: 192.168.96.1
            Domain-Name-Server Option 6, length 4: 192.168.96.1
            Domain-Name Option 15, length 22: "local"
            Hostname Option 12, length 9: "brombeere"

12:21:26.987259 dc:a6:32:2e:7d:77 > 54:af:97:fb:4b:7d, ethertype IPv4 (0x0800), length 91: (tos 0x0, ttl 64, id 5758, offset 0, flags [none], proto UDP (17), length 77)
    192.168.96.100.30740 > 192.168.96.1.69: [udp sum ok]  49 RRQ "35b03d9a/start4.elf" octet tsize 0 blksize 1468

12:21:28.987242 dc:a6:32:2e:7d:77 > 54:af:97:fb:4b:7d, ethertype IPv4 (0x0800), length 91: (tos 0x0, ttl 64, id 5760, offset 0, flags [none], proto UDP (17), length 77)
    192.168.96.100.30740 > 192.168.96.1.69: [udp sum ok]  49 RRQ "35b03d9a/start4.elf" octet tsize 0 blksize 1468

Is there anyone who has an idee what I am doing wrong?

best regards,

Holger

That's so cool! Hope you get it working.

Hah funny

Don't you also need:

list dhcp_option '66,192.168.148.227'

to tell the RPi where the TFTP server is at?


Caveat: I have not tested this myself (as usual)

As far as I remember, the custom boot server is not advertised if you don't specify a filename in the boot section. Try something like this.

config boot
        option serveraddress '192.168.148.227'
        option servername 'n2200'
        option filename 'start4.elf'
1 Like

Thank you for this hint, this really helped! After I added a filename to the configuration, the correct IP was advertised. It seems to me that the content of the filename is completely irrelevant. A single character seams to be sufficient.
Anyway, thank you very much for this hint.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.