VMware Cloud Community
ricardoclaus
Contributor
Contributor

NFS mount failed: Unable to connect to NFS server.

Dear,

I'm having trouble connecting vSphere to an NFS storage.

Environment:

NFS Server: Centos Linux

Client: VMware ESXi 6.0.0, vSphere Client 6.0.0

When I try to create a storage connection with the NFS server, I get this error:

Error:An error occurred during host configuration.

See the error stack for details on the cause of this problem.

Error Stack

Call "HostDatastoreSystem.CreateNasDatastore" for object "ha-datastoresystem" on ESXi "172.16.16.2" failed.

NFS mount 172.16.16.20:/storage/nfs failed: Unable to connect to NFS server.

In /var/log/vmkernel.log, I see this error:

2017-06-27T17:52:38.598Z cpu5:34724 opID=d88c6317)NFS: 157: Command: (mount) Server: (172.16.16.20) IP: (172.16.16.20) Path: (/storage/nfs) Label: (nfssrv20) Options: (None)

2017-06-27T17:53:08.663Z cpu4:34724 opID=d88c6317)NFS: 168: NFS mount 172.16.16.20:/storage/nfs failed: Unable to connect to NFS server.

Looking at the tutorials and posts I found on the subject, I've tried the following steps:

With vmkping I can ping the NFS server;

I can connect to the NFS server port. I tested it with the command: nc -z 172.16.16.20 2049

The Vmware firewall is releasing client connections nfs, as shown in the attached image.

I even created a VMkernel port.

I can connect to the NFS server without problems using another client.

Could someone help me in this case?

Text in english

0 Kudos
5 Replies
ITaaP
Enthusiast
Enthusiast

Do you have your exports configuration file setup correctly on your CentOS server?

https://tactsol.com https://vmware.solutions
0 Kudos
ricardoclaus
Contributor
Contributor

Dear Itaap,

Here are some details:

# cat /etc/exports

/storage/nfs 172.16.16.0/255.255.254.0(rw,no_subtree_check,all_squash,anonuid=1001,anongid=1001)

I can connect to NFS through another host, be it Windows or Linux.

I'm not sure if I need to change any settings.

0 Kudos
ITaaP
Enthusiast
Enthusiast

I would try this.

/storage/nfs 172.16.16.0/255.255.254.0(rw,async,no_subtree_check,no_root_squash)

Also, maybe take a look at this article. https://boredwookie.net/blog/m/nfs-exports-centos-7-esxi

https://tactsol.com https://vmware.solutions
0 Kudos
ricardoclaus
Contributor
Contributor

Dear Itaap,

I tried to use the configuration you passed to /etc/exports, but I still get the same error.

I accessed the link you reported. I followed all the steps.

The only detail I found was adding a service to the Centos7 firewall.

firewall-cmd --permanent --add-service=mountd

firewall-cmd --reload

Yet I still face the same problem, and the connection is not realized.

Would you have any new tips?

0 Kudos
lj020326
Contributor
Contributor

tl;dr:

try opening the port 40073 on the nfs server.

More detail:

I was having the same issue for my esxi when mounting an nfs share hosted on ubuntu18.

When disabling firewalld on the ubuntu nfs server, the esx server was able to successfully mount the share.

```bash

systemctl stop firewalld

```

On esxi:

```bash

[root@esx2:~] esxcli storage nfs add --host=admin.example.local --share=/srv/data --volume-name=nfs_data

[root@esx2:~] esxcli storage nfs list

Volume Name  Host                  Share       Accessible  Mounted  Read-Only   isPE  Hardware Acceleration

-----------  --------------------  ----------  ----------  -------  ---------  -----  ---------------------

nfs_data  admin.example.local  /srv/data        true     true      false  false  Not Supported

[root@esx2:~]

```

So on the ubuntu nfs server I temporarily enabled logging of rejected packets for the firewalld configuration in order to determine the port that was needed.

```bash

firewall-cmd --set-log-denied=all

```

I then unmounted and attempted to remount the nfs share from the esxi machine.

```bash

[root@esx2:~] esxcli storage nfs remove --volume-name=nfs_data

[root@esx2:~] esxcli storage nfs list

[root@esx2:~]

[root@esx2:~] esxcli storage nfs add --host=admin.example.local --share=/srv/data --volume-name=nfs_data

Connecting to NAS volume: nfs_data

Unable to connect to NAS volume nfs_data: Unable to complete Sysinfo operation.  Please see the VMkernel log file for more details.: Sysinfo error: Unable to connect to NFS serverSee VMkernel log for details.

```

Upon inspecting the rejected packets, I could see the following:

```bash

root@admin:$ grep 192.168.0.11 /var/log/kern.log

Aug  3 14:57:07 admin kernel: [10810.462421] FINAL_REJECT: IN=ens32 OUT= MAC=00:50:56:91:08:d0:00:1e:c9:56:14:3b:08:00 SRC=192.168.0.11 DST=192.168.10.232 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=60939 DF PROTO=TCP SPT=940 DPT=40073 WINDOW=65535 RES=0x00 SYN URGP=0

root@admin:$

```

The DPT part of the log above indicates that the esxi nfs client is attempting to connect to the destination port 40073.

I then opened that port on the ubuntu server.

```bash

firewall-cmd --permanent --add-port=40073/tcp --zone=internal

firewall-cmd --reload

```

And now when attempting to mount from the esxi machine, it is successful:

```bash

[root@esx2:~] esxcli storage nfs add --host=admin.example.local --share=/srv/data --volume-name=nfs_data

[root@esx2:~] esxcli storage nfs list

Volume Name  Host                  Share       Accessible  Mounted  Read-Only   isPE  Hardware Acceleration

-----------  --------------------  ----------  ----------  -------  ---------  -----  ---------------------

nfs_data  admin.example.local  /srv/data        true     true      false  false  Not Supported

[root@esx2:~]

```

0 Kudos