DEV Community

Anna Aitchison
Anna Aitchison

Posted on

A Tiny Network Boot (PXE) Server in JavaScript

Overview

I've built a simple PXE (network boot) server with node.js. I suspect it may be the first JavaScript PXE server ever - probably because JS isn't really seen as suitable for this stuff (whether justified or not). I'm still working on making it nicer but the core functionality is working great.

PXE is a protocol for booting clients PCs over a network. It's basically a DHCP and a TFTP server smashed together. Clients get a IP from the DHCP server, the DHCP server points to the TFTP server and the client downloads the boot files from it. My implementation is built on the preexisting dhcp and tftp npm modules, both of which are completeish implementations of their protocols and work great.

Motivation

I wanted to make something a bit different and a little bit harder than my usual fare of light web dev and AWS Lambda functions. It's not particularly glamorous but it's been an interesting project, and I've got a much better understanding of DHCP, PXE, and TFTP. I'm also hoping to make this a component of a bigger project I'm working on.

I think it's definitely worth trying weird stuff like this - it gets you out of your comfort zone and you pick up new stuff. There's also a real sense of acheivement from it.

Project

GitHub logo Ara225 / node-js-pxe-server

A simple CLI JavaScript PXE server (server to boot computers/VMs over a network) implemented in JavaScript using node.js.

It works!

Alt Text

Top comments (2)

Collapse
 
ender_minyard profile image
ender minyard

Hm, this is a bit abstract. Can you explain the difference between PXE and "normal" servers like I'm five?

Collapse
 
ara225 profile image
Anna Aitchison

I'll try Basically, PXE servers are made up of two pretty much independent and normal parts: a DHCP server, and a TFTP server.

The thing that combines them into a PXE server is that the DHCP server is configured to give out the TFTP server's details. When a client PC is told to boot from the network, it gets a DHCP address, uses the information provided by the DHCP server to download a boot file from the TFTP server, load it into memory and boot from it. In other circumstances, this information is ignored