SlideShare a Scribd company logo
1 of 9
Download to read offline
PXE Network Booting the
Raspberry Pi
While developing using Yocto and using a Raspberry Pi 3B+ I
was finding it very inefficient to flash an sd card over again. I
knew I could leverage the bootloader to network boot but I
gladly found out that by using PXE you can network boot
without an sd card. For this you will need:
A device running Linux that supports dnsmasq and nfs
A compatible Raspberry Pi (see following table)
An ethernet connection between the server and the Pi
You can boot multiple Raspberries albeit with some limitations.
For the server I will be using my laptop powered by Arch Linux
.
Raspberry Pi (client) Setup
The following table summarises the support of your device
depending on its model.
Raspberry Pi Model PXE Support/Configuration
Raspberry Pi 1 Follow instructions https://3mdeb.com/app-dev/pxe-server-with-raspberry-pi-1
Raspberry Pi 2 Follow instructions https://blockdev.io/network-booting-a-raspberry-pi-2
Raspberry Pi 3B Follow instructions https://blockdev.io/network-booting-a-raspberry-pi-3/
Raspberry Pi 3B+ Working out of the box
Raspberry Pi 4 TBD, visit https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md
Server configuration
Install and configure dnsmasq (for DHCP and TFTP) and nfs:
sudo pacman -S nfs-utils dnsmasq
Create the TFTP and NFS root directories and copy over your
previously built rootfs and boot files.
sudo mkdir -p /srv/nfs
sudo mkdir /srv/tftp
# copy the rootfs
sudo cp -a ${rootfs-directory} /srv/nfs/rootfs
# copy the bootfiles, these are normally the files
you encounter
# in the sdcard boot partition
sudo cp -a ${boofiles-directory} /srv/tftp
Edit cmdline.txt and replace the rootfs parameters with:
root=/dev/nfs
nfsroot=192.168.77.1:/srv/nfs/rootfs,nfsvers=3 rootwait
1
1
2
3
4
5
6
7
1
Configure nfs-server
Example /etc/exports configuration
/srv/nfs
192.168.77.0/24(rw,sync,no_subtree_check,no_root_squash)
Edit /etc/nfs.conf and enable udp, nfsv2 (if needed) and nfsv3
as exemplified:
[nfsd]
udp=y
vers2=y
vers3=y
1
1
2
3
4
Configure dnsmasq
PXE, TFTP and DHCP are handed by dnsmasq. Be sure you
have control over the network and aren't colliding with existing
services. In my case I am using a usb to ethernet converter
hooked up to a switch to which I connect the raspberries.
Example /etc/dnsmasq.conf configuration:
port=0
interface=usb0
dhcp-
range=192.168.77.2,192.168.77.100,255.255.255.0
pxe-service=0,"Raspberry Pi Boot"
log-dhcp
enable-tftp
tftp-root=/srv/tftp
1
2
3
4
5
6
7
Network configuration
Set up your NIC with a static address. If you are using
NetworkManager you have a number of front-ends including
the cli tools nmcli and nmtui, as an example my network
configuration file /etc/NetworkManager/system-
connections/usb0.nmconnection looks like:
[connection]
id=usb0
uuid=eaa72b36-beef-3367-a17c-43d4597b5123
type=ethernet
autoconnect-priority=-100
permissions=
[ethernet]
duplex=half
mac-address=00:B5:6D:0D:B1:47
mac-address-blacklist=
speed=100
[ipv4]
address1=192.168.77.1/24
dns-search=
ignore-auto-routes=true
method=manual
never-default=true
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=link-local
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Final Steps
Restart the services, check their status to make sure there was
no configuration error and if it doesn't work you can always
fire up wireshark and debug it. If that doesn't help feel free to
leave a comment below.
sudo systemctl restart dnsmasq nfs-server
Limitations
This scheme isn't safe to use with multiple devices without
built-in measures to the rootfs. I am curious if this can be dealt
with server side, let me know in the comments if you have any
idea.
1
References
https://3mdeb.com/app-dev/pxe-server-with-raspberry-pi-1
https://blockdev.io/network-booting-a-raspberry-pi-2
https://blockdev.io/network-booting-a-raspberry-pi-3/
https://www.raspberrypi.org/documentation/hardware/raspberr
https://wiki.archlinux.org/index.php/dnsmasq
https://wiki.archlinux.org/index.php/NFS
https://wiki.archlinux.org/index.php/PXE
https://wiki.archlinux.org/index.php/TFTP
https://wiki.archlinux.org/index.php/Network_configuration#DH
https://wiki.archlinux.org/index.php/NetworkManager

More Related Content

What's hot

Configuring the boot menu in ubuntu
Configuring the boot menu in ubuntuConfiguring the boot menu in ubuntu
Configuring the boot menu in ubuntu
COMSATS
 
How to mount and unmount filesystem
How to mount and unmount filesystemHow to mount and unmount filesystem
How to mount and unmount filesystem
COMSATS
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manual
dummy
 

What's hot (20)

Fedora Linux
Fedora LinuxFedora Linux
Fedora Linux
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline Tutorial
 
Linux Command Line
Linux Command LineLinux Command Line
Linux Command Line
 
Configuration of Smtp Server On CentOS 8
Configuration of Smtp Server On CentOS 8Configuration of Smtp Server On CentOS 8
Configuration of Smtp Server On CentOS 8
 
Raspberry zero usb in linux
Raspberry zero usb in linuxRaspberry zero usb in linux
Raspberry zero usb in linux
 
My First BCC
My First BCCMy First BCC
My First BCC
 
Day 5 ubuntu boot camp
Day 5 ubuntu boot campDay 5 ubuntu boot camp
Day 5 ubuntu boot camp
 
FHS
FHSFHS
FHS
 
DDR PC3200
DDR PC3200DDR PC3200
DDR PC3200
 
Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)
 
Glusterfs session #18 intro to fuse and its trade offs
Glusterfs session #18 intro to fuse and its trade offsGlusterfs session #18 intro to fuse and its trade offs
Glusterfs session #18 intro to fuse and its trade offs
 
Configuring the boot menu in ubuntu
Configuring the boot menu in ubuntuConfiguring the boot menu in ubuntu
Configuring the boot menu in ubuntu
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common Command
 
How to mount and unmount filesystem
How to mount and unmount filesystemHow to mount and unmount filesystem
How to mount and unmount filesystem
 
DNS (BIND) on CentOS
DNS (BIND) on CentOSDNS (BIND) on CentOS
DNS (BIND) on CentOS
 
Unix for developers
Unix for developersUnix for developers
Unix for developers
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manual
 
Sup intro
Sup introSup intro
Sup intro
 
Large Scale Deployment of Linux
Large Scale Deployment of LinuxLarge Scale Deployment of Linux
Large Scale Deployment of Linux
 
Andresen 8 21 02
Andresen 8 21 02Andresen 8 21 02
Andresen 8 21 02
 

Similar to PXE Network Booting The Raspberry Pi

Linux internet server security and configuration tutorial
Linux internet server security and configuration tutorialLinux internet server security and configuration tutorial
Linux internet server security and configuration tutorial
annik147
 
Linux network file system (nfs)
Linux   network file system (nfs)Linux   network file system (nfs)
Linux network file system (nfs)
Raghu nath
 

Similar to PXE Network Booting The Raspberry Pi (20)

Hands_on_multipath_p1.pdf
Hands_on_multipath_p1.pdfHands_on_multipath_p1.pdf
Hands_on_multipath_p1.pdf
 
NFS is an excellent way of sharing files between linux and other unix systems
NFS is an excellent way of sharing files between linux and other unix systemsNFS is an excellent way of sharing files between linux and other unix systems
NFS is an excellent way of sharing files between linux and other unix systems
 
Hadoop installation
Hadoop installationHadoop installation
Hadoop installation
 
Network File System (NFS)
Network File System (NFS)Network File System (NFS)
Network File System (NFS)
 
Linux
LinuxLinux
Linux
 
Dev ops
Dev opsDev ops
Dev ops
 
PHP selber bauen
PHP selber bauenPHP selber bauen
PHP selber bauen
 
Linux internet server security and configuration tutorial
Linux internet server security and configuration tutorialLinux internet server security and configuration tutorial
Linux internet server security and configuration tutorial
 
Linux network file system (nfs)
Linux   network file system (nfs)Linux   network file system (nfs)
Linux network file system (nfs)
 
Sun raysetup
Sun raysetupSun raysetup
Sun raysetup
 
Edup wifi for raspberry zero
Edup wifi  for raspberry zeroEdup wifi  for raspberry zero
Edup wifi for raspberry zero
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
 
Free radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleFree radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmaple
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training
 
Bsd routers
Bsd routersBsd routers
Bsd routers
 
Practical Tips for Novell Cluster Services
Practical Tips for Novell Cluster ServicesPractical Tips for Novell Cluster Services
Practical Tips for Novell Cluster Services
 
Nfs
NfsNfs
Nfs
 
3. configuring a compute node for nfv
3. configuring a compute node for nfv3. configuring a compute node for nfv
3. configuring a compute node for nfv
 
Managing the system and network connection Linux
Managing the system and network connection LinuxManaging the system and network connection Linux
Managing the system and network connection Linux
 
Linux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactLinux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compact
 

Recently uploaded

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Recently uploaded (20)

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 

PXE Network Booting The Raspberry Pi

  • 1. PXE Network Booting the Raspberry Pi
  • 2. While developing using Yocto and using a Raspberry Pi 3B+ I was finding it very inefficient to flash an sd card over again. I knew I could leverage the bootloader to network boot but I gladly found out that by using PXE you can network boot without an sd card. For this you will need: A device running Linux that supports dnsmasq and nfs A compatible Raspberry Pi (see following table) An ethernet connection between the server and the Pi You can boot multiple Raspberries albeit with some limitations. For the server I will be using my laptop powered by Arch Linux .
  • 3. Raspberry Pi (client) Setup The following table summarises the support of your device depending on its model. Raspberry Pi Model PXE Support/Configuration Raspberry Pi 1 Follow instructions https://3mdeb.com/app-dev/pxe-server-with-raspberry-pi-1 Raspberry Pi 2 Follow instructions https://blockdev.io/network-booting-a-raspberry-pi-2 Raspberry Pi 3B Follow instructions https://blockdev.io/network-booting-a-raspberry-pi-3/ Raspberry Pi 3B+ Working out of the box Raspberry Pi 4 TBD, visit https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md
  • 4. Server configuration Install and configure dnsmasq (for DHCP and TFTP) and nfs: sudo pacman -S nfs-utils dnsmasq Create the TFTP and NFS root directories and copy over your previously built rootfs and boot files. sudo mkdir -p /srv/nfs sudo mkdir /srv/tftp # copy the rootfs sudo cp -a ${rootfs-directory} /srv/nfs/rootfs # copy the bootfiles, these are normally the files you encounter # in the sdcard boot partition sudo cp -a ${boofiles-directory} /srv/tftp Edit cmdline.txt and replace the rootfs parameters with: root=/dev/nfs nfsroot=192.168.77.1:/srv/nfs/rootfs,nfsvers=3 rootwait 1 1 2 3 4 5 6 7 1
  • 5. Configure nfs-server Example /etc/exports configuration /srv/nfs 192.168.77.0/24(rw,sync,no_subtree_check,no_root_squash) Edit /etc/nfs.conf and enable udp, nfsv2 (if needed) and nfsv3 as exemplified: [nfsd] udp=y vers2=y vers3=y 1 1 2 3 4
  • 6. Configure dnsmasq PXE, TFTP and DHCP are handed by dnsmasq. Be sure you have control over the network and aren't colliding with existing services. In my case I am using a usb to ethernet converter hooked up to a switch to which I connect the raspberries. Example /etc/dnsmasq.conf configuration: port=0 interface=usb0 dhcp- range=192.168.77.2,192.168.77.100,255.255.255.0 pxe-service=0,"Raspberry Pi Boot" log-dhcp enable-tftp tftp-root=/srv/tftp 1 2 3 4 5 6 7
  • 7. Network configuration Set up your NIC with a static address. If you are using NetworkManager you have a number of front-ends including the cli tools nmcli and nmtui, as an example my network configuration file /etc/NetworkManager/system- connections/usb0.nmconnection looks like: [connection] id=usb0 uuid=eaa72b36-beef-3367-a17c-43d4597b5123 type=ethernet autoconnect-priority=-100 permissions= [ethernet] duplex=half mac-address=00:B5:6D:0D:B1:47 mac-address-blacklist= speed=100 [ipv4] address1=192.168.77.1/24 dns-search= ignore-auto-routes=true method=manual never-default=true [ipv6] addr-gen-mode=stable-privacy dns-search= method=link-local 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
  • 8. Final Steps Restart the services, check their status to make sure there was no configuration error and if it doesn't work you can always fire up wireshark and debug it. If that doesn't help feel free to leave a comment below. sudo systemctl restart dnsmasq nfs-server Limitations This scheme isn't safe to use with multiple devices without built-in measures to the rootfs. I am curious if this can be dealt with server side, let me know in the comments if you have any idea. 1