Bonjour à tous,
Je souhaite installer sur mon réseau local un serveur NFS en version 4 sur une Jessie (oui je sais c’est vieux : je changerai ça plus tard ) et je me base - notamment - sur ce wiki.
user01@srv01:~$ grep NFSD /boot/config-`uname -r`
CONFIG_NFSD=m
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=y
CONFIG_NFSD_PNFS=y
CONFIG_NFSD_V4_SECURITY_LABEL=y
# CONFIG_NFSD_FAULT_INJECTION is not set
=> coté kernel = ok !
root@srv01:~# apt-cache policy nfs-kernel-server portmap
nfs-kernel-server:
Installed: 1:1.2.8-9
Candidate: 1:1.2.8-9
Version table:
*** 1:1.2.8-9 0
500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
100 /var/lib/dpkg/status
portmap:
Installed: (none)
Candidate: (none)
Version table:
Ça commence : portmap est en fait un paquet virtuel !
Donc :
root@srv01:~# apt-cache policy rpcbind
rpcbind:
Installed: 0.2.1-6+deb8u2
Candidate: 0.2.1-6+deb8u2
Version table:
*** 0.2.1-6+deb8u2 0
500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
500 http://security.debian.org/ jessie/updates/main amd64 Packages
100 /var/lib/dpkg/status
=> coté install, c’est ok !
Comme je ne souhaite avoir mon serveur NFS qu’en version 4 : “The portmap package is only required if you want to run an NFSv2 or NFSv3 server. If all your clients support NFSv4, you can disable NFSv2 and NFSv3 (as described in the “NFSv4 only” section below) and skip the “Portmap” section below.”
Je passe donc à la section “Exports” :
root@srv01:~# cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
/storage/shares/partage 192.168.1.1/24(rw,sync,no_subtree_check)
root@srv01:~# exportfs -a
root@srv01:~# systemctl restart nfs-kernel-server.service
root@srv01:~# systemctl status nfs-kernel-server.service
● nfs-kernel-server.service - LSB: Kernel NFS server support
Loaded: loaded (/etc/init.d/nfs-kernel-server)
Active: active (exited) since Thu 2019-07-25 14:43:33 CEST; 14s ago
Process: 3201 ExecStop=/etc/init.d/nfs-kernel-server stop (code=exited, status=0/SUCCESS)
Process: 3211 ExecStart=/etc/init.d/nfs-kernel-server start (code=exited, status=0/SUCCESS)
Jul 25 14:43:33 srv01 nfs-kernel-server[3211]: Exporting directories for NFS kernel daemon....
Jul 25 14:43:33 srv01 nfs-kernel-server[3211]: Starting NFS kernel daemon: nfsd
Jul 25 14:43:33 srv01 nfs-kernel-server[3211]: Not starting: portmapper is not running ... (warning).
Jul 25 14:43:33 srv01 systemd[1]: Started LSB: Kernel NFS server support.
On pourrait donc croire que c’est OK, sauf que :
root@srv01:~# cat /proc/fs/nfsd/versions
-2 -3 -4 -4.1 -4.2
=> toutes les version de NFS sont disabled sur le serveur !
Ça sent pas bon…
Je passe quand même à la section “NFSv4 Only” :
root@srv01:~# cat /etc/default/nfs-common
# If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are "yes" and "no".
# Do you want to start the statd daemon? It is not needed for NFSv4.
#NEED_STATD=
NEED_STATD="no"
# Options for rpc.statd.
# Should rpc.statd listen on a specific port? This is especially useful
# when you have a port-based firewall. To use a fixed port, set this
# this variable to a statd argument like: "--port 4000 --outgoing-port 4001".
# For more information, see rpc.statd(8) or http://wiki.debian.org/SecuringNFS
#STATDOPTS=
STATDOPTS="--port 37400 --outgoing-port 37401"
# Do you want to start the idmapd daemon? It is only needed for NFSv4.
#NEED_IDMAPD=
NEED_IDMAPD="yes"
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=
root@srv01:~# cat /etc/default/nfs-kernel-server
# Number of servers to start up
RPCNFSDCOUNT=8
# Runtime priority of server (see nice(1))
RPCNFSDPRIORITY=0
# Options for rpc.mountd.
# If you have a port-based firewall, you might want to set up
# a fixed port here using the --port option. For more information,
# see rpc.mountd(8) or http://wiki.debian.org/SecuringNFS
# To disable NFSv4 on the server, specify '--no-nfs-version 4' here
#RPCMOUNTDOPTS="--manage-gids"
RPCNFSDOPTS="-N 2 -N 3"
RPCMOUNTDOPTS="--port 37402 -N 2 -N 3"
# Do you want to start the svcgssd daemon? It is only required for Kerberos
# exports. Valid alternatives are "yes" and "no"; the default is "no".
NEED_SVCGSSD=""
# Options for rpc.svcgssd.
RPCSVCGSSDOPTS=""
root@srv01:~# systemctl status rpcbind.service
● rpcbind.service
Loaded: masked (/dev/null)
Active: inactive (dead)
Warning: Unit file changed on disk, 'systemctl daemon-reload' recommended.
root@srv01:~# systemctl status rpcbind.socket
● rpcbind.socket
Loaded: masked (/dev/null)
Active: inactive (dead)
(même après un systemctl daemon-reload, j’ai toujours cette alerte : je ne sais pas pourquoi…)
D’après le wiki, ça devrait être bon… sauf que si je fais un showmount sur le client macos :
user01@mac01:~$ showmount -e srv01
showmount: Cannot retrieve info from host: srv01: RPC failed:: RPC: Unable to send; errno = Bad file descriptor
ou sur un client Stretch:
root@debian:~# showmount -e srv01
clnt_create: RPC: Port mapper failure - Unable to receive: errno 0 (success)
Ce qui n’est étonnant vu qu’aucun service NFS n’est en écoute :
root@srv01:~# netstat -lptn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2140/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2130/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2271/master
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 2289/smbd
tcp 0 0 127.0.0.1:3493 0.0.0.0:* LISTEN 2298/upsd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 2289/smbd
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 2114/redis-server 1
tcp6 0 0 :::22 :::* LISTEN 2140/sshd
tcp6 0 0 ::1:631 :::* LISTEN 2130/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 2271/master
tcp6 0 0 :::445 :::* LISTEN 2289/smbd
tcp6 0 0 :::139 :::* LISTEN 2289/smbd
Quelqu’un aurait-il une idée sur le fait qu’aucun service NFS ne se lance, svp ?
Thanks in advance,
Trululu