Resolution:
The basic setup is similar to a normal mount process with nfs shares, except some config changes and that the IP addresses are changed to 127.0.0.1 (the loopback address). Here is the configuration on the server as well as the client:
Server Configuration:
The server configuration is done.
Client Configuration:
The basic setup is similar to a normal mount process with nfs shares, except some config changes and that the IP addresses are changed to 127.0.0.1 (the loopback address). Here is the configuration on the server as well as the client:
- In the /etc/exports file, the share is exported by inserting the following line:
/myshare 127.0.0.1(rw,fsid=0,insecure,no_subtree_check,sync)
- Re-export the share or restart the nfs service:
or
# exportfs -rv
exporting localhost.localdomain:/myshare
# exportfs -v
/myshare localhost.localdomain(rw,wdelay,insecure,root_squash,no_subtree_check,fsid=0)
- In the /etc/fstab file, give the mount parameters as follows:
127.0.0.1:/ /mnt/nfs4 nfs4 rw,hard,intr,proto=tcp,port=3333,noauto 0 0
- Now setup an SSH tunnel with port forwarding. Any encryption can be used, for example the blowfish encryption is used here. The standard port for nfs mount is 2049, but for the local port, it is not compulsory to use this port. Any random port can be used and the NFSv4 clients and SSH tunnels do not care which ports they use. Open up an SSH session from the NFS client to the NFS server:
# ssh -c blowfish -L 3333:127.0.0.1:2049 <server-address>
root@server's password:
- Back on the NFS client host (client), open another terminal session as "root" and then mount the filesystem:
The NFSv4 share will be mounted as if it were local, but actually it is an encrypted remote filesystem.
# mount -v /mnt/nfs4
127.0.0.1:/ on /mnt/nfs4 type nfs4 (rw,hard,intr,proto=tcp,port=3333,addr=127.0.0.1)
- In order to unmount it, first use the command:
# umount -v /mnt/nfs4
- Exit the SSH session.
0 Comment:
Post a Comment