Difference between revisions of "TFTP"

From ArchWiki
Jump to: navigation, search
m (Run)
(28 intermediate revisions by 19 users not shown)
Line 1: Line 1:
[[Category:HOWTOs (English)]]
+
[[Category:File Transfer Protocol]]
Okay i want to describe here how to set up a tftpd server under Arch Linux.
+
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.
  
At first thing is to install all necessary stuff:
+
This article describes how to set up a tftpd server under Arch Linux using the {{Pkg|tftp-hpa}} package.
  
pacman -S mkpxelinux tftpd-hpa dhcpd
+
== Installation ==
 +
[[pacman|Install]] the package {{Pkg|tftp-hpa}} which can be found in the [[Official Repositories|official repositories]].
  
Now we need to do some configure stuff at first we will create our dhcpd.conf file.
+
== Configuration ==
  
The config is located in /etc/
+
Create a copy of the {{ic|tftpd.service}} unit, and modify {{ic|ExecStart}} with the appropriate directory to use as the tftp root.
  
and have to look like this (basic dhcpd config)
+
{{hc|# vim /etc/systemd/system/tftpd.service|2=
 +
[Unit]
 +
Description=hpa's original TFTP daemon
  
 +
[Service]
 +
ExecStart=/usr/sbin/in.tftpd -s /srv/tftp/
 +
StandardInput=socket
 +
StandardOutput=inherit
 +
StandardError=journal}}
  
ddns-update-style interim;
+
[[Systemd#Replacing_provided_unit_files]] talks in more detail about customizing unit files.
+
subnet *your subnet here* netmask *here your netmask* {
+
        option routers                  *here ip of your router*;
+
        option subnet-mask              *your subnet here 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 *here ip of your machine where dhcpd is running*;
+
        filename "pxelinux.0";
+
+
        allow booting;
+
        allow bootp;
+
+
+
        range *here the range of ip addresses your dhcpd is allow to take example: 10.0.0.10 10.0.0.200;
+
}
+
  
remove the ** form the config ;).
+
== Run ==
  
after this you have to run
+
Start tftpd:
  
  mkpxeboot -a
+
  # systemctl start tftpd.socket tftpd.service
  
this will create all images and stuff to boot.
+
To start tftpd on boot:
Now we replace the kernel and the initrd.img with the newest from the install iso.
+
  
  wget ftp://ftp.archlinux.org/other/0.8/i686/ftp-0.8-beta2-20070222-i686.iso
+
  # systemctl enable tftpd.socket
  
when download is finished we nearly finished.
+
See [[Systemd#Using_units]] for more information on manipulating services.
 
+
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
+
 
+
nano/vi/joe... /etc/hosts.allow
+
+
and add this line:
+
tftpd: ALL
+
in.tftpd: ALL
+
 
+
now do
+
 
+
/etc/rc.d/tftpd start
+
and in a terminal
+
dhcpd
+
 
+
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.