wiki'd

by JoKeru

Debian NFSv3 Server with static ports

VMware (ESXi 5.1) only supports NFS version 3 over TCP/IP

Setup NFS Server behind a firewall:
- rpcbind (portmapper) listens on port 111 (default)
- mountd binds to port 32767 (custom)
- nfsd listens on port 2049 (default)
- statd binds to port 32765 for incoming requests and it must answer on port 32766 (custom)
- lockd's module parameters have been set to bind to 32768 (custom)

[cc lang='bash']
\$ apt-get install nfs-kernel-server

\$ cat \<> /etc/default/nfs-kernel-server
RPCMOUNTDOPTS="--manage-gids --port 32767 --no-nfs-version 4"
NEED_SVCGSSD="no"
EOF
\$ cat \<> /etc/default/nfs-common
NEED_STATD="yes"
STATDOPTS="--port 32765 --outgoing-port 32766"
NEED_IDMAPD="no"
NEED_GSSD="no"
EOF
\$ cat \< /etc/modprobe.d/local.conf
options lockd nlm_udpport=32768 nlm_tcpport=32768
EOF
\$ cat \<> /etc/services
# NFS ports
rpc.nfsd 2049/tcp # RPC nfsd
rpc.nfsd 2049/udp # RPC nfsd
rpc.statd-bc 32765/tcp # RPC statd broadcast
rpc.statd-bc 32765/udp # RPC statd broadcast
rpc.statd 32766/tcp # RPC statd listen
rpc.statd 32766/udp # RPC statd listen
rpc.mountd 32767/tcp # RPC mountd
rpc.mountd 32767/udp # RPC mountd
rpc.lockd 32768/tcp # RPC lockd/nlockmgr
rpc.lockd 32768/udp # RPC lockd/nlockmgr
EOF

\$ mkdir /var/nfs
\$ chown nobody:nogroup /var/nfs
\$ echo '/var/nfs 10.0.0.0/24(rw,sync)' >> /etc/exports

\$ reboot

\$ rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 32765 status
100024 1 tcp 32765 status
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 2 tcp 2049
100227 3 tcp 2049
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 2 udp 2049
100227 3 udp 2049
100021 1 udp 32768 nlockmgr
100021 3 udp 32768 nlockmgr
100021 4 udp 32768 nlockmgr
100021 1 tcp 32768 nlockmgr
100021 3 tcp 32768 nlockmgr
100021 4 tcp 32768 nlockmgr
100005 1 udp 32767 mountd
100005 1 tcp 32767 mountd
100005 2 udp 32767 mountd
100005 2 tcp 32767 mountd
100005 3 udp 32767 mountd
100005 3 tcp 32767 mountd

# master table of exports
\$ cat /var/lib/nfs/etab
/var/nfs 10.0.0.0/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

# table of clients accessing server's exports
\$ cat /var/lib/nfs/rmtab
10.0.0.10:/var/nfs:0x00000002
[/cc]

http://www.ibm.com/developerworks/library/l-network-filesystems/

Comments