关于nfs内网穿透frp/nps的问题记录
nfs内网穿透失败记录
修改nfs的固定端口
sudo vim /etc/sysctl.conf
fs.nfs.nlm_udpport=30104
fs.nfs.nlm_tcpport=30105
sudo vim /etc/services
mountd 30100/tcp
mountd 30101/udp
rquotad 30102/tcp
rquotad 30103/udp
重启服务
sudo /etc/init.d/rpcbind restart
sudo /etc/init.d/nfs-kernel-server restart
端口查看
vmuser@ubuntu:~$ rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100005 1 udp 30101 mountd
100005 1 tcp 30100 mountd
100005 2 udp 30101 mountd
100005 2 tcp 30100 mountd
100005 3 udp 30101 mountd
100005 3 tcp 30100 mountd
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049
100003 3 udp 2049 nfs
100227 3 udp 2049
100021 1 udp 30104 nlockmgr
100021 3 udp 30104 nlockmgr
100021 4 udp 30104 nlockmgr
100021 1 tcp 30105 nlockmgr
100021 3 tcp 30105 nlockmgr
100021 4 tcp 30105 nlockmgr
端口映射
31 | 6 | tcp | 32049 | 0.0.0.0:2049 | open | open | online | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
32 | 6 | tcp | 31111 | 0.0.0.0:1111 | open | open | online | ||||
33 | 6 | tcp | 30100 | 0.0.0.0:30100 | open | open | online | ||||
34 | 6 | tcp | 30101 | 0.0.0.0:30101 | open | open | online | ||||
35 | 6 | tcp | 30102 | 0.0.0.0:30102 | open | open | online | ||||
36 | 6 | tcp | 30103 | 0.0.0.0:30102 | open | open | online | ||||
37 | 6 | tcp | 30104 | 0.0.0.0:30104 | open | open | online | ||||
38 | 6 | tcp | 30105 | 0.0.0.0:30105 | open | open | online | ||||
40 | 6 | tcp | 111 | 0.0.0.0:111 | open | open | online | ||||
41 | 6 | udp | 111 | 0.0.0.0:111 | open | open | online | ||||
43 | 6 | udp | 30101 | 0.0.0.0:30101 | open | open | online | ||||
46 | 6 | udp | 32049 | 0.0.0.0:2049 | open | open | online | ||||
47 | 6 | udp | 30104 | 0.0.0.0:30104 | open | open | online |
本地挂载成功
本地挂载成功
vmuser@ubuntu:~/work$ sudo mount -v -t nfs -o mountport=30101 -o port=2049 192.168.1.153:/work ./test
mount.nfs: timeout set for Fri Apr 17 19:46:15 2020
mount.nfs: trying text-based options 'mountport=30101,port=2049,vers=4.2,addr=192.168.1.153,clientaddr=192.168.1.170'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'mountport=30101,port=2049,addr=192.168.1.153'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.153 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.153 prog 100005 vers 3 prot UDP port 30101
远程还是失败了
远程挂载
vmuser@ubuntu:~/work$ sudo mount -v -t nfs -o mountport=30101 -o port=32049 我的ip:/work ./test
mount.nfs: timeout set for Fri Apr 17 19:47:21 2020
mount.nfs: trying text-based options 'mountport=30101,port=32049,vers=4.2,addr=101.37.20.75,clientaddr=192.168.1.170'
mount.nfs: mount(2): Operation not permitted
mount.nfs: trying text-based options 'mountport=30101,port=32049,addr=101.37.20.75'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: portmap query retrying: RPC: Program not registered
mount.nfs: prog 100003, trying vers=3, prot=17
mount.nfs: portmap query failed: RPC: Program not registered
mount.nfs: requested NFS version or transport protocol is not supported