Detailed process of configuring the TFTP server and NFS network in Ubuntu

Source: Internet
Author: User

I wrote a TFTP configuration under ubuntu10.04 last night. The tftp server configuration here uses the old method, but it can still be used. Although the TFTP and NFS network configurations are very simple, but due to a long time not needed, today I will go back and implement these two configuration processes, and the results are really depressing, it seems that you cannot ignore the knowledge you have learned before, and you have to strengthen it when you are free.

Next, let's summarize some of the problems that have emerged today. Let's talk about some of the problems configured by TFTP, which are summarized as follows:

After the TFTP configuration is successful, you can test the upload and download operations on the PC. This indicates that TFTP has been configured successfully and is normal. After the target board is set to uboot, when environment variables such as ethaddr, ipaddr, and serverip are set, ping the host. However, the target board of the host is successfully pinged. Why?

To solve this problem, I questioned whether the configuration of the TFTP server was successful. The results were repeated several times and finally ended in failure. This problem still occurs in the case of TFTP-server testing in windows. Finally, I changed the uboot test and still failed. Depressing !!!! This is so depressing, I did not expect to be overwhelmed by this small TFTP. If the target board is not connected to the main board, the experiment behind me will not be able to continue. It is really troublesome and anxious. Although it cannot be too urgent, it has been a long time, you can't waste any more. After two laps, I suddenly thought that nnd is connected to the target board with a network cable. It is connected to the PC with a wired Ethernet port, that is, eth0, I am now connected to the wireless interface wlan0. Therefore, if you click Enable again, you can immediately disconnect wlan0 wireless connection, enable eth0 to connect to the target board, and use ifconfig eth0 192.168.0.112 to configure the Host IP address. After the configuration is successful, ping again. Sure enough, it is successful !!!!! Although this problem is a bit white, it really took me a lot of time to find it. Ah, it's a good solution.

 

Next, let's talk about some problems with NFS network configuration. The problems are as follows:

When the configuration is successful and the test is performed locally, why does the mounting fail:

CPC @ Ubuntu :~ $ Sudo Mount-t nfs 192.168.0.112:/home/CPC/nfs/mnt/nfs
Mount. NFS: Access denied by server while mounting 192.168.0.112:/home/CPC/nfs

This problem is really tricky, but it has also been successfully solved for the following reasons:

1: No port ing Enabled

Run # sudo/etc/rc. d/init. d/Portmap start (if not, run: # sudo/etc/init. d/Portmap start. If not, run the following command:

# Sudo service Portmap start (this line is absolutely successful)

2: Set "/home/CPC/nfs 192.168.0. * (RW, sync, no_subtree_check)" in/etc/exports )"

Rewrite it to "/home/CPC/nfs * (RW, sync, no_root_squash )".

In this way, the above problems can be solved.

 

Next we will discuss in detail how to configure the TFTP server and NFS network.

1. TFTP Server Configuration

1.1 install tftpd, TFTP, and OpenBSD-inetd

# Sudo apt-Get install tftpd

# Sudo apt-Get install TFTP

# Sudo apt-Get install OpenBSD-inetd

 

1.2 create the tftpboot directory in the user's home directory and set its Read Permission

Mkdir/home/CPC/tftpboot

Chmod 777/home/CPC/tftpboot

 

1.3 modify the configuration file/etc/inetd. conf.

# Sudo Vim/etc/inetd. conf open the file

Add the following content to the bottom of the file:

TFTP dgram udp wait nobody/usr/sbin/tcpd/usr/sbin/in. tftpd/home/CPC/tftpboot

Note: The last/home/CPC/tftpboot is the directory of the TFTP server.

 

1.4 modify


/Etc/xinetd. d/TFTP configuration file (if no
Create a TFTP file)

# Sudo Vim/etc/xinetd. d/TFTP open the file and change it to the following style:

Service tftp
{
Disable = No
Socket_type = dgram
Protocol = UDP
Wait = Yes
User = root
Server =/usr/sbin/in. tftpd
Server_args =-S/home/CPC/tftpboot-C
Source = 11
CPIs = 100 2
}

Of course, the above server_args parameters can be modified according to the actual situation.

 

1.5 modify


The/etc/default/tftpd-HPA file is as follows:

#/Etc/default/tftpd-HPA
Run_daemon = "no"
Options = "-S/home/CPC/tftpboot-C-p-u tftpd"

 

1.6 enable the Service

Sudo/etc/init. d/OpenBSD-inetd
Reload

 

Sudo/etc/init. d/xinetd restart

Sudo in. tftpd-L/home/CPC/tftpboot

 

 

1.7 test whether the configuration is successful (skip this section)

---------------------------------------------------

2. NFS Network File System Configuration

 

2.1 installation
NFS Server Installation
Nfs-kernel-Server

You can use the new software package manager to install or # sudo apt-Get install nfs-kernel-Server

2.2 create an NFS directory in the root directory of the user and change the Directory Permissions

Mkdir/home/CPC/nfs

Chmod 777/home/CPC/nfs

 

2.3 modify the/etc/exports configuration file as follows:

#
/Etc/exports: the access control list for filesystems which may be
Exported

# To NFS clients. See
Exports (5 ).

#

# Example for nfsv2 and
Nfsv3:

#/Srv/homes
Hostname1 (RW
, Sync)
Hostname2 (Ro
, Sync)

#

# Example for nfsv4:

#/Srv/nfs4
GSS/krb5i (RW
, Sync
, Fsid = 0
, Crossmnt)

#/Srv/nfs4/homes
GSS/krb5i (RW
, Sync)


/Home/CPC/nfs * (RW, sync, no_root_squash)

 

2.4 After the configuration is modified, start the Portmap service and the NFS-kernel-Server service.

Sudo service Portmap start (start Portmap port ing)

Sudo/etc/init. d/nfs-kernel-Server
Restart (start NFS service)

 

2.5 Test

You can mount the NFS file system to/mnt/and view the file content under/mnt. If you can view the content under/mnt, the NFS Network File System is successfully configured. In this way, when running the Embedded Target Board, you can set the environment variable bootargs so that it can mount the file system on NFS to facilitate debugging.

<! --
@ Page {margin: 2 cm}
P {margin-bottom: 0.21}
-->

Mount-T NFS
192.168.0.112:/home/CPC/nfs // mnt

Then, view the LS/mnt content.

 

--------------------- End of the article ---------------------

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.