Differences between revisions 4 and 38 (spanning 34 versions)
Revision 4 as of 2008-08-14 01:44:45
Size: 1736
Editor: CarlNobile
Comment:
Revision 38 as of 2016-08-16 21:17:56
Size: 4070
Editor: CarlNobile
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
I have put this HOWTO together from various sources which I will list at the end. I will discuss the process of setting up a server and using a client. I have put this HOWTO together from various sources which I will list at the end. Discuss here is the process of setting up a server and using a client. I'm not going to get very wordy here as this is really a reference for myself. However, if you want to contact me concerning this document, follow the link at the bottom of this page for my contact info.
Line 7: Line 7:
On Debian type systems you can install the the packages as shown below: On Debian derived systems you can install the server packages as shown below:
Line 10: Line 10:
sudo apt-get install nfs-kernel-server nfs-common portmap sudo apt-get install nfs-kernel-server nfs-common rpcbind
Line 15: Line 15:
If you need to reconfigure the portmap run the next two commands. Do not bind to loopback. '''Do not bind portmap to the loopback. If you need to reconfigure the portmap run the first of the next two commands or edit {{{/etc/default/portmap}}} by hand then restart the servers.'''
Line 24: Line 24:
Edit the {{{/etc/export}}} file. Edit the {{{/etc/exports}}} file.
Line 26: Line 26:
The following line will permit all 254 C class addresses on the private net to access this mount. The following line will permit all 254 C class addresses on the private net specified to access this mount.
Line 29: Line 29:
/home 192.168.1.1/24(rw,no_root_squash,no_subtree_check,async) /home 192.168.1.0/24(rw,no_root_squash,no_subtree_check,async,insecure)
Line 32: Line 32:
This line will permit all 65534 C class addresses on the private net to access this mount. This line will permit all 65534 C class addresses on the private net specified to access this mount.
Line 35: Line 35:
/home 192.168.0.0/16(rw,no_root_squash,no_subtree_check,async) /home 192.168.0.0/16(rw,no_root_squash,no_subtree_check,async,insecure)
Line 38: Line 38:
You must execute the following commands after any edit to the {{{/etc/export}}} file. You must execute the following commands after any edit to the {{{/etc/exports}}} file.

Reread the {{{/etc/exports}}} file.

{{{
sudo exportfs -ra
}}}

Restart the nfs server.
Line 42: Line 50:
sudo exportfs -a }}}

'''Note: See [[ipcalc]] for details of determining the network parameters.'''

== TCP Wrappers ==

In the {{{/etc/hosts.deny}}} file deny everything.

{{{
ALL: ALL: \
spawn ( DATE=`date`; /bin/echo $DATE %d %u %c >> /var/log/wrapper-deny.log )
}}}

In the {{{/etc/hosts.allow}}} file add {{{portmap, mountd, nfsd, lockd, rquotad, statd}}}.

{{{
ALL: 127.0.0.1

portmap, mountd, nfsd, lockd, rquotad, statd, sshd, cvs : \
127.0.0.1, \
some.domain.org, \
some.domain.net : \
spawn ( DATE=`date`; /bin/echo $DATE %d %u %c >> /var/log/wrapper-allow.log )
Line 51: Line 81:
Line 54: Line 83:
First make a mount point on your remote machine where you want this mount to be located. First make a mount point on your remote machine where you want the server mount to be located.
Line 58: Line 87:
sudo mkdir -p shares/home sudo mkdir -p /exports/{host}/home
Line 61: Line 90:
This will mount your {{{/home}}} directory to {{{/share/home}}} on the remote machine. The following will mount your remote {{{/home}}} directory to {{{/export/{host}/home}}} on the client machine.
Line 64: Line 93:
sudo mount -t nfs myserver.mydomain.org:/home /shares/home sudo mount -t nfs {host}.mydomain.org:/home /export/{host}/home
Line 69: Line 98:
+++You will need to restart the servers below:+++ '''You will need to restart the servers using the commands below:'''
Line 75: Line 104:

== Auto Mounting ==

Install the autofs package:

{{{
sudo apt-get install autofs
}}}

Edit the {{{/etc/auto.master}}} file adding the following line.

{{{
/exports/{host} /etc/auto.{host} --timeout=60
}}}

Create the {{{/etc/auto.{host}}}} file and add the lines for your mounts.

{{{
someuser -rw,soft,bg,intr {host}.mydomain.org:/home/someuser
iso -rw,soft,bg,intr {host}.mydomain.org:/extra0/iso
Video -rw,soft,bg,intr {host}.mydomain.org:/extra1/Video
}}}

I make a directory path at the root system named {{{/exports/{host} }}} where host is the host name of the machine I am mounting shares from.

{{{
sudo mkdir -p /exports/{host}
}}}

== Boot Mounting ==

Edit {{{/etc/fstab}}} adding the following line:

{{{
host.mydomain.org:/home /exports/{host}/{home} nfs rw,bg,intr 0 0
}}}

Look at the [[http://linux.die.net/man/5/nfs|nfs manual page]] for other mounting options.

To test your edit type in a terminal the following command:

{{{
mount /exports/{host}/{home}
}}}

== Useful Links ==

http://ubuntuforums.org/showthread.php?t=249889

http://tldp.org/HOWTO/NFS-HOWTO/

https://help.ubuntu.com/community/SettingUpNFSHowTo

http://www.linux-consulting.com/Amd_AutoFS/autofs-5.html

NFS HOWTO

I have put this HOWTO together from various sources which I will list at the end. Discuss here is the process of setting up a server and using a client. I'm not going to get very wordy here as this is really a reference for myself. However, if you want to contact me concerning this document, follow the link at the bottom of this page for my contact info.

Getting the Packages

On Debian derived systems you can install the server packages as shown below:

sudo apt-get install nfs-kernel-server nfs-common rpcbind

Configuring portmap

Do not bind portmap to the loopback. If you need to reconfigure the portmap run the first of the next two commands or edit /etc/default/portmap by hand then restart the servers.

sudo dpkg-reconfigure portmap
sudo /etc/init.d/portmap restart

Configuring NFS

Edit the /etc/exports file.

The following line will permit all 254 C class addresses on the private net specified to access this mount.

/home 192.168.1.0/24(rw,no_root_squash,no_subtree_check,async,insecure)

This line will permit all 65534 C class addresses on the private net specified to access this mount.

/home 192.168.0.0/16(rw,no_root_squash,no_subtree_check,async,insecure)

You must execute the following commands after any edit to the /etc/exports file.

Reread the /etc/exports file.

sudo exportfs -ra

Restart the nfs server.

sudo /etc/init.d/nfs-kernel-server restart

Note: See ipcalc for details of determining the network parameters.

TCP Wrappers

In the /etc/hosts.deny file deny everything.

ALL:    ALL: \
spawn ( DATE=`date`; /bin/echo $DATE %d %u %c >> /var/log/wrapper-deny.log )

In the /etc/hosts.allow file add portmap, mountd, nfsd, lockd, rquotad, statd.

ALL: 127.0.0.1

portmap, mountd, nfsd, lockd, rquotad, statd, sshd, cvs : \
127.0.0.1, \
some.domain.org, \
some.domain.net : \
spawn ( DATE=`date`; /bin/echo $DATE %d %u %c >> /var/log/wrapper-allow.log )

Installing Just the Client Software

sudo apt-get install portmap nfs-common

Manual Mounting

First make a mount point on your remote machine where you want the server mount to be located.

cd /
sudo mkdir -p /exports/{host}/home

The following will mount your remote /home directory to /export/{host}/home on the client machine.

sudo mount -t nfs {host}.mydomain.org:/home /export/{host}/home

You may not need the -t nfs in the above command.

You will need to restart the servers using the commands below:

sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-common restart

Auto Mounting

Install the autofs package:

sudo apt-get install autofs

Edit the /etc/auto.master file adding the following line.

/exports/{host}  /etc/auto.{host}  --timeout=60

Create the /etc/auto.{host} file and add the lines for your mounts.

someuser -rw,soft,bg,intr  {host}.mydomain.org:/home/someuser
iso      -rw,soft,bg,intr  {host}.mydomain.org:/extra0/iso
Video    -rw,soft,bg,intr  {host}.mydomain.org:/extra1/Video

I make a directory path at the root system named /exports/{host}  where host is the host name of the machine I am mounting shares from.

sudo mkdir -p /exports/{host}

Boot Mounting

Edit /etc/fstab adding the following line:

host.mydomain.org:/home /exports/{host}/{home} nfs rw,bg,intr 0 0

Look at the nfs manual page for other mounting options.

To test your edit type in a terminal the following command:

mount /exports/{host}/{home}

http://ubuntuforums.org/showthread.php?t=249889

http://tldp.org/HOWTO/NFS-HOWTO/

https://help.ubuntu.com/community/SettingUpNFSHowTo

http://www.linux-consulting.com/Amd_AutoFS/autofs-5.html

NFS HOWTO (last edited 2016-08-16 21:17:56 by CarlNobile)