Difference between revisions of "TFTP"

From ArchWiki
Jump to: navigation, search
m (Run)
(22 intermediate revisions by 14 users not shown)
Line 1: Line 1:
[[Category:HOWTOs (English)]]
+
[[Category:File Transfer Protocol]]
{{stub}}
+
The [[Wikipedia:Trivial File Transfer Protocol|Trivial File Transfer Protocol]] (TFTP) provides a minimalistic means for transferring files.  It is generally used as a part of [[PXE]] booting or for updating configuration and firmware on devices which have limited memory such as routers and printers.
  
== Introduction ==
+
This article describes how to set up a tftpd server under Arch Linux using the {{Pkg|tftp-hpa}} package.
This HOWTO describes how to set up a tftpd server under Arch Linux.
+
  
 
== Installation ==
 
== Installation ==
The first thing is to install all necessary stuff:
+
[[pacman|Install]] the package {{Pkg|tftp-hpa}} which can be found in the [[Official Repositories|official repositories]].
# pacman -S mkpxelinux  tftp-hpa dhcpcd
+
  
 
== Configuration ==
 
== Configuration ==
At first we will create a /etc/dhcpd.conf file. It has to look like this (basic dhcpd config):
 
  
ddns-update-style interim;
+
Create a copy of the {{ic|tftpd.service}} unit, and modify {{ic|ExecStart}} with the appropriate directory to use as the tftp root.
+
subnet *'''your subnet'''* netmask *'''your netmask'''* {
+
        option routers                  *'''IP of your router'''*;
+
        option subnet-mask              *'''your subnet again'''*;
+
+
        option domain-name              "'''here you can put your domain name if you dont have one take example.com'''";
+
+
        option time-offset              -18000;    # Eastern Standard Time
+
        next-server *'''IP of your machine where dhcpd is running'''*;
+
        filename "pxelinux.0";
+
+
        allow booting;
+
        allow bootp;
+
+
        range *'''the range of ip addresses your dhcpd is allow to take, example: 10.0.0.10 10.0.0.200'''*;
+
}
+
  
Remove the ** from the config.
+
{{hc|# vim /etc/systemd/system/tftpd.service|2=
 +
[Unit]
 +
Description=hpa's original TFTP daemon
  
Run <code>mkpxelinux</code>, which will put the required boot files in <code>/var/tftpboot</code>.
+
[Service]
 +
ExecStart=/usr/sbin/in.tftpd -s /srv/tftp/
 +
StandardInput=socket
 +
StandardOutput=inherit
 +
StandardError=journal}}
  
~# mkpxelinux -c=/etc/mkpxelinux.conf
+
[[Systemd#Replacing_provided_unit_files]] talks in more detail about customizing unit files.
  
This will create all images and stuff to boot.
+
== Run ==
  
Now we replace the kernel and the initrd.img with the newest from the install iso.
+
Start tftpd:
$ wget ftp://ftp.archlinux.org/other/0.8/i686/ftp-0.8-beta2-20070222-i686.iso
+
When the download is finished, we nearly finished.
+
# mount -o loop /where/the/iso/is/located /path/to/mount/
+
# cp /path/to/mount/isolinux/initd.img /var/tftpboot/
+
# cp /path/to/mount/isolinux/vmlinuz /var/tftpboot/
+
  
Now last config and then we can load all the stuff:
+
  # systemctl start tftpd.socket tftpd.service
  # nano /etc/hosts.allow
+
Add these lines:
+
tftpd: ALL
+
in.tftpd: ALL
+
  
Now do:
+
To start tftpd on boot:
# /etc/rc.d/tftpd start
+
  
Note: The tftpd server will fail to start if you disabled ipv6 support in your kernel. You will need to edit /etc/conf.d/tftpd and add --ipv4 to the beginning of the TFTPD_ARGS string.
+
# systemctl enable tftpd.socket
  
And in a terminal:
+
See [[Systemd#Using_units]] for more information on manipulating services.
# dhcpcd
+
 
+
Now you can start the PC you want to install.
+
 
+
Good Luck!
+

Revision as of 06:44, 6 February 2013

The Trivial File Transfer Protocol (TFTP) provides a minimalistic means for transferring files. It is generally used as a part of PXE booting or for updating configuration and firmware on devices which have limited memory such as routers and printers.

This article describes how to set up a tftpd server under Arch Linux using the tftp-hpa package.

Installation

Install the package tftp-hpa which can be found in the official repositories.

Configuration

Create a copy of the tftpd.service unit, and modify ExecStart with the appropriate directory to use as the tftp root.

# vim /etc/systemd/system/tftpd.service
[Unit]
Description=hpa's original TFTP daemon

[Service]
ExecStart=/usr/sbin/in.tftpd -s /srv/tftp/
StandardInput=socket
StandardOutput=inherit
StandardError=journal

Systemd#Replacing_provided_unit_files talks in more detail about customizing unit files.

Run

Start tftpd:

# systemctl start tftpd.socket tftpd.service

To start tftpd on boot:

# systemctl enable tftpd.socket

See Systemd#Using_units for more information on manipulating services.