Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Set up a nfs file server-- Super detail

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Nfs is the abbreviation of Network File System.

The function of nfs is to enable different machines and different operating systems to share files with each other through the network. So think of it as a file server. This nfs server allows pc to mount the directory shared by the nfs server on the network to the local file system, and the directory of the remote host is as if it were a disk partition of its own.

The environment for this lab:

Centos6.5

Service side: 192.168.1.185

Client side: 192.168.1.171

Requirements description:

1. Share the / test on the service side to 192.168.1.171, which can be written, synchronized, and accessed with root privileges

two。 Share / test1 with the 192.168.1.0 appert 24 network segment, writable and asynchronous.

3. Regardless of the identity of the login nfs, it is compressed to an anonymous user. (nobody)

The steps of the experiment:

1. Check to see if nfs is installed

# rpm-qa | grep nfs # check whether nfs is installed

Nfs-utils-lib-1.1.5-6.el6.x86_64

Nfs4-acl-tools-0.3.3-6.el6.x86_64

Nfs-utils-1.2.3-39.el6.x86_64

# rpm-qa | grep rpcbind # check whether rpcbind is installed

Rpcbind-0.2.0-11.el6.x86_64

two。 Start the service:

[root@localhost ~] # service nfs start

Start the NFS service: [OK]

Turn off NFS quota: [OK]

Start NFS mountd: [OK]

Start the NFS daemon: [OK]

Starting RPC idmapd: [OK]

[root@localhost ~] # service rpcbind start

3. Edit the configuration file:

Note: / etc/exports is the configuration file of nfs, and the system does not have a default value, so this file may not exist, if you do not need to create it manually

# vim / etc/exports

/ test 192.168.1.171 (rw,sync,no_root_squash) # requirement 1

/ test1 192.168.1.0 test1 24 (rw,async) # requirement 2

4. Restart the service:

Service nfs restart

Service rpcbind restart

5. Server-side settings / test1 has write permissions locally

Chmod otakw / test1/

6. Client test

# mkdir-p / data/test

# mkdir-p / tmp/test1

# mount 192.168.1.185:/test / data/test/

# mount 192.168.1.185:/test1 / tmp/test1/

Df-h query

192.168.1.185:/test 18G 4.9G 12G 30% / data/test

192.168.1.185:/test1 18G 4.9G 12G 30% / tmp/test1

# mount | tail-2

192.168.1.185:/test on / data/test type nfs (rw,vers=4,addr=192.168.1.185,clientaddr=192.168.1.171)

192.168.1.185:/test1 on / tmp/test1 type nfs (rw,vers=4,addr=192.168.1.185,clientaddr=192.168.1.171)

So far, requirements 1 and 2 have been completed.

Requirement 3 maps all users to nfsnobody

7. Modify the configuration file:

/ test 192.168.1.171 (rw,sync,all_squash)

/ test1 192.168.1.0 Compact 24 (rw,async,all_squash)

8. Clear the permissions for the previous lab:

Chmod Omurw / test1/

9. Add access control list:

# setfacl-m u:nfsnobody:rwx / test1/

10. Client test

Detailed description of parameters:

Rw # # the permissions of this directory are read / write

Ro # # the permissions of this directory are read-only

Sync # # indicates that data is written to memory and hard disk synchronously.

Async # the representative secretary is temporarily stored in memory

No_root_squash # Open clients use root identity

All_squash # regardless of the identity of logging in to nfs, it is compressed to anonymous users.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report