User:Renich/HowTo/NFSv4

From FedoraProject

< User:Renich | HowTo(Difference between revisions)
Jump to: navigation, search
(first draft (editing))
 
(finished formating (still some format bugs to fix))
Line 5: Line 5:
  
 
== Applicable to Fedora Versions ==
 
== Applicable to Fedora Versions ==
Fedora Core 6+
+
* Fedora 12
Fedora 7
+
  
 
== Requirements ==
 
== Requirements ==
Everything comes preinstalled on an "out-of-the-box" installation of Fedora Core. The following are only services.
+
Everything comes preinstalled on an "out-of-the-box" installation of Fedora. The following are only services.
  
 
=== Server requirements ===
 
=== Server requirements ===
nfs
+
* nfs
rpc.idmapd
+
* rpc2
  
 
=== These are the client's requirements ===
 
=== These are the client's requirements ===
nfs
+
* nfs
nfslock
+
* nfslock
rpc.idmapd
+
* rpc2
  
'''Note''': The rpc.nfsd and rpc.rquotad services that are needed are started by the nfs service. Most of them don't need user configuration. rpc.lockd, rpc.statd and rpc.mountd are not used by NFSv4.
+
{{admon/note|The rpc.nfsd and rpc.rquotad services that are needed are started by the nfs service. Most of them don't need user configuration. rpc.lockd, rpc.statd and rpc.mountd are not used by NFSv4.}}
  
  
Line 27: Line 26:
 
=== Configuring the server ===
 
=== Configuring the server ===
  
Open up the necessary port on the firewall (port: 2049). Activate the "Security Level and Firewall" tool. You will be asked for your root password. Please enter it:
+
# Open up the necessary port on the firewall (port: 2049). Activate the "Security Level and Firewall" tool. You will be asked for your root password. Please enter it:  
su -c "system-config-securitylevel"
+
<pre>su -c "system-config-securitylevel"</pre>
Activate "NFS4" and click "OK".
+
 
Edit /etc/idmapd.conf. Enter your root password when prompted:
+
# Activate "NFS4" and click "OK".
su -c "gedit /etc/idmapd.conf"
+
 
Configure your domain name and change the users to nfsnobody:
+
# Edit /etc/idmapd.conf. Enter your root password when prompted: <pre>su -c "gedit /etc/idmapd.conf"</pre>
 +
 
 +
# Configure your domain name and change the users to nfsnobody:
 +
<pre>
 
[General]
 
[General]
 
Domain = example.com
 
Domain = example.com
Line 39: Line 41:
 
Nobody-User = nfsnobody
 
Nobody-User = nfsnobody
 
Nobody-Group = nfsnobody
 
Nobody-Group = nfsnobody
Start the rpcidmapd and nfslock services, then start the nfs service. Alternatively, you can use System->Administration->Services or System->Administration->Server Settings->Services GUIs. Please enter the root password when prompted:
+
</pre>
 +
 
 +
# Start the rpcidmapd and nfslock services, then start the nfs service. Alternatively, you can use System->Administration->Services or System->Administration->Server Settings->Services GUIs. Please enter the root password when prompted:
 +
<pre>
 
su -c "/sbin/service rpcidmapd start"
 
su -c "/sbin/service rpcidmapd start"
 
su -c "/sbin/service nfslock start"
 
su -c "/sbin/service nfslock start"
 
su -c "/sbin/service nfs start"
 
su -c "/sbin/service nfs start"
Set rpcidmapd, nfslock, and nfs services to start on boot.Alternatively, you can use System->Administration->Services or System->Administration->Server Settings->Services GUIs. Please enter the root password when prompted:
+
</pre>
 +
 
 +
# Set rpcidmapd, nfslock, and nfs services to start on boot.Alternatively, you can use System->Administration->Services or System->Administration->Server Settings->Services GUIs. Please enter the root password when prompted:
 +
<pre>
 
su -c "/sbin/chkconfig --level 345 rpcidmapd on"
 
su -c "/sbin/chkconfig --level 345 rpcidmapd on"
 
su -c "/sbin/chkconfig --level 345 nfslock on"
 
su -c "/sbin/chkconfig --level 345 nfslock on"
 
su -c "/sbin/chkconfig --level 345 nfs on"
 
su -c "/sbin/chkconfig --level 345 nfs on"
Create the dirs of the exports inside "/nfs4exports". Enter your root password when prompted:
+
</pre>
su -c "mkdir -p /nfs4exports/{share1,share2,share3}"
+
 
Edit /etc/fstab:
+
# Create the dirs of the exports inside "/nfs4exports". Enter your root password when prompted:
su -c "gedit /etc/fstab"
+
<pre>su -c "mkdir -p /nfs4exports/{share1,share2,share3}"</pre>
Bind the desired shares to the, recently created, dirs at /nfs4exports:
+
 
 +
# Edit /etc/fstab:
 +
<pre>su -c "gedit /etc/fstab"</pre>
 +
 
 +
# Bind the desired shares to the, recently created, dirs at /nfs4exports:
 +
<pre>
 
/path/to/share1 /nfs4exports/share1 none bind 0 0
 
/path/to/share1 /nfs4exports/share1 none bind 0 0
 
/path/to/share2 /nfs4exports/share2 none bind 0 0
 
/path/to/share2 /nfs4exports/share2 none bind 0 0
 
/path/to/share3 /nfs4exports/share3 none bind 0 0
 
/path/to/share3 /nfs4exports/share3 none bind 0 0
Remount everything. Enter your root password when prompted:
+
</pre>
su -c "mount -a"
+
 
Edit /etc/exports. Enter your root password when prompted:
+
# Remount everything. Enter your root password when prompted:
su -c "gedit /etc/exports"
+
<pre>su -c "mount -a"</pre>
Add your shares here (available to your home network) If you want your shares to be read only, change "rw" to "ro" from these statements:
+
 
 +
# Edit /etc/exports. Enter your root password when prompted:
 +
<pre>su -c "gedit /etc/exports"</pre>
 +
 
 +
# Add your shares here (available to your home network) If you want your shares to be read only, change "rw" to "ro" from these statements:
 +
<pre>
 
/nfs4exports 192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide,fsid=0)
 
/nfs4exports 192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide,fsid=0)
 
/nfs4exports/share1 192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
 
/nfs4exports/share1 192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
 
/nfs4exports/share2            192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
 
/nfs4exports/share2            192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
 
/nfs4exports/share3            192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
 
/nfs4exports/share3            192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
Reload your exports. Please enter your root password when prompted:
+
</pre>
su -c "/usr/sbin/exportfs -rv"
+
Edit your /etc/hosts.allow file, so your clients are allowed to access your nfs. Please enter your root password when prompted:
+
su -c "gedit /etc/hosts.allow"
+
Allow your LAN to access your services:
+
ALL: 192.168.1.0/255.255.255.0
+
Reboot:
+
su -c "/sbin/shutdown -r now"
+
Configuring the clients:
+
  
Edit /etc/idmapd.conf. Enter your root password when prompted:
+
# Reload your exports. Please enter your root password when prompted:
su -c "gedit /etc/idmapd.conf"
+
<pre>su -c "/usr/sbin/exportfs -rv"</pre>
Configure your domain name and change the users to nfsnobody:
+
 
 +
# Edit your /etc/hosts.allow file, so your clients are allowed to access your nfs. Please enter your root password when prompted:
 +
<pre>su -c "gedit /etc/hosts.allow"</pre>
 +
 
 +
# Allow your LAN to access your services:
 +
<pre>rpcbind: 192.168.1.0/255.255.255.0</pre>
 +
 
 +
# Reboot:
 +
<pre>su -c "/sbin/shutdown -r now"</pre>
 +
 
 +
=== Configuring the clients ===
 +
# Edit /etc/idmapd.conf. Enter your root password when prompted:
 +
<pre>su -c "gedit /etc/idmapd.conf"</pre>
 +
 
 +
# Configure your domain name and change the users to nfsnobody:
 +
<pre>
 
[General]
 
[General]
 
Domain = example.com
 
Domain = example.com
Line 83: Line 108:
 
Nobody-User = nfsnobody
 
Nobody-User = nfsnobody
 
Nobody-Group = nfsnobody
 
Nobody-Group = nfsnobody
Edit /etc/fstab. Please enter your root password when prompted:
+
</pre>
su -c "gedit /etc/fstab"
+
 
Create the mounting dirs:
+
# Edit /etc/fstab. Please enter your root password when prompted:
su -c "mkdir /mnt/shares /home/me/share1 /home/he/share2 /home/it/share3"
+
<pre>su -c "gedit /etc/fstab"</pre>
Add the desired shares:
+
 
 +
# Create the mounting dirs:
 +
<pre>su -c "mkdir /mnt/shares /home/me/share1 /home/he/share2 /home/it/share3"</pre>
 +
 
 +
# Add the desired shares:
 +
<pre>
 
<ip-address-to-server>:/ /mnt/shares nfs4 rsize=8192,wsize=8192,timeo=14,intr
 
<ip-address-to-server>:/ /mnt/shares nfs4 rsize=8192,wsize=8192,timeo=14,intr
 
<ip-address-to-server>:/ /home/me/share1 nfs4 rsize=8192,wsize=8192,timeo=14,intr
 
<ip-address-to-server>:/ /home/me/share1 nfs4 rsize=8192,wsize=8192,timeo=14,intr
 
<ip-address-to-server>:/ /home/he/share2 nfs4 rsize=8192,wsize=8192,timeo=14,intr
 
<ip-address-to-server>:/ /home/he/share2 nfs4 rsize=8192,wsize=8192,timeo=14,intr
 
<ip-address-to-server>:/ /home/it/share3 nfs4 rsize=8192,wsize=8192,timeo=14,intr
 
<ip-address-to-server>:/ /home/it/share3 nfs4 rsize=8192,wsize=8192,timeo=14,intr
Remount everything:
+
</pre>
su -c "mount -a"
+
 
Troubleshooting
+
# Remount everything:
How to test
+
<pre>su -c "mount -a"</pre>
 +
 
 +
== Troubleshooting==
 +
 
 +
== How to test ==
 
Next time...
 
Next time...
Common problems and fixes
+
 
 +
== Common problems and fixes ==
 
Later...
 
Later...
More Information
+
 
 +
== More Information ==
 
RedHat recommends, on RHEL5 Docs, that one should use automount instead of /etc/fstab; which saves resources when sharing to multiple workstations. I haven't had the time to try this configuration. This document will be modified/augmented once I've got the hang of it.
 
RedHat recommends, on RHEL5 Docs, that one should use automount instead of /etc/fstab; which saves resources when sharing to multiple workstations. I haven't had the time to try this configuration. This document will be modified/augmented once I've got the hang of it.
Disclaimer
+
 
 +
== Disclaimer ==
 
I haven't had te opportunity to test this HowTo since I lack of a networked PC to do it, so you may run into problems, if you do, come to #fedora on irc.freenode.net or leave me messages so I know what's up. Feel free to propose changes and stuff.
 
I haven't had te opportunity to test this HowTo since I lack of a networked PC to do it, so you may run into problems, if you do, come to #fedora on irc.freenode.net or leave me messages so I know what's up. Feel free to propose changes and stuff.
  
Added Reading
+
== Added Reading ==
 
http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Network_Related_Configuration/ch-nfs.html
 
http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Network_Related_Configuration/ch-nfs.html
 
http://www.brennan.id.au/19-Network_File_System.html
 
http://www.brennan.id.au/19-Network_File_System.html

Revision as of 02:35, 26 September 2009

Contents

Sharing files with NFSv4 on Fedora 7 (Server -> Multi)

Description

This HowTo explains how to set up the Network File System version 4 on your LAN for multiple shares. It explains, also, how to mount the "exports" on your client.

Applicable to Fedora Versions

  • Fedora 12

Requirements

Everything comes preinstalled on an "out-of-the-box" installation of Fedora. The following are only services.

Server requirements

  • nfs
  • rpc2

These are the client's requirements

  • nfs
  • nfslock
  • rpc2
Note.png
The rpc.nfsd and rpc.rquotad services that are needed are started by the nfs service. Most of them don't need user configuration. rpc.lockd, rpc.statd and rpc.mountd are not used by NFSv4.


Doing the Work

Configuring the server

  1. Open up the necessary port on the firewall (port: 2049). Activate the "Security Level and Firewall" tool. You will be asked for your root password. Please enter it:
su -c "system-config-securitylevel"
  1. Activate "NFS4" and click "OK".
  1. Edit /etc/idmapd.conf. Enter your root password when prompted:
    su -c "gedit /etc/idmapd.conf"
  1. Configure your domain name and change the users to nfsnobody:
[General]
Domain = example.com

[Mapping]
Nobody-User = nfsnobody
Nobody-Group = nfsnobody
  1. Start the rpcidmapd and nfslock services, then start the nfs service. Alternatively, you can use System->Administration->Services or System->Administration->Server Settings->Services GUIs. Please enter the root password when prompted:
su -c "/sbin/service rpcidmapd start"
su -c "/sbin/service nfslock start"
su -c "/sbin/service nfs start"
  1. Set rpcidmapd, nfslock, and nfs services to start on boot.Alternatively, you can use System->Administration->Services or System->Administration->Server Settings->Services GUIs. Please enter the root password when prompted:
su -c "/sbin/chkconfig --level 345 rpcidmapd on"
su -c "/sbin/chkconfig --level 345 nfslock on"
su -c "/sbin/chkconfig --level 345 nfs on"
  1. Create the dirs of the exports inside "/nfs4exports". Enter your root password when prompted:
su -c "mkdir -p /nfs4exports/{share1,share2,share3}"
  1. Edit /etc/fstab:
su -c "gedit /etc/fstab"
  1. Bind the desired shares to the, recently created, dirs at /nfs4exports:
/path/to/share1		/nfs4exports/share1	none	bind	0 0
/path/to/share2		/nfs4exports/share2	none	bind	0 0
/path/to/share3		/nfs4exports/share3	none	bind	0 0
  1. Remount everything. Enter your root password when prompted:
su -c "mount -a"
  1. Edit /etc/exports. Enter your root password when prompted:
su -c "gedit /etc/exports"
  1. Add your shares here (available to your home network) If you want your shares to be read only, change "rw" to "ro" from these statements:
/nfs4exports			192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide,fsid=0)
/nfs4exports/share1		192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
/nfs4exports/share2             192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
/nfs4exports/share3             192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
  1. Reload your exports. Please enter your root password when prompted:
su -c "/usr/sbin/exportfs -rv"
  1. Edit your /etc/hosts.allow file, so your clients are allowed to access your nfs. Please enter your root password when prompted:
su -c "gedit /etc/hosts.allow"
  1. Allow your LAN to access your services:
rpcbind: 192.168.1.0/255.255.255.0
  1. Reboot:
su -c "/sbin/shutdown -r now"

Configuring the clients

  1. Edit /etc/idmapd.conf. Enter your root password when prompted:
su -c "gedit /etc/idmapd.conf"
  1. Configure your domain name and change the users to nfsnobody:
[General]
Domain = example.com

[Mapping]
Nobody-User = nfsnobody
Nobody-Group = nfsnobody
  1. Edit /etc/fstab. Please enter your root password when prompted:
su -c "gedit /etc/fstab"
  1. Create the mounting dirs:
su -c "mkdir /mnt/shares /home/me/share1 /home/he/share2 /home/it/share3"
  1. Add the desired shares:
<ip-address-to-server>:/	/mnt/shares	nfs4	rsize=8192,wsize=8192,timeo=14,intr
<ip-address-to-server>:/	/home/me/share1	nfs4	rsize=8192,wsize=8192,timeo=14,intr
<ip-address-to-server>:/	/home/he/share2	nfs4	rsize=8192,wsize=8192,timeo=14,intr
<ip-address-to-server>:/	/home/it/share3	nfs4	rsize=8192,wsize=8192,timeo=14,intr
  1. Remount everything:
su -c "mount -a"

Troubleshooting

How to test

Next time...

Common problems and fixes

Later...

More Information

RedHat recommends, on RHEL5 Docs, that one should use automount instead of /etc/fstab; which saves resources when sharing to multiple workstations. I haven't had the time to try this configuration. This document will be modified/augmented once I've got the hang of it.

Disclaimer

I haven't had te opportunity to test this HowTo since I lack of a networked PC to do it, so you may run into problems, if you do, come to #fedora on irc.freenode.net or leave me messages so I know what's up. Feel free to propose changes and stuff.

Added Reading

http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Network_Related_Configuration/ch-nfs.html http://www.brennan.id.au/19-Network_File_System.html