flashing openwrt via pxe boot

From thelinuxwiki
Jump to: navigation, search

setup pxe boot server

install dnsmasq if needed

create tftpboot directory and put firmware from dd-wrt or openwrt in it.

download firmware upgrade file and put it in directory
make directory world readable
rename firmware file to firmware.bin

start dnsmasq via command line

dnsmasq --port=0 --enable-tftp --tftp-root=/path/to/firmware/directory --tftp-no-blocksize --user=root --group=root

verify network port is successfully bound

root@mypxeserver:/etc# netstat -anp | grep ":69"
udp        0      0 0.0.0.0:69              0.0.0.0:*                           3674/dnsmasq 

flash device

connect device to you network port of the pxe server. be sure your network doesn't have another active dhcp server on it! I used a direct connect via crossover cable.

I decided to watch with tcpdump. notice request for firmware.bin

# tcpdump -i enp5s0
12:46:36.413672 ARP, Request who-has 192.168.10.100 tell 192.168.10.101, length 46 
12:46:36.413700 ARP, Reply 192.168.10.100 is-at 44:a8:42:fc:ea:c2 (oui Unknown), length 28
12:46:36.425540 IP 192.168.10.101.3727 > 192.168.10.100.tftp:  31 RRQ "firmware.bin" octet timeout 3
12:46:36.425689 IP 192.168.10.100.60235 > 192.168.10.101.3727: UDP, length 516
12:46:36.425834 IP 192.168.10.101.3727 > 192.168.10.100.60235: UDP, length  4
12:46:36.425892 IP 192.168.10.100.60235 > 192.168.10.101.3727: UDP, length  516
12:46:36.426035 IP 192.168.10.101.3727 > 192.168.10.100.60235: UDP, length  4
...