Difference between revisions of "TFTP server"
(Created page with "Category:Linux =Reminder= * TFTP requires a DHCP server * TFTP is NOT secure at all. You should only use it into your internal network !! => Don't forget to adjust y...") |
(No difference)
|
Revision as of 08:34, 21 August 2014
Contents
Reminder
- TFTP requires a DHCP server
- TFTP is NOT secure at all. You should only use it into your internal network !!
=> Don't forget to adjust your firewall rules
Installation
Trivial FTP (TFTP) client
apt-get install tftp-hpa
Trivial FTP (TFTP) server
apt-get install tftpd-hpa
SysLinux [netboot utilities]
apt-get install syslinux mtools initramfs-tools
Syslinux contains some starter files you can use for your netboot clients.
Configuration
Create target TFTP folders
mkdir -m 755 -p /tftpboot
TFTP configuration
vim /etc/default/tftpd-hpa
It should look like:
# /etc/default/tftpd-hpa
RUN_DAEMON="yes"
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"
Don't forget to add the RUN_DAEMON setting.
The TFTP server files [= the files that will be used by the TFTP clients] are in the "TFTP_DIRECTORY" instruction.
==> You should use the folder we just created: /tftpboot
IMPORTANT !!
You must not change the default user or port number !!
service tftpd-hpa restart
TFTP automatic start on boot
Sometimes the "RUN_DAEMON" is not enough for TFTP automatic startup... :(
In that case you have to register tftp-hpa as a service.
cd /etc/init.d/
update-rc.d tftpd-hpa defaults
Reboot your server ! The TFTP should be up and running now :)
Firewall configuration
Adjust your firewall script and add the following rules:
IPTABLES=`which iptables`
LAN_ADDRESS="172.16.50.0/24"
$IPTABLES -A INPUT -p udp -s $LAN_ADDRESS --dport 69 -j ACCEPT
Test the server
1. Create a file on the server
vim /tftpboot/hello.txt
2. Connect to the server
Install TFTP client:
apt-get install tftp-hpa
Connect to the server and get file:
tftp 172.16.50.2
get hello.txt
quit
Check the received file:
cat hello.txt
TFTP management
Just use the "service" command:
service tftpd-hpa {status|restart|start|stop}
Setup NetBoot files
See NetBoot server