Using OpenWrt to serve a recovery file over tftp

Hi,

Is it possible to set up openwrt to serve a recovery file to my NAS? I hosed the system and need to repair it.

I know can use dnsmasq as a tftp server but it is not clear to me if it can be configured to identify a machine by MAC, assign an IP address and then feed a file to the machine requiring repair. I.e., dhcpd would be configured as:

host ts119 {
hardware ethernet 00:50:43:3c:3b:5d;
filename "F_TS-119_debian";
fixed-address 192.168.1.71;
next-server 192.168.1.2;
}

Can this be done with dnsmasq or would it require installation of dhcpd?

Yes, but you will need dnsmasq-full, rather than the normal dnsmasq package (or atftpd). While you'll only need a tiny subset of https://openwrt.org/docs/guide-user/services/tftp.pxe-server that guide should have most of the required information.

2 Likes

Great! I have tftp enabled and I have the host set up. Is there a directive in the host section where I tell it the filename?

I guess that should be possible, indirectly, see adding a custom dhcp option for my SIP phone(s) as example (I personally use tftpd-hpa myself though).

config host                           
        option name 'cp-7962g'        
        option dns '1'                
        option mac 'ac:a0:16:xx:xx:xx'
        option ip '192.168.x.x' 

config mac                    
        option mac 'ac:a0:16:xx:xx:xx'
        option networkid 'cisco-sip'
        list dhcp_option '66,192.168.x.x'