无法挂载nfs,查看状态是exited,其实是iptables没有打开
查看服务运行的相关端口情况,使用rpcinfo -p
nfs 运行在2049端口。
iptables -A INPUT -p tcp -m tcp --dport 2049 -j ACCEPT
iptables -A INPUT -p udp -m udp --dport 2049 -j ACCEPT
打开防火墙后,就可以正常挂载了。
iptables 持久化:
https://www.linuxmi.com/debian-ubuntu-iptables.html
尽管是这样的信息,是没问题的:
leon@leon:~$ sudo systemctl status nfs-kernel-server
● nfs-server.service - NFS server and services
Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
Drop-In: /run/systemd/generator/nfs-server.service.d
└─order-with-mounts.conf
Active: active (exited) since Thu 2022-03-31 17:00:15 CST; 12min ago
Process: 804417 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 804418 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Main PID: 804418 (code=exited, status=0/SUCCESS)
Mar 31 17:00:14 leon.local systemd[1]: Starting NFS server and services…
Mar 31 17:00:15 leon.local systemd[1]: Finished NFS server and services.
journalctl -n 100
Mar 31 16:54:12 leon.local systemd[1]: Starting NFSv4 ID-name mapping service…
Mar 31 16:54:12 leon.local systemd[1]: Starting NFS Mount Daemon…
Mar 31 16:54:12 leon.local systemd[1]: Condition check resulted in RPC security service for NFS client and server being skipped.
Mar 31 16:54:12 leon.local systemd[1]: Condition check resulted in RPC security service for NFS server being skipped.
Mar 31 16:54:12 leon.local systemd[1]: Started NFSv4 ID-name mapping service.
Mar 31 16:54:12 leon.local rpc.mountd[801532]: Version 1.3.3 starting
Mar 31 16:54:12 leon.local systemd[1]: Started NFS Mount Daemon.
Mar 31 16:54:12 leon.local systemd[1]: Starting NFS server and services…
Mar 31 16:54:13 leon.local kernel: NFSD: Using UMH upcall client tracking operations.
Mar 31 16:54:13 leon.local kernel: NFSD: starting 90-second grace period (net f00000b0)
Mar 31 16:54:13 leon.local systemd[1]: Finished NFS server and services.