Simple setup for NFS in Linux

Source: Internet
Author: User
NFS is a good shared storage system, but performance is not as good under high load conditions.
This is a long time ago to write something, there is nothing wrong hope everyone correct:)
10.0.0.1-nfs Server
10.0.0.2-nfs Client
On NFS server:
===============
Shared directory:/nfspool
NFS Running User: Nfsnobody
# Mkdir/nfspool
# Vi/etc/exports
/nfspool 10.0.0.2 (rw,async,anonuid=65534,anongid=65534)
# mkdir-p/nfspool
# chown Nfsnobody:nfsnobody/nfspool
# Chown-r nfsnobody:nfsnobody/nfspool/.
# service Portmap Start
# service Nfslock Start
# Service NFS Start
On the NFS client:
===============
Remote NFS shared directory mount point:/usr/local/nfs
# service Portmap Start
# Mkdir/usr/local/nfs
# chown Nfsnobody:nfsnobody/usr/local/nfs
# chmod 777/usr/local/nfs
# mount-t Nfs-o soft,intr,bg,timeo=50 10.0.0.1:/nfspool/usr/local/nfs
# Vi/etc/fstab
10.0.0.1:/nfspool/usr/local/nfs NFS soft,intr,bg,timeo=50 0 0
Notes & Notes
===========
1. Exports parameter description
------------------
RW: Read/write mode;
Async: Asynchronous disk read and write;
Anonu (g) ID: Specifies the anonymous user that NFS uses when it operates Uid/gid
2. NFS Management Commands
---------------
SHOWMOUNT-E perform this command on NFS server to display all shared volumes on NFS server;
SHOWMOUNT-E 10.0.0.1 Perform this command on the NFS client to display all shared volumes on NFS server;
EXPORT-AV Export all volumes according to/etc/exports;
EXPORT-RV re-export all volumes, add new items in/etc/exports, delete non-existent items, update changed items;
3. NFS-related files
---------------
/etc/exports
is one of the most basic configuration files for NFS server, which lists the shared file systems and the hosts that allow access to those file systems.
/proc/fs/nfs/exports
The kernel view of the exported file list, including the exported parameters.
/var/lib/nfs/etab
The status file, which lists the current advanced list. This file contains all of the items in the same format in/etc/exports, along with the items that were imported manually by Exportfs-i.
/var/lib/nfs/rmtab
A status file that lists the remote client list for the attached export file.
/var/lib/nfs/xtab
Status file, the current bottom-level export manifest.
4. The writing rules of client in/etc/exports
----------------------------------
(1) Single host
You can use a short name and a fully qualified name, or use an IP address, such as student01, student01.flying.com.cn, or 192.168.10.1, to be a valid host name.
(2) Net-group
You can list the entire set of hosts that are defined in the/etc/netgroup file or in the NFS Subnet group map. The net group name begins with @.
(3) Wildcard host
*.discuz.net *.*.comsenz.com
(4) Mask
192.168.1.0/255.255.255.0
5. Order of starting and stopping
-----------
Start:
Portmap
Nfslock
Nfs
Stop it:
Nfslock
Nfs
Portmap
6. Security
---------
portmap:111
nfs:2049
Prevents the use of IP spoofing and RPC redirection techniques to attack through the LO Loopback and to qualify the authorized host:
Iptables-a input-p udp-d 127.0.0.1--dport 111-j DROP
Iptables-a input-p udp-d 127.0.0.1--dport 2049-j DROP
Iptables-a input-p udp-s 10.0.0.2--dport 111-j ACCEPT
Iptables-a input-p udp-s 10.0.0.2--dport 2049-j ACCEPT

=============================================================
Optimized for NFS
  • Related 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.