So if you are reading this you many not be aware of the fact that I already put up a post on NFS on RHEL6 (you can find it here). However that post is basically just a redirect to another blog post that I ran into on the subject. And despite the fact that its very well written, and has no apparent spelling mistakes, or inapropriate comments about NFS, I felt the need to draft my own post. At this point I really cannot seem to remember anything technical if I don't put up a blog post on the subject. After all I have been doing so for over 4 years, so why stop now.
Anyway, now that I got all that out of the way, lets sit down on brass tacks.
First lets create a directory to be shared on our NFS Server
# mkdir -p /shared/nfs
Now lets change the unix perms so that its wide open
# chmod 777 /shared/nfs
Now lets add our new nfs share to /etc/exports/. In this example I am sharing it out to my local /24 network.
/shared/nfs 10.1.224.0/24(rw,sync)
Now restart NFS service
# service nfs restart
Now verify that you are now sharing via NFS with showmount
# showmount -e localhost
Export list for localhost:
/shared/nfs 10.1.224.0/24
If you are running iptables on your nfs host you are going to need to do a bit more to get nfs to work
If you go by the book, you are going to need to run to open several ports, the commands below will open up what you need.
# iptables -I INPUT -m multiport -p tcp –dport 111,662,875,892,2049,32803 -j ACCEPT
# iptables -I INPUT -m multiport -p udp –dport 111,662,875,892,2049,32769 -j ACCEPT
The fast and cheap way is to just allow all from your nfs client
# iptables -I INPUT -s 10.1.224.55 -j ACCEPT
Now lets go over to the host that we intend to mount our nfs filesystem on and run our showmount command again
# showmount -e 10.1.224.34
Export list for 10.1.224.34:
/shared/nfs 10.1.224.0/24
Now manually mount your share as seen below
mount -t nfs 10.1.224.34:/shared/nfs /mnt
Now add your share to /etc/fstab so that its mounted persistently across reboots.
10.1.224.34:/shared/nfs /mnt nfs defaults 0 0
Just to be sure that everything is correct, unmount /mnt and mount /mnt. This way you will catch any errors in your fstab. Probably not a bad idea to touch a file under your new nfs mount too, just to make sure that its writeable.
derp – need to “service rpcbind start” first. Also it’s useful to “yum install nfs-utils” before engaging in the shenanigans.
Hey – are you stalking me!
Pingback: NFS | Warbler23's Blog