New IT forum
26 June 2022, 06:10:17 pm *
Welcome, %1$s. Please login or register.

: PiHub now in stock.
 
Pages: [1]

Author Topic: How to setup a TFTP server for use by a PlugComputer  (Read 9438 times)

bigbear59

  • Full Member
  • ***
  • Posts: 118
How to setup a TFTP server for use by a PlugComputer
« on: 13 March 2014, 07:37:31 pm »

WINDOWS:
On your Windows machine,
  • Download:
       http://tftpserver.codeplex.com/downloads/get/244121
  • Unzip
       03/13/2014  11:05 AM           428,032 setup.exe
       03/13/2014  11:05 AM           501,760 SetupTFTPServer.msi
  • Run setup.exe
  • Open a CMD window & run control firewall.cpl
               
  • click on
       Allow a program or feature
       through Windows Firewall

             
  • Allow TFTPServer to communicate through Windows Firewall
               
  • Configure the TFTP Server address
             

             

             
  • Configure TFTP file path
             

SheevaPlug:
On the SheevaPlug set up the IP addresses of the Server & the Plug
Code: [Select]
Marvell>> setenv ipaddr 192.168.24.213
Marvell>> setenv serverip 192.168.24.182
Marvell>> saveenv
Load a file
Code: [Select]
Marvell>> tftp 0x08000000 uboot-3.4.27.bin
Using egiga0 device
TFTP from server 192.168.24.182; our IP address is 192.168.24.213
Filename 'uboot-3.4.27.bin'.
Load address: 0x8000000
Loading: #################################################################
         ############################
done
Bytes transferred = 474592 (73de0 hex)
Logged
Cheers,
BigBear59

bigbear59

  • Full Member
  • ***
  • Posts: 118
Re: How to setup a TFTP server for use by a PlugComputer
« Reply #1 on: 14 March 2014, 11:43:27 pm »

Debian Linux
   Originally from: http://www.cyberciti.biz/faq/install-configure-tftp-server-ubuntu-debian-howto/

Code: [Select]
# apt-get install tftpd-hpa
Configuration

Edit /etc/default/tftpd-hpa, run:
Code: [Select]
# vi /etc/default/tftpd-hpa
Sample configuration:
Code: [Select]
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"

How do I start / stop / restart tftpd-hpa server?

Type the following commands:
Code: [Select]
service tftpd-hpa status
service tftpd-hpa stop
service tftpd-hpa start
service tftpd-hpa restart
service tftpd-hpa force-reload

Next, you need to place all boot files in /srv/tftp directory. You can create a directory structure as follows for various operating systems and third party firmwares:
Code: [Select]
# cd /srv/tftp
# mkdir {openbsd,freebsd,netbsd}
# mkdir -p linux/{debian,ubuntu,rhel,centos,fedora,suse}
# mkdir -p firmwares/{linksys,cisco,soekris,pata,sata,ipmi,nic}
# ls -l
# ls -l linux/
# ls -l firmwares/

How do I test my tftpd server?

You need to install tftp client called tftp. It is the user interface to the Internet TFTP (Trivial File Transfer Protocol), which allows users to transfer files to and from a remote machine. The remote host may be specified on the command line, in which case tftp uses host as the default host.

Install trivial file transfer protocol client (tftp)

Type the following command:
Code: [Select]
# apt-get install tftp
Sample outputs:
Code: [Select]
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  tftp
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 18.9 kB of archives.
After this operation, 53.2 kB of additional disk space will be used.
Get:1 http://debian.osuosl.org/debian/ squeeze/main tftp amd64 0.17-18 [18.9 kB]
Fetched 18.9 kB in 1s (10.5 kB/s)
Selecting previously deselected package tftp.
(Reading database ... 281794 files and directories currently installed.)
Unpacking tftp (from .../tftp_0.17-18_amd64.deb) ...
Processing triggers for man-db ...
Setting up tftp (0.17-18) ...

Test the tftpd server

In this example, I am putting pxeboot file (second-stage PXE bootstrap for network installs) from OpenBSD.org in /srv/tftp/openbsd/ directory to retrieve with a client, for testing purpose:
Code: [Select]
# cd /srv/tftp/openbsd/
# wget http://ftp.openbsd.org/pub/OpenBSD/5.2/i386/pxeboot

Sample outputs:
Code: [Select]
--2012-12-01 17:17:09--  http://ftp.openbsd.org/pub/OpenBSD/5.2/i386/pxeboot
Resolving ftp.openbsd.org... 129.128.5.191
Connecting to ftp.openbsd.org|129.128.5.191|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 53920 (53K) [text/plain]
Saving to: `pxeboot'
 
100%[======================================>] 53,920      53.0K/s   in 1.0s
 
2012-12-01 17:17:10 (53.0 KB/s) - `pxeboot' saved [53920/53920]

I am also downloading bsd.rd file. It is a compressed RAMDISK kernel; the embedded filesystem contains the installation tools:
Code: [Select]
# wget http://ftp.openbsd.org/pub/OpenBSD/5.2/i386/bsd.rd
Sample outputs:
Code: [Select]
--2012-12-01 17:17:25--  http://ftp.openbsd.org/pub/OpenBSD/5.2/i386/bsd.rd
Resolving ftp.openbsd.org... 129.128.5.191
Connecting to ftp.openbsd.org|129.128.5.191|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6422208 (6.1M) [text/plain]
Saving to: `bsd.rd'
17% [=====>                                 ] 11,42,782   20.3K/s  eta 3m 47s

Finally, verify that both files are downloaded and installed correctly at the /srv/tftp/openbsd/ location:
Code: [Select]
# ls -l /srv/tftp/openbsd/
Sample outputs:
Code: [Select]
total 6344
-rw-r--r-- 1 root root 6422208 Dec  1 17:20 bsd.rd
-rw-r--r-- 1 root root   53920 Aug  1 22:02 pxeboot
Type the following command from the remote client:
Code: [Select]
$ tftp tftp-server-ip-here
$ tftp 192.168.1.5

Sample outputs
Code: [Select]
tftp> status
Connected to 192.168.1.5.
Mode: netascii Verbose: off Tracing: off
Rexmt-interval: 5 seconds, Max-timeout: 25 seconds
tftp> get openbsd/pxeboot
Received 54234 bytes in 0.0 seconds
tftp> get openbsd/bsd.rd
Received 6465608 bytes in 0.5 seconds
tftp> quit

Firewall configuration

Add firewall rules to your firewall script to open required ports:

Code: [Select]
## make sure you load the following modules first ##
modprobe ip_conntrack_tftp
modprobe  ip_conntrack_ftp
 
## firewall rules to open tcp/udp tftpd port 69  for 192.168.1.0/24 ##
/sbin/input -A INPUT -s 192.168.1.0/24 -m tcp -p tcp --dport 69 -j ACCEPT
/sbin/input -A INPUT -s 192.168.1.0/24 -m tcp -p udp  --dport 69 -j ACCEPT


Logged
Cheers,
BigBear59
Pages: [1]
 
 

Powered by MySQL Powered by PHP SMF 2.0.10 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!