can not mount an NFS share from another machine [ Solved ]

Taking care of your Linux box.
Post Reply
shahzor
Naik
Posts: 72
Joined: Thu Jun 29, 2006 11:33 am
Location: Quetta
Contact:

can not mount an NFS share from another machine [ Solved ]

Post by shahzor »

I have configured NFS on server A and I want to mount the Server A NFS share on Server B.

NFS is running in server A, the showmount -e command shows the its exporting. the SELinux is off, and there is no firewall within the Server A.

in Server B there is no firewall and SELinux is also disabled.

but when i type the command to mount the NFS share I get an erro. the command and error is as follow.

#mount -t nfs 192.168.0.10:/opt /opt
mount: RPC: Timed out

and when I check the server A /var/log/messages it shows me the following error.

refused mount request from 192.168.0.1 for /opt (/): not exported

don't know whats wrong
LinuxBoy
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

what is in /etc/exports on the server? did you restart the nfs processes after editing the file (or maybe run exportfs -va)? is portmap running on both systems? what does "rpcinfo -p" say on the server? what does "rpcinfo -p 192.168.0.10" say on the client? do you have any entries for portmap in /etc/hosts.allow or /etc/hosts.deny?
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
shahzor
Naik
Posts: 72
Joined: Thu Jun 29, 2006 11:33 am
Location: Quetta
Contact:

Post by shahzor »

in the /etc/export there is opt directory which is mainly a filesystem, I have restarted the nfs server, I have run the exportfs -va, portmap is running on bothe system, and this the

rcpinfo from server A

program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 32769 status
100024 1 tcp 32768 status

and from server B rpcinfo is

program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 32768 status
100024 1 tcp 32768 status
100011 1 udp 634 rquotad
100011 2 udp 634 rquotad
100011 1 tcp 637 rquotad
100011 2 tcp 637 rquotad
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 udp 32773 nlockmgr
100021 3 udp 32773 nlockmgr
100021 4 udp 32773 nlockmgr
100021 1 tcp 32772 nlockmgr
100021 3 tcp 32772 nlockmgr
100021 4 tcp 32772 nlockmgr
100005 1 udp 649 mountd
100005 1 tcp 652 mountd
100005 2 udp 649 mountd
100005 2 tcp 652 mountd
100005 3 udp 649 mountd
100005 3 tcp 652 mountd

I do not have any entries for the /etc/host.allow, the TCP wrappers are not configured for the time being.
LinuxBoy
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

don't explain what's in the /etc/exports file. paste the contents here.
rcpinfo from server A

program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 32769 status
100024 1 tcp 32768 status
this is very odd. you say you have nfs set up on server A, but i don't see mountd running on server A. i see it running on server B. are you positive you copied and pasted the output of "rpcinfo -p" from the correct servers?
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
shahzor
Naik
Posts: 72
Joined: Thu Jun 29, 2006 11:33 am
Location: Quetta
Contact:

Post by shahzor »

okay just wrote B instead of A while writting its running on server A the /etc/exports files looks like

/opt (rw,sync)
LinuxBoy
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

that should be

Code: Select all

/opt client(rw,sync)
where client is the name or ip address of the nfs client.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
shahzor
Naik
Posts: 72
Joined: Thu Jun 29, 2006 11:33 am
Location: Quetta
Contact:

Post by shahzor »

okay after changing the /etc/exports

/opt client IP (rw,sync)

and now when I run the command.

mount -t nfs 192.168.0.10:/opt /share

it gives me the error

mount: RPC: Timed out

and when I check on server A the /var/log/messages

it says that

localhost rpc.mountd: authenticated mount request from 192.168.0.1:634 for /opt (/opt)

on ther server A it says authenticated but the error is the same.
LinuxBoy
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

what's in your /etc/hosts.allow and /etc/hosts.deny files?
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
shahzor
Naik
Posts: 72
Joined: Thu Jun 29, 2006 11:33 am
Location: Quetta
Contact:

Post by shahzor »

I din't configure the TCP_Wrappers.
LinuxBoy
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

if you have the files on your system, paste their contents here.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
shahzor
Naik
Posts: 72
Joined: Thu Jun 29, 2006 11:33 am
Location: Quetta
Contact:

Post by shahzor »

you mean /etc/hosts.allow and hosts.deny files.

/etc/hosts.allow

cat /etc/hosts.allow
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.

cat /etc/hosts.deny

# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
LinuxBoy
shahzor
Naik
Posts: 72
Joined: Thu Jun 29, 2006 11:33 am
Location: Quetta
Contact:

Post by shahzor »

finally I got it working, thanks lambda for hosts.allow and hosts.deny

I did the following in server A


/etc/hosts.allow

portmap: 192.168.0.0/55.255.255.0,serverb
mountd: 192.168.0.0/255.255.255.0
rquotad: 192.168.0.0/255.255.255.0
statd: 192.168.0.0/255.255.255.0
lockd: 192.168.0.0/255.255.255.0

and within the /etc/hosts.deny

portmap:ALL
mountd:ALL
rquotad:ALL
statd:ALL
lockd:ALL

and within the /etc/hosts

192.168.0.10 servera a

192.168.0.100 serverb b

and within server b /etc/hosts.

192.168.0.10 servera a

192.168.0.100 serverb b
LinuxBoy
shahzor
Naik
Posts: 72
Joined: Thu Jun 29, 2006 11:33 am
Location: Quetta
Contact:

Post by shahzor »

on server A the the filesystem is mounted on /opt. I can share the opt directory on server B through NFS.

but I can't writte on the /opt directory I changed the permissions for the opt directory and within /etc/fstab file I also added the rw.

LABEL=/opt /opt ext3 defaults,rw 1 2

but still I am not able to writte on the /opt directory from server B.

what can be wrong.
LinuxBoy
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

that's because you're trying to write as root. read the man page for exports carefully -- you need no_root_squash.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
shahzor
Naik
Posts: 72
Joined: Thu Jun 29, 2006 11:33 am
Location: Quetta
Contact:

Post by shahzor »

thanks lambda that works for now I just added the no_root_squash in /etc/exports file and now I can write on the /opt directory.
LinuxBoy
Post Reply