You are not logged in.
Hi everyone. I am asking this question in the hopes that some of you have set up a FreeBSD NFS Server and configured a Linux NFS Client (in my case a Gentoo box) to connect to that server.
But I am having some problems. I read 27.3 Network File System (NFS) to set up the NFS Server on my FBSD box.
My FBSD box has an IP of: 192.168.1.4
My Linux box has an IP of: 192.168.1.5
My config files are below:
/etc/exports
/usr/local/backup -alldirs -network 192.168.1.5 /backup -alldirs -network 192.158.1.5
/etc/hosts.allow
# Start by allowing everything (this prevents the rest of the file # from working, so remove it when you need protection). # The rules here work on a "First match wins" basis. ALL : ALL : allow ... (all the default hosts.allow stuff)
/etc/rc.conf
# NFS Server nfs_client_enable="YES" nfs_server_enable="YES" rpcbind_enable="YES"
check to see if mountd, rpcbind, and nfsd are running
snorlax# ps aux | grep mountd root 724 0.0 0.5 3156 1356 ?? Is 3:00PM 0:00.01 /usr/sbin/mountd -r snorlax# ps aux | grep rpcbind root 678 0.0 0.6 3184 1364 ?? Ss 3:00PM 0:00.03 /usr/sbin/rpcbind snorlax# ps aux | grep nfsd root 726 0.0 0.5 3104 1224 ?? Is 3:00PM 0:00.11 nfsd: master (nfsd) root 728 0.0 0.4 3104 952 ?? I 3:00PM 0:00.00 nfsd: server (nfsd) root 729 0.0 0.4 3104 952 ?? I 3:00PM 0:00.00 nfsd: server (nfsd) root 730 0.0 0.4 3104 952 ?? I 3:00PM 0:00.00 nfsd: server (nfsd) root 731 0.0 0.4 3104 952 ?? I 3:00PM 0:00.00 nfsd: server (nfsd)
But on my linux box, I try to do:
scyther linux # mount 193.168.1.4:/backup /mnt/nfs
mount: wrong fs type, bad option, bad superblock on 193.168.1.4:/backup,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
scyther linux # mount -t nfs 193.168.1.4:/backup /mnt/nfs
mount: wrong fs type, bad option, bad superblock on 193.168.1.4:/backup,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or soWhat am I doing wrong?
Offline
I'm using a very similar setup to yours successfully. From the information you posted, I'm thinking that the FreeBSD side should be ok, and that the problem lies with the NFS client. Well, except maybe for one thing: In my /etc/exports, I either have lines like:
/some/directory 10.0.0.16
to make a directory available to a specific IP, or
/some/other/directory -network 10.0.0.0 -netmask 255.255.255.0
to make a directory available to an IP range. But then, if the exports file doesn't work, you'll probably get a different error message.
Anyway, the other things that come to mind is making sure that you have the nfs-utils package installed on your Gentoo box (and if you do, what happens if you use the mount.nfs command instead of mount -t nfs?), and of course, checking your dmesg and logs to see whether more useful information appears there.
Offline
Hi,
I suggest reviewing your /etc/exports file, to export it only to your Linux box change to:
/usr/local/backup 192.168.1.5
/backup 192.168.1.5
Thus making the shares available to any client with an IP address beginning in 192.168.1 and netmask of 255.255.255.0.
After performing any changes changes to the exports file, reload it by:
# /etc/rc.d/mountd onereload
Also add the following to your rc.conf:
nfs_server_enable="YES"
rpcbind_enable="YES"
mountd_flags="-r"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
After all the changes, start the server by:
# rpcbind
# nfsd -u -t -n 4
# mountd -r
The showmount command can be used to display the exports on the server:
# showmount -e
I blog about BSD and Linux, in my blog I have a couple of posts on my experiences with NFS: http://linux-bsd-sharing.blogspot.com/search/label/NFS
Hope that helps.
Offline
@ F_
First, I notice that your IP address was 192.x.x.x but your mount attempt used 193.x.x.x That alone would cause your mount attempt to fail.
Second, your /etc/exports did not use the "-mask" parameter to clarify the netmask. FreeBSD's exports file uses "-mask" instead of "-netmask" In other configuration files, however, the "netmask" label is used.
Third, using ALL : ALL : ALLOW in your /etc/hosts.allow file is not safe. Replace your "defaults" with your network's gateway IP and its netmask. I'm posting examples below.
Fourth, FreeBSD uses pf (packet filter) as its firewall. pf.conf must be configured to let network traffic pass. (See example below)
Finally, always check your typing. It is easy to misspell a command or an address or to use uppercase when you intended to use lowercase.
I'm providing an example of the FreeBSD mounting command on the client side, but I do not know if that would be correct for Linux.
EXAMPLES OF FreeBSD CONFIGURATION FILES FOR NFS:
# Note -- in these examples, the network gateway is 192.168.2.0 and the netmask is 255.255.255.0
I. ON THE SERVER (configuring exports, rc.conf, hosts.allow, pf.conf)
A. -------------> /etc/exports
#
/usr/home/IR -network 192.168.2.0 -mask 255.255.255.0
#------------------------------------------------------
Note: By using the gateway address, the export can be available to ALL computers using 192.168.2.x
Also Notice that the command is "-mask" and not "-netmask"
B. -------------> /etc/rc.conf
#--------------------- enable NFS server ----------------------
rpcbind_enable="yes"
nfs_server_enable="yes"
mountd_flags="-r"
C. -------------> /etc/hosts.allow
# Everything is changed to match the Gateway and the Netmask
# Rpcbind is used for all RPC services; protect your NFS!
# (IP addresses rather than hostnames *MUST* be used here)
rpcbind : 192.168.2.0/255.255.255.0 : allow
rpcbind : ALL : deny
# Allow anything from localhost. Note that an IP address (not a host
# name) *MUST* be specified for rpcbind(8).
ALL : localhost 127.0.0.1 : allow
# Comment out next line if you build libwrap with NO_INET6=yes.
ALL : [::1] : allow
ALL : 192.168.2.0/255.255.255.0 : allow
# NIS master server. Only local nets should have access
ypserv : localhost : allow
# ypserv : .unsafe.my.net.example.com : deny
ypserv : 192.168.2.0/255.255.255.0 : allow
ypserv : ALL : deny
# Provide a small amount of protection for ftpd
ftpd : localhost : allow
ftpd : 192.168.2.0/255.255.255.0 : allow
#ftpd : .evil.cracker.example.com : deny
ftpd : ALL : allow
D. -------------> /etc/pf.conf
# These are critical changes. Otherwise NFS will not pass through the pf firewall.
# /24 in 192.168.2.0/24 is equal to saying the netmask is 255.255.255.0
#--------------------- macros at the top of the file are used to define local network NIC and IP address ----------------------
nic_1 = "fxp0"
lan = "192.168.2.0/24"
#--------------------- pf commands to pass all traffic to and from local network -----------
# the macros from above are used and are prefixed with a "$"
pass in on $nic_1 from $lan to any keep state
pass out on $nic_1 from $lan to any keep state
#---------------------------------------------------------------------------------------------------
II. ON THE FreeBSD CLIENT (configure rc.conf, mount command)
A. -------------> /etc/rc.conf
nfs_client_enable="YES"
nfs_client_flags="-n 4"
B. -------------> The mount command
# mount_nfs 192.168.2.4:/usr/home/IR /mnt/NFS
where:
mount_nfs is the modern form of the FreeBSD command to mount an NFS share
192.168.2.4 is the IP address of the server
the ":" separator is an essential part of the mount command syntax
/usr/home/IR is the directory exported from the server
/mnt/NFS is the mount point on the client
Make sure that the user will have "rights" to the files that will be in the mount point directory
Last edited by Ian_Robinson (2008-10-12 06:16:41)
Offline
Still not working guys...
Here are my config files.
/etc/exports
/usr/local/backup 130.my.ip.address /backup 130.my.ip.address
/etc/hosts.allow
sshd : 130.my.ip.address : allow
rpcbind : 130.my.ip.address/255.255.255.244 : allow
ypserv : localhost : allow
ypserv : 130.my.ip.address/255.255.255.244
ypserv : ALL : deny
ftpd : localhost : allow
fingerd : ALL \
: spawn (echo Finger. | \
/usr/bin/mail -s "tcpd\: %u@%h[%a] fingered me!" root) & \
: deny
ALL : ALL \
: severity auth.info \
: twist /bin/echo "You are not welcome to use %d from %h."/etc/rc.conf
defaultrouter="192.168.1.1" hostname="snorlax.my.domain" # INETD inetd_enable="NO" # IPV6 and DHCP ipv6_enable="YES" ifconfig_xl0="DHCP" # Linux binary support linux_enable="YES" # Enabling Mouse moused_enable="NO" moused_port="/dev/psm0" moused_type="auto" # NFS Server nfs_client_enable="YES" nfs_server_enable="YES" rpcbind_enable="YES" mountd_flags="-r" # SSHD sshd_enable="YES"
But when I run 'showmount -e' I get the following error:
snorlax# showmount -e RPC: Port mapper failure showmount: can't do exports rpc snorlax#
Any ideas?
Last edited by F_ (2008-10-19 13:35:54)
Offline