Opening the nfs service in firewalld is not the last step of an NFS server on Fedora 45. On a fresh box the first client mount hung with no error at all, because rpc.mountd had quietly exited the moment nfs-server started, before it had even written its export table. Nothing in systemctl status nfs-server tells you so, which is why you will check one more unit here than most guides ask for.
This guide builds an NFS server on Fedora with /etc/exports, the firewalld nfs service, an NFSv4-only configuration that closes ports 111 and 20048, and the SELinux booleans that actually matter. On the client side you mount the share by hand, through a systemd automount in /etc/fstab, and through autofs. Everything below was run on Fedora 45 and Fedora 44 in November 2026, with SELinux enforcing on all three machines.
Three machines, one port
The lab has one server and two clients on the same 10.132.0.0/20 subnet. You can follow along with a single client, since the second one only exists to prove that a Fedora 44 machine talks to a Fedora 45 server without extra options:
- nfs01 (10.132.0.16): Fedora 45, runs
nfs-serverand exports/srv/nfs/sharedand/srv/nfs/projects - client01 (10.132.0.15): Fedora 45, mounts by hand, through systemd automount and through autofs
- client02 (10.132.0.17): Fedora 44, the same client steps plus a short server test
Once the server is NFSv4-only, your clients only ever connect to TCP 2049. rpc.mountd keeps running on the server because the kernel asks it about exports through a local upcall, not over the network. Its own MOUNT listener on port 20048 only serves NFSv3 clients, so the firewall can keep it closed:

Splitting the work this way is the whole reason an NFSv4-only server needs one firewall rule instead of three. Keep the picture in mind when a mount fails, because the cause is almost always one of its three boxes on the server side: the firewall, nfsd or rpc.mountd. If you work out which one first, the fix is usually a single command.
Install nfs-utils on the Fedora server
Fedora Server and Workstation ship firewalld, but the Fedora Cloud image the lab used had neither firewalld nor nfs-utils, and it carried only vim-minimal, which gives you vi but no vim command. Installing all three is harmless where they already exist, so you can run the same command on every edition:
sudo dnf -y install nfs-utils firewalld vim-enhanced
sudo systemctl enable --now firewalld
Then confirm SELinux is enforcing and that the packages landed. A server in permissive mode hides the client-side SELinux problem covered later, so you should know which mode you’re testing in:
getenforce
rpm -q nfs-utils firewalld
On nfs01 the three lines read:
Enforcingnfs-utils-2.9.2-1.rc1.fc45.1.x86_64firewalld-2.5.2-1.fc45.noarch
The rc1 in the release means Fedora packaged an upstream release candidate; the package changelog names it nfs-utils-2-9-3-rc1. The startup problem two sections down appears tied to that build, because Fedora 44 carries nfs-utils 2.8.7 and does not show it on the same steps, so treat it as a package issue rather than something about your hardware or network.
Exports decide who mounts what
An export is a directory plus a list of clients plus options, and NFS applies the options per client, not per directory. The lab exports a read-only share for everyone on the subnet and a writable project area that belongs to a group with a fixed GID. Create both directories and the group first:
sudo mkdir -p /srv/nfs/shared /srv/nfs/projects
sudo groupadd -g 3000 projects
sudo chgrp projects /srv/nfs/projects
sudo chmod 2775 /srv/nfs/projects
The setgid bit on /srv/nfs/projects makes every new file inherit the projects group, so files written by different people stay editable by the whole team. GID 3000 itself is arbitrary. What you cannot skip is using the same number on every client, because the server never sees the group name, only the number, as the permissions section shows with real output.
Open the exports file:
sudo vim /etc/exports
Add one line per export, with your own subnet in place of 10.132.0.0/20:
/srv/nfs/shared 10.132.0.0/20(ro,sync,root_squash)
/srv/nfs/projects 10.132.0.0/20(rw,sync,root_squash)
Each option on those lines changes what a client can do, and the defaults fill in the rest:
ro/rw: the server refuses writes onro, whatever the client mounts withsync: the server confirms a write only after it reaches diskroot_squash: client root becomes the anonymous user (also the default)- No space before the parenthesis:
host (rw)exports read-write to everyone
The last item is the classic exports typo, and exports(5) documents it. Now write the export table. Running exportfs -ra before the service starts is not optional on Fedora 45, as the next section shows:
sudo exportfs -ra
sudo exportfs -v
The verbose listing shows every option the kernel will enforce, including several you never typed:
/srv/nfs/shared
10.132.0.0/20(sync,wdelay,hide,no_subtree_check,sec=sys,ro,secure,root_squash,no_all_squash)
/srv/nfs/projects
10.132.0.0/20(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
Remember sec=sys from that output. It means the server believes whatever numeric UID and GID the client sends, so anyone with root on a machine inside 10.132.0.0/20 can claim to be any user. That is acceptable on a subnet you control and wrong on one you do not, which is also why the export list names a subnet instead of *.
nfs-mountd can die on the first start
On the first try the lab skipped exportfs -ra and went straight to enabling the service, which is what most NFS guides tell you to do. nfs-server reported success, yet every client mount hung. The unit that had failed was nfs-mountd, which nfs-server pulls in:

Here rpc.mountd started before /var/lib/nfs/etab existed, logged couldn't open /var/lib/nfs/etab and exited with status 0, so systemd marked it “Deactivated successfully” instead of failed. The etab file is written by exportfs -r, which nfs-server runs in its own ExecStartPre a moment too late. Why would an NFSv4 mount care about a v3 daemon? Because the kernel asks rpc.mountd whether a client may see an export, and with nobody answering, your client waits forever.
The same thing happened on a second Fedora 45 machine, while Fedora 44 started rpc.mountd normally in the same situation. Running exportfs -ra first creates the file and avoids the race, which the lab confirmed by deleting etab, running exportfs -ra and starting the server again. The order that worked on both releases is short:
- Write
/etc/exports. - Run
sudo exportfs -rato create etab. - Enable and start
nfs-server. - Confirm
nfs-mountdis active.
You already did the first two steps above, so enable the service now. It starts nfs-mountd and the kernel server in one go, and the unit comes back after every reboot:
sudo systemctl enable --now nfs-server
Check both units, not just the one you started:
systemctl is-active nfs-server nfs-mountd
Both lines should read active. If nfs-mountd says inactive, run sudo systemctl restart nfs-mountd, and any mount that is already waiting will finish on its own, as the lab’s hung mount did a few seconds after the restart. You will also see nfsdctl: Error: Protocol not supported and nfsdctl: Error: Invalid argument in the journal on both Fedora 45 and 44. They look alarming but are harmless, because the unit falls back to rpc.nfsd, which starts the server correctly.
The firewalld zone decides who reaches 2049
Which ports are already open depends on your edition’s default zone, so check it first with sudo firewall-cmd --get-default-zone and sudo firewall-cmd --list-all:
- public (Cloud image, the lab):
ssh,mdns,dhcpv6-client - FedoraServer:
ssh,dhcpv6-client,cockpit - FedoraWorkstation: also opens TCP and UDP 1025-65535, so 2049 and 20048 are reachable already
On a Workstation that serves NFS, move the interface to a stricter zone such as public before you rely on the firewall for anything in this guide. Setting the default zone moves every interface that has no zone of its own, and the second command shows where your interface landed:
sudo firewall-cmd --set-default-zone=public
sudo firewall-cmd --get-active-zones
On the lab box the interface ens4 sits under public (default). If the zone was already the default, firewalld only prints a ZONE_ALREADY_SET warning, which you can ignore. In the public zone, a client mount does not fail fast. It keeps retrying silently inside the foreground retry window, which nfs(5) sets to two minutes, so you only see the reason when you add -v:

“No route to host” sounds like a routing problem, but it is firewalld rejecting the connection with an ICMP admin-prohibited reply. Ping works and SSH works, because only port 2049 is refused. Each firewalld service that NFS touches opens different ports, and you only need the first row for NFSv4:
| firewalld service | Ports | Needed for |
|---|---|---|
nfs | 2049/tcp | NFSv4.x (all you need for v4-only) |
nfs3 | 2049/tcp, 2049/udp | NFSv3 data over UDP |
mountd | 20048/tcp, 20048/udp | NFSv3 mounts, showmount |
rpc-bind | 111/tcp, 111/udp | NFSv3 port lookups, showmount, autofs /net |
Those port lists come from firewall-cmd --info-service on the lab server. Add the nfs service to the permanent configuration and reload:
sudo firewall-cmd --permanent --add-service=nfs
sudo firewall-cmd --reload
sudo firewall-cmd --list-services
Now nfs shows up next to ssh, and its definition holds a single TCP port:

A zone with no source set applies to every source, so the firewall now lets anyone reach 2049 and leaves the client check to /etc/exports. If you want the firewall to limit the share to one subnet as well, use a rich rule or a dedicated zone with that subnet as its source. The firewalld guide for Fedora covers zones and sources in detail.
Clients mount NFSv4.2 by default
A Fedora client needs nfs-utils for mount.nfs and nothing else for a plain NFSv4 mount. Your server address shows up in several commands, so set it once in a variable on each client:
export NFS_SERVER=10.132.0.16
sudo dnf -y install nfs-utils vim-enhanced
sudo mkdir -p /mnt/projects
Mount the writable export and ask the kernel what it negotiated. Use the full server path, since without an fsid=0 pseudo-root NFSv4 on Linux exposes the real directory tree:
sudo mount -t nfs "${NFS_SERVER}:/srv/nfs/projects" /mnt/projects
findmnt -o TARGET,SOURCE,FSTYPE,OPTIONS /mnt/projects
nfsstat -m
Even with -t nfs and no version option, the client picked nfs4 with vers=4.2 over TCP:

Read the option string from left to right and three defaults stand out:
hard: I/O blocks while the server is away instead of failingrsize=524288,wsize=524288: 512 KiB per read and writesec=sys: numeric UID and GID, no Kerberos
You don’t need to repeat any of these in /etc/fstab unless you want to change them. The hard default is the one people regret removing, because a soft mount that times out mid-write can leave a half-written file that the application believes it saved.
NFS trusts numeric IDs, not names
With sec=sys, your client sends UID and GID numbers, and the server checks them against the directory’s permissions. The user name never crosses the wire. In the lab the same kenneth account had UID 1007 on nfs01, 1005 on client01 and 1008 on client02, which is exactly the mismatch that bites real networks. On client01 the sequence went like this:

Read the four results in order, because each one is a different rule at work:
- UID 1005 is not the owner and not in group 3000, so the server says
Permission denied. sudodoesn’t help.root_squashturns UID 0 intonobody, which can’t write either.- After creating
projectswith GID 3000 on the client and joining it, a write throughsg projectssucceeds. ls -lnshows the file as1005 3000on both machines.
Create the same group on each client and add your user to it. A new group membership only applies to new logins, so in the current shell run the write through sg, or log out and back in first:
sudo groupadd -g 3000 projects
sudo usermod -aG projects "$USER"
sg projects -c 'touch /mnt/projects/from-kenneth.txt'
ls -ln /mnt/projects
Ownership is where the trap sits. On the server, UID 1005 belongs to whoever has that number there, so the file looks like someone else’s when you run ls -l on nfs01. For a team share, give the group a fixed GID everywhere and rely on the setgid directory, as the lab did, because then ownership by user stops mattering. For per-user home directories you need identical UIDs on every machine, which means FreeIPA or LDAP, or Kerberos with sec=krb5, where the identity travels as a name.
NFSv4-only removes rpcbind and port 111
Right after the install, /proc/fs/nfsd/versions on nfs01 read +3 +4 -4.0 +4.1 +4.2, and rpcbind listened on port 111 on every interface. Your NFSv4 clients need neither NFSv3 nor rpcbind, so turning them off shrinks what the server exposes without costing anything. It is the setup the port 111 hardening guide works toward. Open the NFS configuration file:
sudo vim /etc/nfs.conf
In the [nfsd] section, replace the commented # vers3=y line with vers3=n. The section on nfs01 ended up like this:
[nfsd]
# debug=0
# threads=16
# host=
# port=0
# grace-time=90
# lease-time=90
# udp=n
# tcp=y
vers3=n
# vers4=y
# vers4.0=n
# vers4.1=y
# vers4.2=y
rdma=y
rdma-port=20049
# fh-key-file=/etc/nfs_fh.key
Fedora ships rdma=y uncommented, and the lab left it alone. Next, mask the services only NFSv3 uses, so nothing can start them again as a dependency, and restart the server:
sudo systemctl mask --now rpc-statd.service rpcbind.service rpcbind.socket
sudo systemctl restart nfs-server
Masking rpcbind.socket matters as much as masking the service. The socket listens on port 111 by itself and starts rpcbind on the first connection, so if you mask only the service, the port stays open and the scan you run next week still finds it. To prove the configuration survives a restart, the lab rebooted nfs01 and checked again:

After the reboot the kernel reports -3, nothing listens on 111, and nfs-mountd came back active. rpc.mountd still binds port 20048 even with NFSv3 off. That listener is its network MOUNT service; the kernel reaches rpc.mountd through a local upcall, so nothing on 20048 is needed for NFSv4. In the public or FedoraServer zone firewalld keeps 20048 unreachable, because the nfs service doesn’t include it. The FedoraWorkstation zone opens it along with every other high port.
From the client side, every NFSv3 tool now fails, including the one people reach for first:
showmount -e "${NFS_SERVER}"
sudo mkdir -p /mnt/v3test
sudo mount -v -t nfs -o vers=3 "${NFS_SERVER}:/srv/nfs/projects" /mnt/v3test
showmount uses the NFSv3 MOUNT protocol through rpcbind, so it errors out, and the v3 mount loops on a portmap query until you interrupt it:

Press Ctrl+C to stop the v3 attempt, because it won’t give up on its own for a while. If you still have NFSv3 clients, such as an old NAS appliance or a hypervisor that defaults to v3, keep vers3 enabled and open the mountd and rpc-bind services as well. Don’t run half of each, because a server that speaks v3 behind a firewall that only opens 2049 is exactly where silent mount hangs come from.
systemd automount mounts on first access
A plain NFS line in /etc/fstab mounts at boot, and a server that’s down can then hold up your client’s boot. Adding x-systemd.automount changes that: systemd puts an autofs trigger on the mount point at boot and only mounts the share when something touches the directory. Unmount the manual mount and open fstab:
sudo umount /mnt/projects
sudo vim /etc/fstab
Add this line at the end of the file, with your server address in front of the path:
10.132.0.16:/srv/nfs/projects /mnt/projects nfs4 noauto,x-systemd.automount,x-systemd.idle-timeout=10min,_netdev 0 0
The options work together, and systemd.mount(5) documents each one:
noauto: ignored next tox-systemd.automount, so the trigger still starts at bootx-systemd.automount: createmnt-projects.automountto mount on accessx-systemd.idle-timeout=10min: unmount after ten idle minutes_netdev: redundant fornfs4, which systemd already treats as a network mount
In the lab, daemon-reload alone generated the units but did not start the automount, so systemctl list-units --type=automount still showed nothing new. Restarting remote-fs.target is what activated it:
sudo systemctl daemon-reload
sudo systemctl restart remote-fs.target
systemctl status mnt-projects.automount --no-pager
The automount sits in active (waiting) until the first ls, and then a second nfs4 line appears on top of the autofs trigger:

Notice that client01 lists the file as owned by kenneth projects, because UID 1005 is kenneth on that machine, while nfs01 resolves the same number to someone else. After a reboot of client01 the automount was active again, and the first ls mounted the share without any manual step, so you can rely on it surviving restarts.
autofs maps a whole directory of shares
systemd automount costs one fstab line per share. autofs is the better fit when your client needs many exports under one parent, because a single wildcard map line covers every directory the server exports under /srv/nfs. Install it:
sudo dnf -y install autofs
Fedora’s /etc/auto.master already carries a +dir:/etc/auto.master.d line, so you never need to edit the master file. Create a drop-in instead:
sudo vim /etc/auto.master.d/nfs.autofs
It points the /nfs directory at a map file and unmounts idle shares after 300 seconds:
/nfs /etc/auto.nfs --timeout=300
Now create the map itself:
sudo vim /etc/auto.nfs
The * key matches any name you access under /nfs, and & repeats that name in the server path:
* -fstype=nfs4,rw 10.132.0.16:/srv/nfs/&
Enable autofs and touch two names under /nfs:
sudo systemctl enable --now autofs
ls -l /nfs/shared /nfs/projects
findmnt -t nfs4 -o TARGET,SOURCE,OPTIONS
What do you see if you run ls /nfs first? Nothing, because a wildcard map has no list of names until you ask for one. Both shares then mounted on access, the read-only export refused a write even though the map says rw, and a name the server doesn’t export simply didn’t exist:

The rw in the map is only a request, so the server’s ro export wins and you get Read-only file system. One more autofs feature stops working on an NFSv4-only server. The built-in /net hosts map lists exports with the v3 MOUNT protocol, so ls /net/10.132.0.16 returned No such file or directory, and a map of your own like the one above is the replacement.
SELinux booleans matter on the client
Most NFS guides tell you to turn on nfs_export_all_rw on the server. On Fedora it’s already on, and the lab found that it doesn’t gate a normal export at all. With both nfs_export_all_rw and nfs_export_all_ro switched off, client02 still read the shared file and wrote a new one to /srv/nfs/projects, and the server logged no AVC.
SELinux policy explains why. The nfsd kernel threads run as kernel_t, and sesearch -A -b nfs_export_all_rw shows that the boolean adds only 9 rules, 7 of them for noxattrfs, the filesystems that can’t store SELinux labels (FAT and exFAT, for example). So leave both booleans on and stop worrying about them, unless you export a filesystem like that.
Your client is where SELinux actually stops you. Every file on an NFS mount carries the nfs_t label, and confined services can’t read nfs_t until a boolean allows it. getsebool -a | grep nfs lists them all, and these are the ones you’re most likely to need:
httpd_use_nfs: Apache or PHP-FPM serving files from NFS (off)use_nfs_home_dirs: home directories mounted from NFS (off)samba_share_nfs: re-sharing an NFS mount over Samba (off)virt_use_nfs: VM disk images on NFS (on)
The lab tested the first one. On the server, put a test page in the export with sudo mkdir -p /srv/nfs/shared/site and echo "served from nfs01 over NFSv4.2" | sudo tee /srv/nfs/shared/site/index.html. Then install httpd on a client that has the share at /nfs/shared and point an alias at it:
sudo dnf -y install httpd
sudo vim /etc/httpd/conf.d/nfs-site.conf
The alias maps /shared on the web server to the NFS directory:
Alias /shared /nfs/shared/site
<Directory /nfs/shared/site>
Require all granted
</Directory>
Start it with sudo systemctl enable --now httpd. On client01 a request for /shared/index.html returned 403. The httpd error log said search permissions are missing on a component of the path, yet ausearch -m avc found nothing, because Fedora’s policy hides this denial with a dontaudit rule. You can make it visible by rebuilding the policy without dontaudit rules for a moment:
sudo semodule -DB
curl -s -o /dev/null -w "%{http_code}\n" http://localhost/shared/index.html
sudo grep denied /var/log/audit/audit.log | tail -3
sudo semodule -B
The AVC names httpd_t trying to getattr an nfs_t file, and one persistent boolean turns the 403 into a 200:

Run semodule -B afterwards, as shown, so the dontaudit rules come back and your audit log stays readable. The fix itself is one command, and -P keeps it across reboots:
sudo setsebool -P httpd_use_nfs on
Keep in scope that one boolean opens every NFS mount on that client to httpd, not just the one you meant, so turn it on only on web hosts. The SELinux survival guide for Fedora covers dontaudit rules and semodule -DB in more depth.
Fedora 44 runs the same steps
client02 ran Fedora 44 and repeated the client steps against nfs01 without any change. The plain mount negotiated NFSv4.2, and the fstab automount and the autofs wildcard map behaved exactly as they did on client01:

The lab also made client02 a server for a few minutes, exporting a directory read-only and mounting it from client01. The differences between the two releases are small, but two of them change what you see:
| Item | Fedora 45 | Fedora 44 |
|---|---|---|
| nfs-utils | 2.9.2-1.rc1 | 2.8.7-7 |
| autofs | 5.1.9-15 | 5.1.9-12 |
nfs-mountd on first start without etab | exits, mounts hang | stays active |
| NFSv4.0 out of the box | off (-4.0) | on (no -4.0 entry) |
Default vers4.0 hint in nfs.conf | # vers4.0=n | # vers4.0=y |
| nfsdctl fallback messages | printed, harmless | printed, harmless |
NFSv4.0 being off on Fedora 45 only affects clients that can’t speak 4.1 or newer, and every current Linux client defaults to 4.2, as both lab clients did. If you also serve Windows or SMB clients from the same box, the Samba share guide for Fedora covers the SELinux and firewall side of that protocol.
Error messages and what they mean
Every message below came from this lab. Most NFS failures look like a network problem at first, so start with which machine printed the error and which port it was trying to reach. A client-side message that names port 111 or a portmap query means something still speaks NFSv3, while a silent hang on 2049 points at the server’s firewall or at rpc.mountd. Permission errors, on the other hand, come from the export options and the numeric IDs, never from the network.
mount.nfs: mount(2): No route to host
firewalld on the server is rejecting TCP 2049. Add the nfs service permanently and reload. Without -v the mount prints nothing while it retries, so add -v whenever a mount seems to hang.
Mount hangs with the firewall open
Check systemctl is-active nfs-mountd on the server. If it’s inactive and the journal shows couldn't open /var/lib/nfs/etab, run sudo exportfs -ra and sudo systemctl restart nfs-mountd, and the waiting mount completes by itself within seconds.
clnt_create: RPC: Unable to receive
showmount could not reach rpcbind on port 111. On an NFSv4-only server that’s correct behaviour, not a fault, so check the exports on the server with sudo exportfs -v instead.
portmap query failed: RPC: Remote system error – No route to host
Something asked for NFSv3: -o vers=3 on the command line, an fstab entry with nfsvers=3, or an old client default. Use -t nfs4 on the client, or re-enable v3 on the server and open mountd and rpc-bind.
touch: cannot touch: Permission denied
The numeric UID or GID your client sent has no write permission on the server directory. Compare id on the client with ls -ln on the server. If root gets this error, that’s root_squash working as designed.
Read-only file system
The export is ro on the server, whatever rw says in the client’s mount options or autofs map. Change /etc/exports and run sudo exportfs -ra if the share should be writable.
AH00035: access to /shared/index.html denied because search permissions are missing on a component of the path
httpd is serving from an NFS mount with httpd_use_nfs off. Turn it on with sudo setsebool -P httpd_use_nfs on, and don’t wait for an AVC to confirm it, because Fedora’s policy doesn’t log this one unless you run semodule -DB.
If you run the same server on the RHEL side, the NFS server guide for Rocky Linux and AlmaLinux follows the same exports and firewalld steps, and the Ubuntu 26.04 NFS server guide covers the ufw version.