| Service name | server | client | Explanation |
|---|---|---|---|
| portmap | ○ | ○ | TCP RPC program number/Convert to IP port number |
| nfsd | ○ | File system export and client request processing | |
| mountd | ○ | Remote file system mount and unmount |
portmap##
/etc/rpc
portmapper 100000 portmap sunrpc rpcbind
rstatd 100001 rstat rup perfmeter rstat_svc
rusersd 100002 rusers
nfs 100003 nfsprog
ypserv 100004 ypprog
mountd 100005 mount showmount
--TCP/UDP port numbers are dynamically assigned. --In other words, in order for the RPC client to use it, it is first necessary to know the port number. --portmap returns the port number of the corresponding service when inquired by the RPC client. --A program that provides services using RPC registers its information in portmap at startup.
--You can check the connection status of the RPC service with ** rpcinfo **.
rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
To start the service:
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
Publishing a specific directory on the NFS server side is called ** export **. The export directory is described in **/etc/exports **.
/etc/exports
/share 192.168.1.0/255.2255.255.0(rw)
/pub *.example.com(ro)
| /etc/exports options | Explanation |
|---|---|
| ro | Read-only |
| rw | Read / write |
| no_root_squash | Execute with root privileges when accessing as root |
| root_squash | Execute with anonymous account privileges when accessing as root |
| all_squash | Perform all access with anonymous account privileges |
Use ** exports ** to view the export status and reflect changes in/etc/exports.
| exports options | Explanation |
|---|---|
| -a | Export all directories/Unexport |
| -r | Re-export all directories |
| -u | Unexport |
| -v | Detail View |
Use ** showmount ** to find out which directories you are exporting.
| showmount options | Explanation |
|---|---|
| -a | Show client host name and mounted directory |
| -e | Show directories exported on the specified host |
Use ** nfsstat ** to look up NFS statistics.
| nfsstat options | Explanation |
|---|---|
| -s | Show only NFS server statistics |
| -c | View only NFS client-side statistics |
| -n | Show NFS statistics only |
| -r | Show RFC statistics only |
| -o net | View network layer statistics |
--Use ** mount ** to mount the remote file system using NFS. --Specify nfs for the file type system. --Prepare a directory to be a mount point on the local file system.
mount -t nfs linux:/pib /mnt/nfs
| NFS-specific mount options | Explanation |
|---|---|
| bg | Try in the background even if the mount fails |
| fg | Run in the foreground |
| soft | Soft mount |
| hard | Hard mount |
| intr | Allow interrupts at heart mount |
| retrans | Number of retries for soft mount |
| nolock | Do not lock files |
| rsize= | Read block size |
| wsize= | Write block size |
You can put it in/etc/fstab so that the remote file system can be mounted automatically when the system boots.
linux:/pib /mnt/nfs nfs defaults 0 0
AWS has EFS, so it seems unnecessary, but the article below was well organized. Build NFS server/client on EC2 ✳️ NFSv4 or later, no portmap, rpcbind, nfslock required
Recommended Posts