# configure nfsv4 to only use ipv4

## luciano

Hi,

After some upgrades my nfs-server won't start anymore. I get the following:

```

● nfs-server.service - NFS server and services

   Loaded: loaded (/usr/lib64/systemd/system/nfs-server.service; disabled)

   Active: failed (Result: exit-code) since Sat 2015-03-07 12:52:40 GMT; 7min ago

  Process: 30595 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=1/FAILURE)

  Process: 30593 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)

 Main PID: 30595 (code=exited, status=1/FAILURE)

Mar 07 12:52:40 chichenitza rpc.nfsd[30595]: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)

Mar 07 12:52:40 chichenitza rpc.nfsd[30595]: rpc.nfsd: address family inet6 not supported by protocol TCP

Mar 07 12:52:40 chichenitza rpc.nfsd[30595]: rpc.nfsd: unable to set any sockets for nfsd

Mar 07 12:52:40 chichenitza systemd[1]: nfs-server.service: main process exited, code=exited, status=1/FAILURE

Mar 07 12:52:40 chichenitza systemd[1]: Failed to start NFS server and services.

Mar 07 12:52:40 chichenitza systemd[1]: Unit nfs-server.service entered failed state.

```

This would be because I don't have IPV6 enabled in my kernel.

Can anybody indicate how to configure nfsd to NOT use IPv6?

I've tried adding the -H flag with a v4 address in /etc/conf.d/nfsd rpc mountd options, but doesn't appear to help. I'm sure it's documented somewhere, but I guess it's easier to ask the experts!  :Smile: 

Some info on my config:

```

# /etc/conf.d/nfs

# If you wish to set the port numbers for lockd,

# please see /etc/sysctl.conf

# Optional services to include in default `/etc/init.d/nfs start`

# For NFSv4 users, you'll want to add "rpc.idmapd" here.

NFS_NEEDED_SERVICES="rpc.idmapd"

# Number of servers to be started up by default

OPTS_RPC_NFSD="8"

# Options to pass to rpc.mountd

# ex. OPTS_RPC_MOUNTD="-p 32767"

OPTS_RPC_MOUNTD="-H 192.168.1.3 -p 32767"

# Options to pass to rpc.statd

# ex. OPTS_RPC_STATD="-p 32765 -o 32766"

OPTS_RPC_STATD="-H 192.168.1.3 -p 32765 -o 32766"

# Options to pass to rpc.idmapd

OPTS_RPC_IDMAPD=""

```

----------

## luciano

Well this https://bugs.centos.org/view.php?id=5398 appears to suggest the only way to fix this is to compile without ipv6 support. Will give it a whirl.

----------

## luciano

Ok the ipv6 flag was a red herring. re-compiling without it has made some of the messages go away, but it's still failing. These message remain:

```

● nfs-server.service - NFS server and services

   Loaded: loaded (/usr/lib64/systemd/system/nfs-server.service; disabled)

   Active: failed (Result: exit-code) since Sat 2015-03-07 13:40:51 GMT; 19s ago

  Process: 10935 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=1/FAILURE)

  Process: 10933 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)

 Main PID: 10935 (code=exited, status=1/FAILURE)

Mar 07 13:40:51 chichenitza rpc.nfsd[10935]: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)

Mar 07 13:40:51 chichenitza rpc.nfsd[10935]: rpc.nfsd: unable to set any sockets for nfsd

Mar 07 13:40:51 chichenitza systemd[1]: nfs-server.service: main process exited, code=exited, status=1/FAILURE

Mar 07 13:40:51 chichenitza systemd[1]: Failed to start NFS server and services.

Mar 07 13:40:51 chichenitza systemd[1]: Unit nfs-server.service entered failed state.

```

Any suggestions?

----------

## luciano

Ok turned out it was because I hadn't started rpcbind.

The README for the systemd unit files mentions this:

 *Quote:*   

> 
> 
>  7 They do *not* include any unit files for separate services such as
> 
> 8 rpc.rquotad (in the 'quota' package) or rpcbind.
> ...

 

However, I would have thought that should have been one of the dependencies for the unit files ... weird.

Problem fixed by running 'systemctl start rpcbind' before 'nfs-server'

----------

