Mike's PBX Cookbook

Raspberry Pi TFTP server

A TFTP server is a handy thing to have for firmware updates (IP phone, 4550T, MRV, etc), or for IP set Auto Provisioning.

Preparation:

Use the Raspberry Pi Imager to prepare a 4GB (or bigger) SD card with Raspberry PI OS lite.
Enable SSH, either with sudo raspi-config → “Interfacing Options”, or touch /boot/ssh

Boot up the Raspberry, connect it to the internet, and install the xinetd tftp package:

sudo apt-get update
sudo apt-get install xinetd tftpd tftp

Disconnect the PI from the internet, and connect it to the TLAN for IP phones, or ELAN for equipment firmware upgrades.

Static Address:

Servers need a static IP address! If not already configured, this is set up in /etc/dhcpcd.conf:

sudo nano /etc/dhcpcd.conf

Scroll down to the eth0 section, uncomment and edit:

# Custom static IP address for eth0.
interface eth0
static ip_address=192.168.0.2/24
static routers=192.168.0.254
#static domain_name_servers=192.168.0.1 8.8.8.8

Notes: 'static routers' = optional gateway address, 'static domain_name_servers' - comment out if no DNS

Save the file with Ctrl-X, Y, Enter.

Bounce ethernet port to apply:

sudo ifconfig eth0 down
sudo ifconfig eth0 up

ifconfig should now display your static IP address.

Configuring the TFTP server:

Create and edit the config file: sudo nano /etc/xinetd.d/tftp, copy/paste in the following:

service tftp
{
protocol        = udp
port            = 69
socket_type     = dgram
wait            = yes
user            = nobody
server          = /usr/sbin/in.tftpd
server_args     = /tftpboot
disable         = no
}

Create the servers root directory:

sudo mkdir /tftpboot                                          - server root directory
sudo chmod -R 777 /tftpboot                                   - make it writeable
sudo chown -R nobody /tftpboot                                - change owner

Control the TFTP server with:

sudo /etc/init.d/xinetd start | stop

Copy a system.prv and/or firmware files to the server root directory (/tftpboot).

TFTP on a Mac:

Start and stop the built in TFTP server with the following:

sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist         - start
sudo launchctl unload -F /System/Library/LaunchDaemons/tftp.plist       - stop

Check if its running with:

netstat -atp UDP | grep tftp

If you directly return to command prompt, its NOT running, if there's some output it probably is.

The default root directory is: /private/tftpboot, so copy any files there. You may need to chmod them:

sudo chmod 777 /private/tftpboot
sudo chmod 777 /private/tftpboot/*                            - ALL files in directory

To transfer a file TO the TFTP server, strangely it first needs to already exist there. Do this with touch:

sudo touch /private/tftpboot/running-config
sudo chmod 777 /private/tftpboot/running-config

Pumpkin is a simple TFTP server and TFTP client with a GUI, it's available for Windows and Mac.

Reference: