<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux and Virtualization &#187; NFS</title>
	<atom:link href="http://fclose.com/b/linux/tag/nfs/feed/" rel="self" type="application/rss+xml" />
	<link>http://fclose.com/b/linux</link>
	<description>Clear solutions, tutorials and tips on Linux and virtualization from the author&#039;s experience with clusters.</description>
	<lastBuildDate>Sat, 04 Feb 2012 04:40:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Set Up and Configure NFS Server and Clients</title>
		<link>http://fclose.com/b/linux/3396/how-to-set-up-and-configure-nfs-server-and-clients/</link>
		<comments>http://fclose.com/b/linux/3396/how-to-set-up-and-configure-nfs-server-and-clients/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 15:42:09 +0000</pubDate>
		<dc:creator>Zhiqiang Ma</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Client config]]></category>
		<category><![CDATA[Command line]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[NFS]]></category>
		<category><![CDATA[Server config]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://fclose.com/b/linux/?p=3396</guid>
		<description><![CDATA[NFS is widely deployed and used even after more than twenty year. NFS is easy to set up and easy to use. This introduces how to set up the NFS server and clients. We use the Fedora system as the example. Set up a NFS Server Configure /etc/exports to give clients the permission to use [...]]]></description>
			<content:encoded><![CDATA[<p>NFS is widely deployed and used even after more than twenty year. NFS is easy to set up and easy to use. This introduces how to set up the NFS server and clients. We use the Fedora system as the example.</p>
<h3>Set up a NFS Server</h3>
<p>Configure /etc/exports to give clients the permission to use the NFS directories.</p>
<h4>Edit /etc/exports</h4>
<p>For example, to allow the servers inside subnet 10.0.0.1/24 to mount the /home directory with read/write permission. Add this line to /etc/exports:</p>
<pre>/home 10.0.0.1/24(rw)</pre>
<p>For details of the exports functions, please refer to <a href="http://fclose.com/p/linux/man/5-exports/">export manual</a>.</p>
<h4>Start up the NFS service</h4>
<p>Enable nfs service on the NFS server so that the NFS service daemon automatically starts each time the server starts:</p>
<pre># /sbin/chkconfig nfs on</pre>
<p>You may also manually start it</p>
<pre># service nfs start</pre>
<h3>Client-slide configuration</h3>
<h4>Package installation</h4>
<pre># yum nfs-utils</pre>
<h4>Start the rpcbind service</h4>
<pre># service rpcbind restart</pre>
<p>You may also set it to start automatically</p>
<p># chkconfig rpcbind on</p>
<h4>Mount the NFS directory</h4>
<pre># mount NFS_SERVER:/lhome/userdir MOUNT_POINT</pre>
<p>where NFS_SERVER is the NFS server&#8217;s address, and MOUNT_POINT is the local mount point on the client side for the NFS directory.</p>
<p>You may also consider using autofs on top of NFS as described in <a href="/281/unified-linux-login-and-home-directory-using-openldap-and-nfsautomount/">Unified Linux Login and Home Directory Using OpenLDAP and NFS/automount</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://fclose.com/b/linux/3396/how-to-set-up-and-configure-nfs-server-and-clients/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing Ports Used by NFS Server</title>
		<link>http://fclose.com/b/linux/1668/fixing-ports-used-by-nfs-server/</link>
		<comments>http://fclose.com/b/linux/1668/fixing-ports-used-by-nfs-server/#comments</comments>
		<pubDate>Sat, 22 May 2010 15:02:00 +0000</pubDate>
		<dc:creator>Zhiqiang Ma</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Client config]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[NFS]]></category>
		<category><![CDATA[Server config]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://pkill.info/blog/?p=1668</guid>
		<description><![CDATA[The ports used by NFS server can be dynamically assigned by rpbind to any higher number. We need to fix the ports used by NFS server to configure firewall or port forwarding mechanism. The ports used by NFS server and how to fix these ports will be introduced in this post. There are seven ports [...]]]></description>
			<content:encoded><![CDATA[<p>The ports used by NFS server can be dynamically assigned by <em>rpbind </em>to any higher number. We need to fix the ports used by NFS server to configure firewall or port forwarding mechanism. The ports used by NFS server and how to fix these ports will be introduced in this post.</p>
<p>There are seven ports need to be taken care of for NFS server.</p>
<h3>1. <em>rpcbind</em>&#8216;s listening port</h3>
<p><em>rpcbind</em> listens on TCP and UDP port <strong>111</strong>. It is the default port number and it doesn&#8217;t require special configuration.</p>
<h3>2. <em>nfsd</em>&#8216;s listening port</h3>
<p><em>nfsd</em> listens on TCP and UDP port <strong>2049</strong>. It is also the default port number and it doesn&#8217;t require special configuration.</p>
<h3>3. Fix ports for RQUOTAD_PORT, MOUNTD_PORT, LOCKD_TCPPORT, LOCKD_UDPPORT and STATD_PORT</h3>
<p>These five ports should be configured to be fixed to avoid <em>rpcbind</em> assign random port for it.</p>
<p>Uncomment or add these lines to <em>/etc/sysconfig/nfs</em>:</p>
<pre>RQUOTAD_PORT=875
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
STATD_PORT=662</pre>
<p>After restarting <em>nfs</em> and <em>rpcbind</em>, only these seven ports are needed for setting up NFS server.</p>
<p>The ports used by NFS RPC-based service can be listed by:</p>
<pre>$ rpcinfo -p</pre>
<p>This is a sample output of this command:</p>
<pre>program vers proto   port
100000    2   tcp    111  portmapper
100000    2   udp    111  portmapper
100024    1   udp    662  status
100024    1   tcp    662  status
100011    1   udp    875  rquotad
100011    2   udp    875  rquotad
100011    1   tcp    875  rquotad
100011    2   tcp    875  rquotad
100003    2   udp   2049  nfs
100003    3   udp   2049  nfs
100003    4   udp   2049  nfs
100021    1   udp  32769  nlockmgr
100021    3   udp  32769  nlockmgr
100021    4   udp  32769  nlockmgr
100021    1   tcp  32803  nlockmgr
100021    3   tcp  32803  nlockmgr
100021    4   tcp  32803  nlockmgr
100003    2   tcp   2049  nfs
100003    3   tcp   2049  nfs
100003    4   tcp   2049  nfs
100005    1   udp    892  mountd
100005    1   tcp    892  mountd
100005    2   udp    892  mountd
100005    2   tcp    892  mountd
100005    3   udp    892  mountd
100005    3   tcp    892  mountd</pre>
<p>We can configure the firewall to only allow connections to these ports to enhance security. Please note that NFS is not secure enough and it need other mechanisms if you want to set up a SECURE NFS server.</p>
<h3>Sample configuration files</h3>
<p>Here is my configuration files for NFS:</p>
<p><em><strong>/etc/sysconfig/nfs :</strong><br />
</em></p>
<pre># Define which protocol versions mountd
# will advertise. The values are "no" or "yes"
# with yes being the default
#MOUNTD_NFS_V1="no"
MOUNTD_NFS_V2="no"
MOUNTD_NFS_V3="no"
#
#
# Path to remote quota server. See rquotad(8)
#RQUOTAD="/usr/sbin/rpc.rquotad"
#RQUOTAD=no
# Port rquotad should listen on.
RQUOTAD_PORT=875
# Optinal options passed to rquotad
#RPCRQUOTADOPTS=""
#
# Optional arguments passed to in-kernel lockd
#LOCKDARG=
# TCP port rpc.lockd should listen on.
LOCKD_TCPPORT=32803
# UDP port rpc.lockd should listen on.
LOCKD_UDPPORT=32769
#
#
# Optional arguments passed to rpc.nfsd. See rpc.nfsd(8)
# Turn off v2 and v3 protocol support
#RPCNFSDARGS="-N 2 -N 3"
# Turn off v4 protocol support
#supportRPCNFSDARGS="-N 4"
# Number of nfs server processes to be started.
# The default is 8.
#RPCNFSDCOUNT=8
# Stop the nfsd module from being pre-loaded
#NFSD_MODULE="noload"
#
#
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
#RPCMOUNTDOPTS=""
# Port rpc.mountd should listen on.
MOUNTD_PORT=892
#
#
# Optional arguments passed to rpc.statd. See rpc.statd(8)
#STATDARG=""
# Port rpc.statd should listen on.
STATD_PORT=662
# Outgoing port statd should used. The default is port
# is random
#STATD_OUTGOING_PORT=2020
# Specify callout program
#STATD_HA_CALLOUT="/usr/local/bin/foo"
#
#
# Optional arguments passed to rpc.idmapd. See rpc.idmapd(8)
#RPCIDMAPDARGS=""
#
# Set to turn on Secure NFS mounts.
#SECURE_NFS="yes"
# Optional arguments passed to rpc.gssd. See rpc.gssd(8)
#RPCGSSDARGS="-vvv"
# Optional arguments passed to rpc.svcgssd. See rpc.svcgssd(8)
#RPCSVCGSSDARGS="-vvv"
# Don't load security modules in to the kernel
#SECURE_NFS_MODS="noload"
#
# Don't load sunrpc module.
#RPCMTAB="noload"
#</pre>
<p><em><strong>/etc/exports :</strong><br />
</em></p>
<pre>/lhome 10.0.0.1/24(rw)
/lhome 10.0.1.1/24(rw)
/lhome 143.89.135.171(rw)</pre>
<p><span style="font-size: x-small"><strong>Update history:</strong><br />
Jul. 27, 2010. Add RQUOTAD_PORT.<br />
Sep. 11, 2010. Add sample configuration files.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://fclose.com/b/linux/1668/fixing-ports-used-by-nfs-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Up a NFS Server on Top of tmpfs /dev/shm</title>
		<link>http://fclose.com/b/linux/1636/setting-up-a-nfs-server-on-top-of-tmpfs-devshm/</link>
		<comments>http://fclose.com/b/linux/1636/setting-up-a-nfs-server-on-top-of-tmpfs-devshm/#comments</comments>
		<pubDate>Tue, 11 May 2010 05:29:51 +0000</pubDate>
		<dc:creator>Zhiqiang Ma</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Client config]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[NFS]]></category>
		<category><![CDATA[Server config]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://zhiqiangma.info/?p=1636</guid>
		<description><![CDATA[tmpfs has blazing speed. Why not set up a high speed NFS server on top of tmpfs? A little trick is required for setting NFS server on top of /dev/shm. If we add a normal entry in /etc/export and them run # exportfs -a exportfs will give us a warning like this: exportfs: Warning: /dev/shm [...]]]></description>
			<content:encoded><![CDATA[<p>tmpfs has blazing speed. Why not set up a high speed NFS server on top of tmpfs?</p>
<p>A little trick is required for setting NFS server on top of /dev/shm. If we add a normal entry in <em>/etc/export</em> and them run</p>
<pre># exportfs -a
</pre>
<p>exportfs will give us a warning like this: <em>exportfs: Warning: /dev/shm requires fsid= for NFS export</em></p>
<p>When we try to mount this NFS server, we may get a error message from <em>mount</em>: <em>mount.nfs: access denied by server while mounting nfsserver:/dev/shm</em></p>
<p>How to solve this problem? Just add option <em>fsid=1</em> to /dev/shm entry in <em>/etc/exports</em>:</p>
<pre>/dev/shm 10.0.0.1/24(rw,fsid=1,sync)
</pre>
<p>Then nfsserver:/dev/shm can be mounted in 10.0.0.1/24.</p>
]]></content:encoded>
			<wfw:commentRss>http://fclose.com/b/linux/1636/setting-up-a-nfs-server-on-top-of-tmpfs-devshm/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Unified Linux Login and Home Directory Using OpenLDAP and NFS/automount</title>
		<link>http://fclose.com/b/linux/281/unified-linux-login-and-home-directory-using-openldap-and-nfsautomount/</link>
		<comments>http://fclose.com/b/linux/281/unified-linux-login-and-home-directory-using-openldap-and-nfsautomount/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 06:29:13 +0000</pubDate>
		<dc:creator>Zhiqiang Ma</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[NFS]]></category>
		<category><![CDATA[openldap]]></category>
		<category><![CDATA[Server config]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://zhiqiangma.info/unified-linux-login-and-home-directory-using-openldap-and-nfsautomount/</guid>
		<description><![CDATA[In this post, how to unified Linux login and home directory using OpenLDAP and NFS/automount will be introduced. 0. System environment This solution is tested on Fedora 12 systems. This method should work on later versions of Fedora, such as Fedora 13, Fedora 14, Fedora 15 &#8230; This solution is also tested on CentOS. LDAP [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, how to unified Linux login and home directory using OpenLDAP and NFS/automount will be introduced.</p>
<h3>0. System environment</h3>
<p>This solution is tested on Fedora 12 systems. This method should work on later versions of Fedora, such as Fedora 13, Fedora 14, Fedora 15 &#8230; This solution is also tested on CentOS.</p>
<p>LDAP and NFS server:<br />
IP: 10.0.0.2<br />
OS: Fedora 12 x86_64<br />
ldap base dn: &#8220;dc=lgcpu1&#8243;</p>
<p>Clients:<br />
IP: 10.0.0.1/24<br />
OS: Fedora 12 x86_64</p>
<h3>1. LDAP server</h3>
<h4>Package installation:</h4>
<pre># yum install openldap-servers
# /sbin/chkconfig ldap on
# /sbin/service ldap start</pre>
<h4> Add or edit these configurations:</h4>
<p>Edit <em>/etc/openldap/slapd.conf</em>. Add or edit:</p>
<pre>include 	/etc/openldap/schema/redhat/autofs.schema

#########################################################
# ldbm and/or bdb database definitions
#########################################################

database	bdb
suffix		"dc=lgcpu1"
checkpoint      1024 15
rootdn		"cn=Manager,dc=lgcpu1"

rootpw		{crypt}x

# Access Control
access to attrs=userPassword
  by self                               write
  by anonymous                          auth
  by dn="cn=manager,dc=lgcpu1"  write
  by *                                  compare
access to *
  by self                               write
  by dn="cn=manager,dc=lgcpu1"  write
  by *                                  read</pre>
<p>How to get the rootpw:</p>
<pre>perl -e "print crypt('passwd', 'salt_string',);"</pre>
<h4>Add top.ldif</h4>
<p>top.ldif:</p>
<pre>dn: dc=lgcpu1
objectclass: dcObject
objectclass: organization
o: lgcpu1 group
dc: lgcpu1

dn: cn=manager,dc=lgcpu1
objectclass: organizationalRole
cn: manager

dn: ou=people,dc=lgcpu1
ou: people
objectclass: organizationalUnit
objectclass: domainRelatedObject
associatedDomain: lgcpu1

dn: ou=contacts,ou=people,dc=lgcpu1
ou: contacts
ou: people
objectclass: organizationalUnit
objectclass: domainRelatedObject
associatedDomain: lgcpu1

dn: ou=group,dc=lgcpu1
ou: group
objectclass: organizationalUnit
objectclass: domainRelatedObject
associatedDomain: lgcpu1</pre>
<p>Add top.ldif to ldap server:</p>
<pre>$ ldapadd -x -D 'cn=manager,dc=lgcpu1' -W -f top.ldif</pre>
<p>Then search all the content in the ldap server by:</p>
<pre>ldapsearch -x -D 'cn=manager,dc=lgcpu1' -W</pre>
<p>If the previous work is correctly processed. ldapsearch will print out all the content in ldap database.</p>
<h4>Add users and groups from local configuration:</h4>
<p>Copy passwd shadow group from /etc/ to some tmp location<br />
Edit them and only keep the normal users, that means no system users.</p>
<pre>$ vim /usr/share/openldap/migration/migrate_common.ph</pre>
<p>Edit these values:</p>
<pre># Default DNS domain
$DEFAULT_MAIL_DOMAIN = "cse.ust.hk";

# Default base
$DEFAULT_BASE = "dc=lgcpu1";</pre>
<p>Then add the encryped password from shadow file to userPassword like this:</p>
<pre>$ /usr/share/openldap/migration/migrate_passwd.pl ./passwd &gt; people.ldif</pre>
<p>The password is in this format:</p>
<pre>userPassword: {crypt}$1$Zlkjsdf...</pre>
<p>Then add people.ldif to ldap server</p>
<pre>$ /usr/share/openldap/migration/migrate_group.ph ./group &gt; group.ldif</pre>
<p>Then add group.ldif to ldap server</p>
<h4>Add auto.master.ldif</h4>
<pre>dn: ou=auto.master,dc=lgcpu1
objectClass: top
objectClass: automountMap
ou: auto.master

dn: cn=/home,ou=auto.master,dc=lgcpu1
objectClass: automount
automountInformation: ldap:ou=auto.home,dc=lgcpu1
cn: /home

dn: cn=/share,ou=auto.master,dc=lgcpu1
objectClass: automount
automountInformation: ldap:ou=auto.misc, dc=lgcpu1
cn: /share</pre>
<p>add auto.master.ldif</p>
<h4>Add auto.home.ldif</h4>
<p>Add for every users</p>
<p>add auto.home.ldif</p>
<h4>auto.misc.ldif</h4>
<p>Add for some common share directories</p>
<pre>dn: ou=auto.misc,dc=lgcpu1
objectClass: top
objectClass: automountMap
ou: auto.misc</pre>
<p>add auto.misc.ldif</p>
<h3>2. NFS server</h3>
<p>Please refer to <a href="http://fclose.com/b/linux/3396/how-to-set-up-and-configure-nfs-server-and-clients/">How to Set Up and Configure NFS Server and Clients</a> for how to set up a NFS server.</p>
<h4>Edit /etc/exports</h4>
<p>Allow the servers inside subnet 10.0.0.1/24 to mount the /home directory with read/write permission. Add this line to /etc/exports:</p>
<pre>/home 10.0.0.1/24(rw)</pre>
<h4>Start up service</h4>
<p>Enable nfs service on the NFS server so that the service automatically starts each time the server starts:</p>
<pre># /sbin/chkconfig nfs on</pre>
<p>You may also manually start it</p>
<pre># service nfs start</pre>
<h3>3. Client configuration</h3>
<h4>3.1 Packages installation</h4>
<pre># yum install nss_ldap autofs nfs-utils
# chkconfig autofs on
# service rpcbind restart
# service autofs restart</pre>
<h4>3.2 Configuration</h4>
<pre># authconfig-tui</pre>
<p>Select like this:</p>
<pre>|  User Information        Authentication                         │
│  [ ] Cache Information   [*] Use MD5 Passwords                  │
│  [ ] Use Hesiod          [*] Use Shadow Passwords               │
│  [*] Use LDAP            [*] Use LDAP Authentication            │
│  [ ] Use NIS             [ ] Use Kerberos                       │
│  [ ] Use Winbind         [ ] Use Fingerprint reader             │
│                          [ ] Use Winbind Authentication         │
│                          [*] Local authorization is sufficient  │</pre>
<p>In next step:</p>
<pre>│          [ ] Use TLS                              │
│  Server: ldap://10.0.0.2/________________________ │
│ Base DN: dc=lgcpu1_______________________________ │</pre>
<h4>3.3 Delete old user entries in:</h4>
<p>/etc/passwd<br />
/etc/shadow<br />
/etc/group<br />
/etc/gshadow</p>
<h3>4. add individual person</h3>
<h4>Add people.sample.ldif to ldap</h4>
<pre>dn: uid=sample,ou=People,dc=lgcpu1
uid: sample
cn: sample
sn: sample
mail: sample@cse.ust.hk
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
userPassword: {crypt}$6$encryped password here
loginShell: /bin/bash
uidNumber: 507
gidNumber: 507
homeDirectory: /home/sample</pre>
<h4>Add group.sample.ldif to ldap</h4>
<pre>dn: cn=sample,ou=Group,dc=lgcpu1
objectClass: posixGroup
objectClass: top
cn: sample
userPassword: {crypt}x
gidNumber: 507</pre>
<h4>Addauto.home.sample.ldif to ldap</h4>
<pre>dn: cn=sample,ou=auto.home,dc=lgcpu1
objectClass: automount
automountInformation: 10.0.0.2:/home/sample
cn: sample</pre>
<h4>Delete old entries in:</h4>
<p>/etc/passwd<br />
/etc/shadow<br />
/etc/group<br />
/etc/gshadow</p>
<h4>Create home directory on NFS server:</h4>
<pre># mkdir /home/sample
# cp /etc/skel/.[a-z]* /home/sample/
# chown -R 507: /home/sample/</pre>
<p><strong></strong><span style="font-size: x-small;"><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://fclose.com/b/linux/281/unified-linux-login-and-home-directory-using-openldap-and-nfsautomount/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

