TIL: How to properly serve NFSv4 from FreeNAS

I was trying to serve a FreeNAS mount as a NFSv4 share. Unfortnately, there was one thing bugging me, which was this one:

> ls -la
total 1
-rw-r--r-- 1 nobody nobody 0 Feb 27 02:01 test

Yes, on the client, all files were showing up as being owned by nobody. After lots of debugging and wasted time, I found out that NFSv4 permission models requires the client and server to be at the same domain, so I checked with:

> sudo nfsidmap -d

Then I went to the FreeNAS server and:

> hostname -d

Oh Lord. It was just a matter of switching my client machine to the new domain and done.

> sudo vi /etc/hostname /etc/hosts
> sudo hostname -F /etc/hostname

Special thanks to Martin Cheatle that helped me in that gotcha moment.