Setting up a TFTP server in Ubuntu
1th Step: Installing TFTP
The software required to install TFTP. First you need to install TFTP-HPA,TFTPD-HPA, the former is the client, the latter is the service program,
Under Terminal, enter the sudo apt-get install tftp-hpa tftpd-hpa, install TFTP-HPA and TFTPD-HPA. Then
Also need to install XINETD, under the terminal input sudo apt-get install xinetd, install good xinetd.
Step 2nd: Configure/etc/xinetd.conf
Configure the related service files. Go to the Etc folder in the root directory (cd/etc/), first look at the directory there is not a
xinetd.conf file, if not create a new, some words to see the content, see if it is consistent with the following, if inconsistent
Modify the contents as follows:
# Simple configuration file for xinetd
#
# Some defaults, and include/etc/xinetd.d/
Defaults
{
# Please note the need a log_type line to be able to use log_on_success
# and Log_on_failure. The default is the following:
# log_type = SYSLOG Daemon Info
}
Includedir/etc/xinetd.d
Step 3rd: Configure/ETC/DEFAULT/TFTPD-HPA
Configuring the TFTP server
Command:
sudo vim/etc/default/tftpd-hpa
Modify the content to
#/ETC/DEFAULT/TFTPD-HPA
Tftp_username= "TFTP"
tftp_directory= "/tftpboot"
#这是你 The working directory of the TFTP server, modify it yourself, and note that when creating a new working directory, it is best to modify its permissions to 777.
Command sudo chmod 777/tftpboot
Tftp_address= "0.0.0.0:69"
Tftp_options= "-l-c-S"
Step 4th: Configure/ETC/XINETD.D/TFTP
Then go to the Xinetd.d folder (CD Xinetd.d) to see if there is a TFTP file, and if not, create a new
One, if there is a word to see if the content is consistent with the following, inconsistent is modified, the content is as follows:
Service TFTP
{
Socket_type = Dgram
Wait = yes
Disable = no
user = root
protocol = UDP
Server =/USR/SBIN/IN.TFTPD
Server_args =-s/tftpboot
#log_on_success + = PID HOST DURATION
#log_on_failure + = HOST
Per_source = 11
CPS = 100 2
Flags =ipv4
}
Where the Server_args line is the location where the files of the configuration server are stored, that is, the TFTP transfer is from
Search for files in this folder
Step 5th: Modify Permissions
Modify the permissions for the folder you want. The folder that needs to be modified is the document that the server file that was mentioned in the previous step
Folders, take my profile as an example, create a folder (sudo mkdir/tftpboot), and then take it to
Set to access the most permissive (sudo chmod 777/tftpboot), or set the appropriate permissions.
Step 6th: Restart Service
Restart the service. sudo service tftpd-hpa Restart, which is also a step I often neglect when configured with TFTP
file, you need to restart xinetd, enter sudo/etc/init.d/xinetd reload in the terminal, reload a
Next process, then enter sudo/etc/init.d/xinetd Restart and restart the service. Remember, each time you finish modifying the configuration file, you need to
To restart the service.
Execution order:
sudo service tftpd-hpa restart
SUDO/ETC/INIT.D/XINETD Reload
sudo/etc/init.d/xinetd restart
Summarize:
The TFTP server can be set up by the above four steps and can be tested locally first. or in my configuration.
File as an example, first create a new file in/tftpboot, and then enter the content in it, then enter a
/tftpboot directory (the reason is to avoid confusion because when getting the file is, the default is to store the file you want to get when
In the previous directory); Enter sudo tftp localhost in the terminal and enter the TFTP command hyphenating (where you can enter help
Check the function of commands and commands), enter get file, if there is no prompt, the transfer is successful, and then enter the Q
Exit the TFTP command, in the current directory you can see a file, the content is with the start of the new file content
is the same. You can also enter a put XX in the TFTP command and upload the xx file to the server folder. If a
Cut OK, then one of the available TFTP servers was successfully built.
For the tests above are for local testing, if you want to make a TFTP transfer to another computer or development Board,
Terminal input sudo tftp (ie the IP address of the target computer or the target Development Board), but also to turn off the Ubuntu self-
Fire wall (The book says), I was directly to the firewall to uninstall (sudo apt-get remove iptables, or sudo ufw disable
Can turn off the firewall), because I think for Linux, the firewall may not need to put, at least so far I
Haven't been attacked yet ... Of course, if you want to connect with a computer or board in another LAN,
The IP of some machines to the same segment. Well, through the above steps, you can pass the TFTP protocol on the PC and the Development Board
Transfer of files between the Linux kernel and the file system to the Development Board. If a friend finds out
My shortcomings, can be brought to me, we can also discuss. However, it is important to emphasize that my configuration
Is for Ubuntu, there may be some differences in other systems.
NFS server built in Ubuntu
Environment Ubuntu 10.4 VM 7.1
Terminal
Ifconfig get Ubuntu data
InetAddr 192.168.1.116
Bcast 192.168.1.255
MASK 255.255.255.0
One installation of NFS
$ sudo apt-get install Nfs-kernel-server
$ sudo apt-get install Nfs-common
Two configuration/etc/exports
$ sudo vi/etc/exports
Add text at the end
/root/rootfs * (Rw,sync,no_root_squash,no_subtree_check)
Then perform $chmod 777-r/root/rootfs in the terminal
$ sudo showmount-e
Show Clnt-create:rpc:program not registered
$ sudo exportfs-r update
$ sudo showmount localhost-e
Show
Export list for 192.168.1.116
/ROOT/ROOTFS *
Three-enable
$ sudo/etc/init.d/nfs-kernel-server Restart Restart NFS Service
Shown below
* Stopping NFS kernel daemon [OK]
* unexporting directories for NFS kernel daemon ... [OK]
* Exporting directories for NFS kernel daemon ... [OK]
* Starting NFS kernel daemon [OK]
Mount Test
$ mount-t nfs-o nolock localhost:/root/rootfs/mnt
After execution, enter the/mnt directory, if you can see the contents of/root/rootfs, then the NFS build success!
Uboot set the TFTP server IP address (Ubuntu IP address)
TFTP 0x4000000 Uimage
Download the Uimage file from the TFTP server's TFTP directory to the 0x4000000 of the memory
Uboot setting parameters for the kernel to mount Rootfs in NFS
Setenv Bootargs ' gpmi=g console=ttyam0,115200n8 root=/dev/nfs nfsroot=192.168.1.189:/root/rootfs/rootfs ip= 192.168.1.10:192.168.1.189:192.168.1.0:255.255.255.0::eth0:off '
This article from "Whylinux" blog, declined reprint!
M283-TFTP Transmission, NFS Mount Rootfs