# nfs client port 686



## nORKy (Apr 15, 2011)

Why does nfs client need port 686 (open on nfs server) when *mount* is called? What is this port?

Thanks you


----------



## SirDice (Apr 15, 2011)

NFS uses RPC, as such it will use all sorts of ports.


----------



## AndyUKG (Apr 15, 2011)

Hi,

  you're probably looking at mountd, which by default has no fixed port. If you need this to be a known port you can define it in rc.conf like:


```
mountd_flags="-p 957"
```

Which sets the port to always be 957, check the mountd man page for more details...

thanks Andy.


----------



## nORKy (Apr 15, 2011)

Thanks all. For me, rpc was port 111. It's easier to set fixed ports with a firewall.


----------



## mamalos (Apr 16, 2011)

nORKy,

you must be referring to rpcbind, also known as the portmapper. I think that SirDice is talking about the RPC service in general, and the way NFS uses it. Unless set explicitly, as AndyUKG suggested, programs that use RPC like statd, mountd, etc. will run on various ports, and these ports will be assigned and revealed to the clients via rpcbind/portmapper that traditionally runs on port 111.


----------



## peetaur (Feb 3, 2012)

FYI for anyone else reading this:

rpcbind runs on 111
nfsd runs on 2049
mountd runs on a random port by default

Therefore to set up the firewall as suggested above, you set mountd_flags, and create rules for all three ports in the firewall.

If your ports might be different, check /etc/services:
`# grep -E "nfsd|rpcbind" /etc/services`

```
sunrpc          111/tcp    rpcbind      #SUN Remote Procedure Call
sunrpc          111/udp    rpcbind      #SUN Remote Procedure Call
nfsd-status     1110/tcp   #Cluster status info
nfsd-keepalive  1110/udp   #Client status info
nfsd            2049/sctp  nfs          # NFS server daemon
nfsd            2049/tcp   nfs          # NFS server daemon
nfsd            2049/udp   nfs          # NFS server daemon
```


----------

