Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NFSv4 only but rpc.mountd needed?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3237
Location: de

PostPosted: Mon Mar 30, 2015 7:40 pm    Post subject: NFSv4 only but rpc.mountd needed? Reply with quote

Hi there,

I was playing around with my nfs configuration and came to the strange conclusion, that it only works with rpc.mountd.

Ok, let's start at the beginning:
I switched quite long time ago to systemd. At that time there were no nfs unit files available on Gentoo. So I took them from a Wiki. It worked quite ok, but sometimes the nfs service shut down before the nfs shares were unmounted. Therefore I checked the current Gentoo systemd units and compared them with the Arch units.

My current config:
nfs-server.service:
[Unit]
Description=NFS server and services
Requires= network.target proc-fs-nfsd.mount rpcbind.target
Wants=nfs-idmapd.service

After= network.target proc-fs-nfsd.mount rpcbind.target
After= nfs-idmapd.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd -N2 -N3 -V4
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -au
ExecStopPost=/usr/sbin/exportfs -f

ExecReload=/usr/sbin/exportfs -r

[Install]
WantedBy=multi-user.targe


nfs-idmapd.service:
[Unit]
Description=NFSv4 ID-name mapping service
Requires=var-lib-nfs-rpc_pipefs.mount
After=var-lib-nfs-rpc_pipefs.mount

BindsTo=nfs-server.service

[Service]
Type=forking
ExecStart=/usr/sbin/rpc.idmapd


rpcbind.service:
[Unit]
Description=RPC Bind service
Requires=rpcbind.socket
After=network.target
Wants=rpcbind.target
Before=rpcbind.target

[Service]
Type=forking
ExecStart=/sbin/rpcbind

[Install]
Also=rpcbind.socket


rpcbind.socket:
[Unit]
Description=RPCbind Server Activation Socket

[Socket]
ListenStream=/var/run/rpcbind.sock

[Install]
WantedBy=sockets.target


The other units are the same in Arch and Gentoo. My goal was to drop completely NFSv2 and NFSv3. In the kernel I activated only NFSv4 and v4.1 for client and server. In the fstab the shares are mounted only with type nfsv4.

When I start now the server, it doesn't complain and starts up fine. But on the client trying to mount a share I get the error message:

mount hexe:
mount.nfs4: access denied by server while mounting hexe:/home_sm


Just for fun I started nfs-mountd (rpc.mountd) on the server. And surprise - I can mount the share. Have a look into the manpage:

man rpc.mountd wrote:
The rpc.mountd daemon implements the server side of the NFS MOUNT protocol, an NFS side protocol used by NFS version 2 [RFC1094] and NFS version 3 [RFC1813].


So what's wrong? Why do I need rpc.mountd in a NFSv4 only environment?
Back to top
View user's profile Send private message
salahx
Guru
Guru


Joined: 12 Mar 2005
Posts: 437

PostPosted: Tue Mar 31, 2015 5:54 am    Post subject: Reply with quote

nfs.mountd serves 2 purposes: One is the NFSv2/v3 MOUNT protocol, which requires the portmapper and causes SUN RPC traffic to flow over the interfaces. However, it also has second purpose: To export the filesystems in /etc/exports. This is still required even for NFSv4, however the clients neither talk to the portmapper nor nfs.mountd in this case - only the NFS server does.

If you wish, if all your clients are NFS4 only, you can firewall off the portmapper and nfs.mountd and everything will still work normally.
Back to top
View user's profile Send private message
musv
Advocate
Advocate


Joined: 01 Dec 2002
Posts: 3237
Location: de

PostPosted: Tue Mar 31, 2015 8:05 am    Post subject: Reply with quote

Thanks for your explanation.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum