Friday, March 20, 2026

Setting up tftp-hpa on FreeBSD, 5 URLs to read

 Setting up tftp-hpa on FreeBSD,  5 urls to read

 

https://wiki.freebsd.org/PXE%3ATFTPd%20Setup 

https://eradman.com/posts/automated-freebsd-install.html 

 https://www.siberoloji.com/how-to-set-up-a-tftp-server-on-freebsd-operating-system/

https://www.siberoloji.com/how-to-implement-diskless-booting-on-freebsd-operating-system/ 

https://blog.prag.dev/using-freebsds-sysrc-and-serving-tftp-resources 

https://man.freebsd.org/cgi/man.cgi?query=tftpd&sektion=8&format=html   tftpd manual page

https://github.com/WillChamness/Dnsmasq-PXE   Setup DNSmasq for Ubuntu ; reference

iPXE boot for FreeBSD with an UEFI BIOS

https://www.tunbury.org/2025/05/06/freebsd-uefi/  tftp with freebsd uefi  /boot/loader.efi  file

 root@flf_FBSD_15_STABLE:~ # whereis tftpd
tftpd: /usr/libexec/tftpd /usr/share/man/man8/tftpd.8.gz /usr/src/libexec/tftpd
root@flf_FBSD_15_STABLE:~ # ls -l /usr/libexec/tf*
-r-xr-xr-x  1 root wheel 101552 Mar 17 18:41 /usr/libexec/tftp-proxy
-r-xr-xr-x  1 root wheel  39168 Mar 14 23:58 /usr/libexec/tftpd
root@flf_FBSD_15_STABLE:~ # ls -ld /usr/libexec/tf*
-r-xr-xr-x  1 root wheel 101552 Mar 17 18:41 /usr/libexec/tftp-proxy
-r-xr-xr-x  1 root wheel  39168 Mar 14 23:58 /usr/libexec/tftpd
root@flf_FBSD_15_STABLE:~ # tftpd
sh: tftpd: not found
root@flf_FBSD_15_STABLE:~ # echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
root@flf_FBSD_15_STABLE:~ # PATH=$PATH:/usr/libexec
root@flf_FBSD_15_STABLE:~ # echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin:/usr/libexec
root@flf_FBSD_15_STABLE:~ # tftpd --version
tftpd: illegal option -- -
tftpd: illegal option -- v
tftpd: illegal option -- e
tftpd: illegal option -- r
root@flf_FBSD_15_STABLE:~ # tftpd -version
tftpd: illegal option -- v
tftpd: illegal option -- e
tftpd: illegal option -- r

sudo service inetd start
sudo service inetd status
root@flf_FBSD_15_STABLE:~ # sudo service inetd start
Starting inetd.
root@flf_FBSD_15_STABLE:~ # sudo service inetd status
inetd is running as pid 74882.
root@flf_FBSD_15_STABLE:~ # 
 
#search for inetd pid 74882 using grep
root@flf_FBSD_15_STABLE:~ # ps aux | grep 74882
root 74882 0.0 0.0 14360 2836 - Is 00:58 0:00.00 /usr/sbin/inetd -wW -C 60
root 75590 0.0 0.0 14176 2676 2 S+ 01:03 0:00.00 grep 74882


root@flf_FBSD_15_STABLE:~ # ls -l /tftpboot
total 0
root@flf_FBSD_15_STABLE:~ # ls -la /tftpboot
total 9
drwxrwxrwx 2 root wheel 2 Mar 20 00:16 .
drwxr-xr-x 21 root wheel 24 Mar 20 00:16 ..
root@flf_FBSD_15_STABLE:~ # echo "This is a test file." > /tftpboot/testfile.txt
root@flf_FBSD_15_STABLE:~ #
root@flf_FBSD_15_STABLE:~ # ls -la /tftpboot
total 10
drwxrwxrwx 2 root wheel 3 Mar 20 01:07 .
drwxr-xr-x 21 root wheel 24 Mar 20 00:16 ..
-rw-r--r-- 1 root wheel 21 Mar 20 01:07 testfile.txt
root@flf_FBSD_15_STABLE:~ #
 
sudo ipfw add allow udp from any to any 69
root@flf_FBSD_15_STABLE:~ # sudo ipfw add allow udp from any to any 69
ipfw: getsockopt(IP_FW_XADD): Protocol not available
root@flf_FBSD_15_STABLE:~ # 

 
tftp> version
?Invalid command
tftp> connect localhost
tftp> get testfile.txt
receive_packet: timeout
Try 1, didn't receive answer from remote.
receive_packet: timeout
Try 2, didn't receive answer from remote.
^C
tftp> help
Commands may be abbreviated. Commands are:

connect connect to remote tftp
mode set file transfer mode
put send file
get receive file
quit exit tftp
verbose toggle verbose mode
status show current status
binary set mode to octet
ascii set mode to netascii
rexmt set per-packet retransmission timeout[-]
timeout set total retransmission timeout
trace enable 'debug packet'[-]
debug enable verbose output
blocksize set blocksize[*]
blocksize2 set blocksize as a power of 2[**]
rollover rollover after 64K packets[**]
options enable or disable RFC2347 style options
help print help information
packetdrop artificial packetloss feature
windowsize set windowsize[*]
? print help information

[-] : You shouldn't use these ones anymore.
[*] : RFC2347 options support required.
[**] : Non-standard RFC2347 option.
tftp> status
Remote host: localhost
RFC2347 Options support: enabled
Non-RFC defined options support: enabled
Mode: octet
Verbose: off
Debug: none
Artificial packetloss: 0 in 100 packets
Segment size: 512 bytes
Network timeout: 5 seconds
Maximum network timeout: 25 seconds
Maximum timeouts: 5
tftp> debug
The following debugging is enabled: none

The following debugs are available:
packet Packet debugging
simple Simple debugging
options Options debugging
access TCPd access debugging
tftp> debug simple
The following debugging is enabled: simple

The following debugs are available:
packet Packet debugging
simple Simple debugging
options Options debugging
access TCPd access debugging
tftp>
testing TFTP download via localhost connection.  Not working. Why?
Try 5, didn't receive answer from remote.
Requesting testfile.txt
receive_packet: timeout
Try 6, didn't receive answer from remote.
Requesting testfile.txt
^C
tftp> q
root@flf_FBSD_15_STABLE:~ # ls -l /tftpboot
total 1
-rw-r--r-- 1 root wheel 21 Mar 20 01:07 testfile.txt
root@flf_FBSD_15_STABLE:~ # cat /tftpboot/testfile.txt
This is a test file.

 
 

 

 

No comments:

Post a Comment