Install and Configure nfs for Ubuntu in VMware

Source: Internet
Author: User
Tags reverse dns
Configuration: Install Ubuntu10.04 System in vmware: windowsXP connection: the Development Board is connected to the PC through RS232 and a cross network cable as follows: 1. Virtual Machine Settings (skip this step if the network is already set to bridge) 1. Before starting ubuntu, set the Ethernet (network) connection mode to Bridge (Bridge). 2. Start ubuntu and set the static IP address (which must be in the same network segment as the Development Board) lingd @ ubuntu :~ Configuration: Install Ubuntu10.04 in vmware. System: windows XP connection: the Development Board is connected to the PC through RS232 and a cross network cable.
The method is as follows: 1. Virtual Machine Settings (skip this step if the network is already set in the bridging mode) 1. Before starting ubuntu, set the Ethernet (network) set connection mode to Bridge (Bridge Mode) 2. Start ubuntu, set static IP address (must be in the same network segment as the Development Board) lingd @ ubuntu :~ $ Sudo ifconfig eth0 192.168.0.26 netmask 255.255.255.0
2. Install NFS1 for ubuntu and NFSlingd @ ubuntu :~ $ Sudo apt-get install nfs-kernel-server two software packages nfs-common and portmap are installed at the same time. 2. Modify the NFS configuration file lingd @ ubuntu :~ $ Vi/etc/exports content:/home/lingd/arm 192.168.0. * (rw, sync, no_root_squash, no_subtree_check)
/Home/lingd/arm --- directory 192.168.0 to be shared. * --- the CIDR block that can be accessed, including the IP address, Host Name (which can be parsed by the server), and * (which can be accessed by all users) (rw, sync, no_root_squash, no_subtree_check) --- rw: read/write permissions Sync: synchronous data writing to memory and Hard Disk No_root_squash: the server allows remote systems to access this directory with root privileges. No_subtree_check: Disable the subtree check. For other options, refer to man exports.
3. Start the service and restart the portmapper (Port ing) Service lingd @ ubuntu :~ $ Sudo service portmap restartportmap start/running, process 550 restart NFS service lingd @ ubuntu :~ $ Sudo service nfs-kernel-server restart * Stopping NFS kernel daemon [OK] * Unexporting directories for NFS kernel daemon... [OK] * Exporting directories for NFS kernel daemon... [OK] * Starting NFS kernel daemon [OK]

3. Test 1. Mount lingd @ ubuntu on the local machine :~ $ Ls/mnt/nfs/lingd @ ubuntu :~ $ Sudo mount-t nfs-o nolock localhost:/home/lingd/arm // mnt/nfs/lingd @ ubuntu :~ $ Ls/mnt/nfs/cross-3.4.1.tar.bz2 linux-2.6.12 uploaddownload msap vmwarls-ls-8.1.3-203739.tar.gzdsdt_2000012.16.8b.zip ntp vmware-tools-distribDSDT_2.8b protocol-converter installation package lingd @ ubuntu :~ $ Sudo umount/mnt/nfs lingd @ ubuntu :~ $ Ls/mnt/nfs/
2. Install lingd @ ubuntu on the Development Board :~ $ Telnet 192.168.0.25 2009 Trying 192.168.0.25... Connected to 192.168.0.25.Escape character is '^]'.
(None) login: rootPassword :~ # Ls/mnt ext1 ext2 ~ # Mount-t nfs-o nolock 192.168.0.26:/home/lingd/arm/mnt ~ # Ls/mntDSDT_2.8b msapdsdt_21_12.16.8b.zip ntpVMwareTools-8.1.3-203739.tar.gz protocol-convertercross-3.4.1.tar.bz2 uploaddownload vmware-tools-distriblinux-2.6.12 installation package ~ # Umount/mnt ~ # Ls/mntext1 ext2 ~ #
Iv. Cause of failed mounting of nfs file system 1. nfs error message Too many levels of remote in path: Try to mount an existing File System Permission denied: The NFS server does not allow the client to be mounted, or the user does not exist on the server. No such host: DNS configuration error No such file or directory: Normally, the accessed directory does not exist. NFS server is not responding: Generally, NFS has exceeded the load or NFS has stopped working. Stale file handle: Files accessed by the client are deleted before the NFS client is closed. Fake hostname: Forward and reverse DNS records do not exist under the NFS client. 2. Reasons for mounting the nfs file system failure (1) host and network failure: check whether the network connection, host and Development Board ip address are in the same network segment, and whether the firewall is disabled. Not only does the firewall of linux in vmware need to be disabled, but the firewall of xp outside vmware must also be disabledI was unable to mount nfs because of the firewall of the eset anti-virus software in xp (local hosts and remote hosts could not be mounted). After a day, I discovered that it was a ghost of the firewall in xp!
(2) The mount command used is incorrect. You can refer to the above example to change it; or refer to the nfs man document for man nfs, which contains the usage introduction and option explanation of mount in nfs.
(3) the nfs configuration file/etc/exports is incorrectly configured. You can refer to the example above to modify it; or man exports to check the man document of/etc/exports.
(4) restart the NFS and portmap services if necessary. Sudo service portmap restartsudo service nfs-kernel-server restart
(5) The kernel does not support NFS and RPC services (you may need to reconfigure, compile, and burn the kernel ). Common kernel options include CONFIG_NFS_FS = m, CONFIG_NFS_V3 = y, CONFIG _ NFSD = m, CONFIG_NFSD_V3 = y, and CONFIG_SUNRPC = m. The rpcinfo command is used to display the system's RPC Information. Generally, the-p parameter is used to list the RPC service of a host. When the rpcinfo-p command checks the server, you should be able to see portmapper, status, mountd, nfs, and nlockmgr. When you use this command to check the client, you should be able to see at least the portmapper service (the Development Board may not include this command ). According to rpcinfo-p, nfs adopts port 2049 and portmapper adopts port 111.
V. nfs-related configuration files and commands 1, /Etc/exportsThe main configuration file of NFS, but the system does not have the default value, so this file may not exist (you need to create it yourself ).
2, /Usr/sbin/exportfsCommands used to maintain NFS shared resources are used on the nfs server. After modifying/etc/exports, you only need to use exportfs to scan/etc/exports again and re-set the loading. It is not necessary to restart the nfs service command format: the exportfs [-aruv] parameters are described as follows. (1)-a: Mount or unmount all directories in the/etc/exports file (export or unexpect. (2)-r: reexport the directory in/etc/exports and synchronize the content in/var/lib/nfs/etab with/etc/exports. (3)-u: unmount some directories. (4)-v: displays the exportfs processing information.
3, /Usr/sbin/showmountUsed to view the directory resources shared by NFS on the specified host, mainly used on the Client side. Command Format: showmount [-ade] hostname/Server IP address parameters are described as follows. (1)-a or-all: displays the client host name and mounted directory in host: dir format. (2)-d or-directories: Only displays the directory name mounted by the customer. (3)-e or-exports: displays the NFS shared directory of the specified nfs server.
4, /Var/lib/nfs/etab/Etc/exports lists the directories that users want to share with nfs, while/var/lib/nfs/etab lists the directories actually shared by ubuntu. It records the complete permission settings for the directories shared by NFS. /Var/lib/nfs/etab is maintained by exportfs. Each exportfs scans/etc/exports to create a new/var/lib/nfs/etab, mountd reads the file whenever an nfs client requests to mount a shared directory to detect the permissions of the client and directory. The shared directories in/var/lib/nfs/etab are stored in the kernel nfs shared table.
5. parsing of other nfs-Related Files /Var/lib/nfs/etabContains information about what filesystems shocould be exported to whom at the moment. /Var/lib/nfs/rmtabContains a list of which filesystems actually are mounted by certain clients at the moment. /Proc/fs/nfs/exportsContains information about what filesystems are exported to actual client (individual, not subnet or whatever) at the moment. /Var/lib/nfs/xtaB is the same information as/proc/fs/nfs/exports but is maintained by nfs-utils instead of directly by the kernel. it is only used if/proc isn't mounted. * /Var/lib/nfs/etab: The/etc/exports file only contains a wish list. etab is created by exportfs. it contains on each line detailed information about the options used when exporting a file system towards a single client. it's the reference file used by rpc. mountd when started * /Proc/fs/nfs/exportsContains the clients list as known by the kernel * /Var/lib/nfs/xtab: Use for accuracy when etab holds client names and machines groups with wildcards. This file only contains explicit machine names .* /Var/lib/nfs/rmtab: Each line shows the client's name and the file system imported from this server;

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.