# NFS Woes...

## slackline

Hi Peeps,

I've encountered an annoying problem with my NAS and desktop with regards to NFS and its not consistent with the behaviour I observe between my NAS and laptop.

NAS is running SlugOS (as its an NSLU2) and has the following...

Mounted drives...

```

l# df 

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/root                 6400      5472       928  86% /initrd

/dev/sdb3              9843308   2935384   6407904  31% /

/dev/sdb3              9843308   2935384   6407904  31% /dev/.static/dev

udev                      2048        96      1952   5% /dev

/dev/sdb1               241116    173813     54855  76% /mnt/backup

/dev/sdb5              9841097   6499703   2841373  70% /mnt/portage

/dev/sdb6            109969760  81428784  22954776  78% /mnt/torrents

/dev/sdb7            109969760  30633912  73749648  29% /mnt/albums

/dev/sda1            196870980 155003496  31867024  83% /mnt/music

/dev/sda2             98435476  87451408   5983840  94% /mnt/video

/dev/sda3             98435476  93433356      1892 100% /mnt/pics

/dev/sda5             19694836  14750992   3943400  79% /mnt/doc

/dev/sda6             19694836   3840028  14854364  21% /mnt/work1

/dev/sda7             29538432   6120760  21917204  22% /mnt/work2

/dev/sda8             18050192   3529108  13604176  21% /mnt/ref

tmpfs                    15120         0     15120   0% /var/volatile

tmpfs                    15120         0     15120   0% /dev/shm

```

...and I export them via NFS...

```

$ cat /etc/exports

# /etc/exports: NFS file systems being exported.  See exports(5).

## 250Gb LaCie

## pics1

/mnt/torrents   192.168.1.0/255.255.255.0(rw,async,subtree_check)

## music1

/mnt/albums   192.168.1.0/255.255.255.0(rw,async,subtree_check)

## 500Gb LaCie

## music2

/mnt/music   192.168.1.0/255.255.255.0(rw,async,subtree_check)

## video

/mnt/video   192.168.1.0/255.255.255.0(rw,async,subtree_check)

## pics2

/mnt/pics   192.168.1.0/255.255.255.0(rw,async,subtree_check)

## doc

/mnt/doc   192.168.1.0/255.255.255.0(rw,async,subtree_check)

## misc

/mnt/work1   192.168.1.0/255.255.255.0(rw,async,subtree_check)

## work

/mnt/work2   192.168.1.0/255.255.255.0(rw,async,subtree_check)

## ref

/mnt/ref   192.168.1.0/255.255.255.0(rw,async,subtree_check)

```

NFS and RPC are both running...

```

# dmesg | grep -i nfs        

Installing knfsd (copyright (C) 1996 okir@monad.swb.de).

NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory

NFSD: starting 90-second grace period

root@slug:/home/neil# dmesg | grep -i rpc   

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

```

On my laptop I have the following /etc/fstab and can mount things fine...

```

# /etc/init.d/netmount restart

 * Unmounting network filesystems ...                                                                                                                                         [ ok ]

 * Mounting network filesystems ...                                                                                                                                           [ ok ]

# df -h

Filesystem            Size  Used Avail Use% Mounted on

rootfs                 18G   14G  3.3G  81% /

/dev/root              18G   14G  3.3G  81% /

rc-svcdir             1.0M  128K  896K  13% /lib/rc/init.d

udev                   10M  252K  9.8M   3% /dev

none                  310M     0  310M   0% /dev/shm

/dev/hda1              30M   23M  5.4M  82% /boot

/dev/hda4              18G   12G  5.2G  70% /data

slug:/mnt/torrents    105G   78G   22G  79% /mnt/slug/torrents

slug:/mnt/albums      105G   30G   71G  30% /mnt/slug/albums

slug:/mnt/music       188G  148G   31G  83% /mnt/slug/music

slug:/mnt/video        94G   84G  5.8G  94% /mnt/slug/video

slug:/mnt/pics         94G   90G  1.9M 100% /mnt/slug/pics2

slug:/mnt/doc          19G   15G  3.8G  79% /mnt/slug/doc

slug:/mnt/work1        19G  3.7G   15G  21% /mnt/slug/misc

slug:/mnt/work2        29G  5.9G   21G  22% /mnt/slug/work

slug:/mnt/ref          18G  3.4G   13G  21% /mnt/slug/ref

# more /etc/exports 

# more /etc/fstab   

/dev/hda1               /boot            ext2            defaults,noatime               1 2

/dev/hda2               none             swap            sw                             0 0

/dev/hda3               /                ext3            defaults,noatime               0 1

/dev/hda4               /data            ext3            noatime,users,rw               0 0

/dev/sr0                /mnt/cdrom       iso9660         noauto,users,ro                0 0

none                    /proc            proc            defaults                       0 0

none                    /dev/shm         tmpfs           nodev,nosuid,noexec            0 0

/dev/iaudio             /mnt/iaudio      auto            noauto,noatime,users,rw         0 0

/dev/ipod               /mnt/ipod        vfat            noauto,async,nodev,nosuid,users,umask=0000,rw   0 0

/dev/backup             /mnt/backup      ext3            noauto,noatime,users,rw         0 0

/dev/sda2               /mnt/usb2        auto            noauto,noatime,users,rw         0 0

/dev/sda1               /mnt/usb1    auto            noauto,noatime,users,rw         0 0

/dev/sdb1               /mnt/camera      auto            noauto,noatime,users,rw         0 0

/dev/sd-flash      /mnt/sd       auto       noauto,noatime,users,rw         0 0

### NSLU2 under SlugOSBE

## /media/sda (250Gb)

slug:/mnt/torrents      /mnt/slug/torrents      nfs             auto,rw,users   0 0

slug:/mnt/albums        /mnt/slug/albums        nfs             auto,rw,users   0 0

## /mnt/sdb (500Gb)

slug:/mnt/music         /mnt/slug/music         nfs             auto,rw,users   0 0

slug:/mnt/video         /mnt/slug/video         nfs             auto,rw,users   0 0

slug:/mnt/pics          /mnt/slug/pics2         nfs             auto,rw,users   0 0

slug:/mnt/doc           /mnt/slug/doc           nfs             auto,rw,users   0 0

slug:/mnt/work1         /mnt/slug/misc          nfs             auto,rw,users   0 0

slug:/mnt/work2         /mnt/slug/work          nfs             auto,rw,users   0 0

slug:/mnt/ref           /mnt/slug/ref           nfs             auto,rw,users   0 0

```

So I can mount read and write to the NFS drives from my laptop.  However, on my desktop I can't, as I get permission denied by server errors with the exact same entries in /etc/fstab...

```

# /etc/init.d/netmount restart

 * Unmounting network filesystems ...                                                                                                                                        [ ok ]

 * Mounting network filesystems ...

mount.nfs: access denied by server while mounting slug:/mnt/torrents

mount.nfs: access denied by server while mounting slug:/mnt/albums

mount.nfs: access denied by server while mounting slug:/mnt/music

mount.nfs: access denied by server while mounting slug:/mnt/video

mount.nfs: access denied by server while mounting slug:/mnt/pics

mount.nfs: access denied by server while mounting slug:/mnt/doc

mount.nfs: access denied by server while mounting slug:/mnt/work1

mount.nfs: access denied by server while mounting slug:/mnt/work2

mount.nfs: access denied by server while mounting slug:/mnt/ref

 * Could not mount all network filesystems                                                                                                                                   [ !! ]

# cat /etc/fstab 

# /etc/fstab: static file system information.

#

# noatime turns off atimes for increased performance (atimes normally aren't 

# needed; notail increases performance of ReiserFS (at the expense of storage 

# efficiency).  It's safe to drop the noatime options if you want and to 

# switch between notail / tail freely.

#

# The root filesystem should have a pass number of either 0 or 1.

# All other filesystems should have a pass number of 0 or greater than 1.

#

# See the manpage fstab(5) for more information.

#

# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/sda1      /boot      ext3      noatime      1 2

/dev/sda2      /      ext3      noatime      0 1

/dev/sda3      /usr/portage   xfs      noatime,users   0 0

/dev/sda5      /home      ext3      defaults   0 0

/dev/sda6      /mnt/data   ext3      noatime,rw,users   0 0

/dev/sr0      /mnt/dvd1   auto      noauto,rw,users   0 0

/dev/sr1      /mnt/dvd2   auto      noauto,rw,users   0 0

#/dev/fd0      /mnt/floppy   auto      noauto      0 0

/dev/sdb1      /mnt/usb   auto      noauto,users   0 0

# NOTE: The next line is critical for boot!

proc                    /proc           proc            defaults        0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for 

# POSIX shared memory (shm_open, shm_unlink).

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

shm         /dev/shm   tmpfs      nodev,nosuid,noexec   0 0

### NSLU2 under SlugOSBE

## /media/sda (250Gb)

slug:/mnt/torrents      /mnt/slug/torrents      nfs   auto,rw,users   0 0

slug:/mnt/albums        /mnt/slug/albums        nfs   auto,rw,users   0 0

## /mnt/sdb (500Gb)

slug:/mnt/music         /mnt/slug/music         nfs   auto,rw,users   0 0

slug:/mnt/video         /mnt/slug/video         nfs   auto,rw,users   0 0

slug:/mnt/pics          /mnt/slug/pics2         nfs   auto,rw,users   0 0

slug:/mnt/doc           /mnt/slug/doc           nfs   auto,rw,users   0 0

slug:/mnt/work1         /mnt/slug/misc          nfs   auto,rw,users   0 0

slug:/mnt/work2         /mnt/slug/work          nfs   auto,rw,users   0 0

slug:/mnt/ref           /mnt/slug/ref           nfs   auto,rw,users   0 0

## RAID Array and LVM2 partitions (on final partition)

/dev/vg/music      /mnt/music      ext4   auto,rw,users   0 0

/dev/vg/pics      /mnt/pics      ext4   auto,rw,users   0 0

/dev/vg/ref      /mnt/ref      ext4   auto,rw,users   0 0

/dev/vg/video      /mnt/video      ext4   auto,rw,users   0 0

/dev/vg/work      /mnt/work      ext4   auto,rw,users   0 0

```

I can't see any differences in the two /etc/fstab's and the servers /etc/exports doesn't change so I'm clueless as to why I can mount from the laptop but not the server?

Any thoughts/suggestions on how to solve this?  I can post more detailed output if required, just let me know what I need to post.

Cheers

slack

----------

## f4u5t

What is the IP address of your desktop?

----------

## BlueFusion

Looks to be an IP issue.

Does /etc/exports allow using netmasks like this?  If I recall from my trial and error, I had to put each hostname/IP address for each system in my /etc/exports file, but was able to use netmasks in /etc/hosts.allow.

----------

## cach0rr0

 *BlueFusion wrote:*   

> Looks to be an IP issue.
> 
> Does /etc/exports allow using netmasks like this?  If I recall from my trial and error, I had to put each hostname/IP address for each system in my /etc/exports file, but was able to use netmasks in /etc/hosts.allow.

 

Not sure, I've always used CIDR notation, and it works

```

# /etc/exports: NFS file systems being exported.  See exports(5).

/data/shared 192.168.0.0/16(async,no_subtree_check,rw,all_squash,anonuid=65534,anongid=65534)

/data/music/genre 192.168.0.0/16(async,no_subtree_check,ro)

```

----------

## slackline

The strange thing is that this all worked fine before I had an unexpected (and unclean) power cycle on the NAS (due to the cat knocking it off the shelf   :Embarassed:  ).

All devices are on 192.168.1.*

NAS : 192.168.1.101

Desktop : 192.168.1.107

Laptop : 192.168.1.103

 *Quote:*   

> 
> 
> Looks to be an IP issue.
> 
> Does /etc/exports allow using netmasks like this? If I recall from my trial and error, I had to put each hostname/IP address for each system in my /etc/exports file, but was able to use netmasks in /etc/hosts.allow.

 

Yes you can, at least according to the -man exports- page...

```

EXPORTS(5)                                                Linux File Formats Manual                                                EXPORTS(5)

NAME

       exports - NFS file systems being exported (for Kernel based NFS)

SYNOPSIS

       /etc/exports

DESCRIPTION

       The  file  /etc/exports  serves  as  the  access  control  list  for file systems which may be exported to NFS clients.  It is used by

       exportfs(8) to give information to mountd(8) and to the kernel based NFS file server daemon nfsd(8).

       The file format is similar to the SunOS exports file. Each line contains an export point and a whitespace-separated  list  of  clients

       allowed  to  mount  the  file system at that point. Each listed client may be immediately followed by a parenthesized, comma-separated

       list of export options for that client. No whitespace is permitted between a client and its option list.

       Also, each line may have one or more specifications for default options after the path name, in the form of a dash ("-")  followed  by

       an option list. The option list is used for all subsequent exports on that line only.

       Blank  lines  are  ignored.   A pound sign ("#") introduces a comment to the end of the line. Entries may be continued across newlines

       using a backslash. If an export name contains spaces it should be quoted using double quotes. You can also  specify  spaces  or  other

       unusual character in the export name using a backslash followed by the character code as three octal digits.

       To apply changes to this file, run exportfs -ra or restart the NFS server.

   Machine Name Formats

       NFS clients may be specified in a number of ways:

       single host

              This  is  the  most  common  format. You may specify a host either by an abbreviated name recognized be the resolver, the fully

              qualified domain name, or an IP address.

       netgroups

              NIS netgroups may be given as @group.  Only the host part of each netgroup members is  consider  in  checking  for  membership.

              Empty host parts or those containing a single dash (-) are ignored.

       wildcards

              Machine  names  may  contain  the  wildcard  characters  *  and ?.  This can be used to make the exports file more compact; for

              instance, *.cs.foo.edu matches all hosts in the domain cs.foo.edu.  As these characters also match the dots in a  domain  name,

              the given pattern will also match all hosts within any subdomain of cs.foo.edu.

       IP networks

              You  can  also export directories to all hosts on an IP (sub-) network simultaneously. This is done by specifying an IP address

              and netmask pair as address/netmask where the netmask can be specified in dotted-decimal format, or as a contiguous mask length

              (for  example,  either  `/255.255.252.0'  or `/22' appended to the network base address result in identical subnetworks with 10

              bits of host). Wildcard characters generally do not work on IP addresses, though they may work by  accident  when  reverse  DNS

              lookups fail.

```

..and as I say it works from the laptop, but not the desktop, and everything worked fine before the NAS was interupted, but I seem to have got it back up and running fine bar this one problem of mounting the NFS files to the desktop.

slack

----------

## BlueFusion

For the sake of completeleness, can you post /etc/hosts.allow and /etc/hosts.deny on the NFS server and the output of route -an of all three systems?  And also for the hell of it, if you have iptables loaded, check iptables -L for any rules that may be blocking this.

By the way, not sure what NFS defaults to now, but I had issues accessing files bigger than 2GB before adding nfsvers=3 to my mount options if you ever run across that issue.

----------

## slackline

 *BlueFusion wrote:*   

> For the sake of completeleness, can you post /etc/hosts.allow and /etc/hosts.deny on the NFS server

 

On the NFS server I have...

```

$ more /etc/hosts.allow 

## Home network

ALL EXCEPT in.ftpd:192.168.1.*

portmap:    192.168.1.0/255.255.255.0

portmap:    255.255.255.255 0.0.0.0

mountd:     192.168.1.0/255.255.255.0

lockd:      192.168.1.0/255.255.255.0

statd:      192.168.1.0/255.255.255.0

rquotad:    192.168.1.0/255.255.255.0

$ more /etc/hosts.deny  

ALL:PARANOID

```

 *BlueFusion wrote:*   

>  and the output of route -an of all three systems?

 

The '-a' option isn't allowed (or even documented), but...

NFS Server

```

$ route -an

route: invalid option -- a

BusyBox v1.13.2 (2009-03-07 03:12:14 UTC) multi-call binary

Usage: route [{add|del|delete}]

Edit kernel routing tables

Options:

   -n   Don't resolve names

   -e   Display other/more information

   -A inet{6}   Select address family

$ route -n 

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

```

Desktop (which can't mount NFS)

```

# route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     0.0.0.0         255.255.255.0   U     2      0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         192.168.1.1     0.0.0.0         UG    2      0        0 eth0

```

Laptop (which can mount NFS)

```

# route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     0.0.0.0         255.255.255.0   U     2004   0        0 wlan0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         192.168.1.1     0.0.0.0         UG    2004   0        0 wlan0

```

 *BlueFusion wrote:*   

>    And also for the hell of it, if you have iptables loaded, check iptables -L for any rules that may be blocking this.

 

No iptables on any of these computers (I find my router does an ok job).

 *BlueFusion wrote:*   

> By the way, not sure what NFS defaults to now, but I had issues accessing files bigger than 2GB before adding nfsvers=3 to my mount options if you ever run across that issue.

 

Cheers, will bear that in mind.

----------

## f4u5t

 *slack---line wrote:*   

> The strange thing is that this all worked fine before I had an unexpected (and unclean) power cycle on the NAS (due to the cat knocking it off the shelf   ).
> 
> 

 

 :Very Happy:  Hmm...

Can you post the contents of /var/lib/nfs/etab ? Maybe try running "exportfs -r". Did the NFS server come back up cleanly (e.g., is whatever filesystem that holds /var/lib/nfs mounted read/write)?

Edit: also look at the log files on the NFS server.

----------

## slackline

 *f4u5t wrote:*   

>  *slack---line wrote:*   The strange thing is that this all worked fine before I had an unexpected (and unclean) power cycle on the NAS (due to the cat knocking it off the shelf   ).
> 
>  
> 
>  Hmm...
> ...

 

On the dodgy desktop I export my /usr/portage to be shared with the laptop so have...

```

$ cat /var/lib/nfs/etab 

/usr/portage   192.168.1.0/255.255.255.0(rw,sync,wdelay,hide,nocrossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

```

...on the server...

```

cat /var/lib/nfs/etab 

/mnt/torrents   192.168.1.0/255.255.255.0(rw,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

/mnt/albums   192.168.1.0/255.255.255.0(rw,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

/mnt/music   192.168.1.0/255.255.255.0(rw,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

/mnt/video   192.168.1.0/255.255.255.0(rw,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

/mnt/work1   192.168.1.0/255.255.255.0(rw,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

/mnt/work2   192.168.1.0/255.255.255.0(rw,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

/mnt/pics   192.168.1.0/255.255.255.0(rw,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

/mnt/doc   192.168.1.0/255.255.255.0(rw,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

/mnt/ref   192.168.1.0/255.255.255.0(rw,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,subtree_check,secure_locks,acl,anonuid=65534,anongid=65534)

```

Both of these directories are read/write on their respective systems.

Should I be trying 'exportfs -f' on the server, client or both?

Cheers everyone for your help so far, much appreciated,

slack

----------

## f4u5t

 *slack---line wrote:*   

> 
> 
> Should I be trying 'exportfs -f' on the server, client or both?
> 
> 

 

It would be "exportfs -r" on the server but that would only help if your etab was wrong but it looks OK.

Another thought is that there is some name resolution problem even though you are using IP address. Do you use DNS? What does the /etc/hosts file look like on the NFS server?

----------

## BlueFusion

I, too, was thinking it may be a DNS/hostname problem.  What I do is to put all of my systems hostnames in my /etc/hosts files on all of the systems and use the hostnames in my /etc/hosts.allow and /etc/exports file.  Atleast, that's what I do at my apartment.  Back at the homestead, I have a server running dnsmasq which acts as router, DHCP server, and does all of my DNS lookups so I don't have to bother setting all the hostnames in /etc/hosts on all the systems - just on the server running dnsmasq.

----------

## krinn

shutdown your laptop and do that on desktop

```

ifconfig eth0 192.168.1.103

mount -a
```

Still doesn't work: nothing about your ip so

Working: now you can dig that more.

 *slack---line wrote:*   

> No iptables on any of these computers (I find my router does an ok job). 

 

Maybe it WAS doing an ok job. I would have recheck it first.

----------

## slackline

Cheers for the pointers, will try these out this evening when I'm home.

Will report back.

slack

----------

## slackline

Right I don't think its an IP/host name resolution problem since I'm lazy and mirror the files across the computers.

```

# more /etc/hosts

127.0.0.1        localhost.localdomain                localhost slug

192.168.1.1        router1

192.168.1.2        router2

192.168.1.100        fisher

192.168.1.101        slug

192.168.1.102        printer

192.168.1.103        wright

192.168.1.104        paula

192.168.1.105        n95

192.168.1.106        ps3

192.168.1.107        darwin

# ifconfig 

eth0      Link encap:Ethernet  HWaddr 00:1D:7E:AA:C6:D5  

          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:11317219 errors:0 dropped:0 overruns:0 frame:0

          TX packets:20037111 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:100 

          RX bytes:703696889 (671.0 MiB)  TX bytes:1912176011 (1.7 GiB)

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:115 errors:0 dropped:0 overruns:0 frame:0

          TX packets:115 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:12954 (12.6 KiB)  TX bytes:12954 (12.6 KiB)

```

```

# more /etc/hosts 

# /etc/hosts: Local Host Database

#

# This file describes a number of aliases-to-address mappings for the for 

# local hosts that share this file.

#

# In the presence of the domain name service or NIS, this file may not be 

# consulted at all; see /etc/host.conf for the resolution order.

#

# IPv4 and IPv6 localhost aliases

127.0.0.1   localhost darwin

::1      localhost

192.168.1.1   router1

192.168.1.2   router2

192.168.1.100   fisher

192.168.1.101   slug

192.168.1.102   printer

192.168.1.103   wright

192.168.1.104   paula

192.168.1.105   n95

192.168.1.106   ps3

192.168.1.107   darwin

```

```

$ more /etc/hosts

# /etc/hosts: Local Host Database

#

# This file describes a number of aliases-to-address mappings for the for 

# local hosts that share this file.

#

# In the presence of the domain name service or NIS, this file may not be 

# consulted at all; see /etc/host.conf for the resolution order.

#

# IPv4 and IPv6 localhost aliases

127.0.0.1   localhost

::1      localhost

192.168.1.1   router1

192.168.1.2   router2

192.168.1.100   localhost fisher

192.168.1.101   slug

192.168.1.102   printer

192.168.1.103   wright

192.168.1.104   paula

192.168.1.105   n95

192.168.1.106   ps3

192.168.1.107   darwin

```

The routers iptables (Linksys WRT54G running HyperWRT Thibor 15c) has (as far as I'm aware) remained unchanged, I've not altered anything, so unless its been hacked...

[SNIP]

Thanks for all the suggestions/pointers so far, any more ideas welcome.

slack

----------

## krinn

Mirroring /etc/hosts doesn't help you for IP trouble, this just get sure that your DNS resolution will work and point to the same IP.

On the non working computer what "rpcinfo -p the_nas" do ?

2nd: for security you shouldn't expose 192.168.1.101 FQN for slug in public forum. You should edit and mask it.

----------

## f4u5t

FYI "iptables -L" isn't much use because it doesn't show the interfaces the rules may apply to. For example 

```

Chain FORWARD (policy ACCEPT)

target     prot opt source               destination         

ACCEPT     all  --  anywhere             anywhere

```

seems to indicate everything is forwarded and the rest of the forward rules are superfluous but I suspect that rule is just for the loopback interface. An "iptables -L -v" would show the interfaces.

Do the log files on the NAS have anything?

What happens when you run "showmount -e <nas>" from the desktop?

----------

## slackline

 *krinn wrote:*   

> Mirroring /etc/hosts doesn't help you for IP trouble, this just get sure that your DNS resolution will work and point to the same IP.

 

Yes, thats exactly why I do it, so that all computers have the same DNS resolution.

On the non working computer what "rpcinfo -p the_nas" do ?

[/quote]

Yep....

```

# rpcinfo -p slug

   program vers proto   port  service

    100000    2   tcp    111  portmapper

    100000    2   udp    111  portmapper

    100021    1   udp  42316  nlockmgr

    100021    3   udp  42316  nlockmgr

    100021    4   udp  42316  nlockmgr

    100003    2   udp   2049  nfs

    100003    3   udp   2049  nfs

    100003    4   udp   2049  nfs

    100021    1   tcp  51207  nlockmgr

    100021    3   tcp  51207  nlockmgr

    100021    4   tcp  51207  nlockmgr

    100003    2   tcp   2049  nfs

    100003    3   tcp   2049  nfs

    100003    4   tcp   2049  nfs

    100005    1   udp  60700  mountd

    100005    1   tcp  50809  mountd

    100005    2   udp  60700  mountd

    100005    2   tcp  50809  mountd

    100005    3   udp  60700  mountd

    100005    3   tcp  50809  mountd

    100024    1   udp  56360  status

    100024    1   tcp  59203  status

```

 *krinn wrote:*   

> 
> 
> 2nd: for security you shouldn't expose 192.168.1.101 FQN for slug in public forum. You should edit and mask it.

 

 :Embarassed:  hadn't realised the faux pas, how else does one go about posting firewall rules securely? (Going to hold back on the suggested 'iptables -L -v' in light of this).

 *f4a5t wrote:*   

> 
> 
> Do the log files on the NAS have anything?

 

Nope, dmesg doesn't show anything.  No other logging enabled at present.

 *f4a5t wrote:*   

> What happens when you run "showmount -e <nas>" from the desktop?
> 
> 

 

Output of that suggests the nfs shares can be seen, but still can't mount them

```

# showmount -e slug

Export list for slug:

/mnt/portage  192.168.1.0/255.255.255.0

/mnt/ref      192.168.1.0/255.255.255.0

/mnt/doc      192.168.1.0/255.255.255.0

/mnt/pics     192.168.1.0/255.255.255.0

/mnt/work2    192.168.1.0/255.255.255.0

/mnt/work1    192.168.1.0/255.255.255.0

/mnt/video    192.168.1.0/255.255.255.0

/mnt/music    192.168.1.0/255.255.255.0

/mnt/albums   192.168.1.0/255.255.255.0

/mnt/torrents 192.168.1.0/255.255.255.0

# /etc/init.d/netmount restart

 * Caching service dependencies ...                                                                                                                                           [ ok ]

 * Unmounting network filesystems ...                                                                                                                                         [ ok ]

 * Mounting network filesystems ...

mount.nfs: access denied by server while mounting slug:/mnt/torrents

mount.nfs: access denied by server while mounting slug:/mnt/albums

mount.nfs: access denied by server while mounting slug:/mnt/music

mount.nfs: access denied by server while mounting slug:/mnt/video

mount.nfs: access denied by server while mounting slug:/mnt/pics

mount.nfs: access denied by server while mounting slug:/mnt/doc

mount.nfs: access denied by server while mounting slug:/mnt/work1

mount.nfs: access denied by server while mounting slug:/mnt/work2

mount.nfs: access denied by server while mounting slug:/mnt/ref

 * Could not mount all network filesystems
```

----------

## slackline

 *krinn wrote:*   

> shutdown your laptop and do that on desktop
> 
> ```
> 
> ifconfig eth0 192.168.1.103
> ...

 

Just tried this out and got some strange results...

```

# /etc/init.d/net.eth0 stop

 * Stopping sshd ...                                                                                                                                                          [ ok ]

 * Unmounting network filesystems ...                                                                                                                                         [ ok ]

 * Stopping Music Player Daemon Audioscrobbler client ...                                                                                                                     [ ok ]

 * Bringing down interface eth0

 *   Stopping dhcpcd on eth0 ...                                                                                                                                              [ ok ]

# ifconfig eth0 192.168.1.103

# mount -a

darwin neil # df -h

Filesystem            Size  Used Avail Use% Mounted on

rootfs                 20G  7.3G   12G  39% /

/dev/root              20G  7.3G   12G  39% /

rc-svcdir             1.0M  100K  924K  10% /lib64/rc/init.d

udev                   10M  324K  9.7M   4% /dev

shm                   2.0G   12K  2.0G   1% /dev/shm

cachedir              4.0M  4.0K  4.0M   1% /lib64/splash/cache

/dev/sda1              46M   22M   22M  50% /boot

/dev/sda3              10G  7.1G  3.0G  71% /usr/portage

/dev/sda5             9.9G  3.8G  5.7G  40% /home

/dev/sda6             420G  211G  188G  53% /mnt/data

/dev/mapper/vg-music  247G  126G  109G  54% /mnt/music

/dev/mapper/vg-pics   247G   94G  141G  40% /mnt/pics

/dev/mapper/vg-ref    9.9G  3.4G  6.1G  36% /mnt/ref

/dev/mapper/vg-video  247G   49G  185G  21% /mnt/video

/dev/mapper/vg-work    50G   12G   36G  24% /mnt/work

slug:/mnt/torrents    105G   78G   22G  79% /mnt/slug/torrents

slug:/mnt/albums      105G   30G   71G  30% /mnt/slug/albums

slug:/mnt/music       188G  148G   31G  83% /mnt/slug/music

slug:/mnt/video        94G   84G  5.8G  94% /mnt/slug/video

slug:/mnt/pics         94G   90G  1.9M 100% /mnt/slug/pics2

slug:/mnt/doc          19G   15G  3.8G  79% /mnt/slug/doc

slug:/mnt/work1        19G  3.7G   15G  21% /mnt/slug/misc

slug:/mnt/work2        29G  5.9G   21G  22% /mnt/slug/work

slug:/mnt/ref          18G  3.4G   13G  21% /mnt/slug/ref

```

So manually setting the IP address allowed me to manually mount the NFS partitions. Excellent, I've made some progress.

So, back to using the init scripts...

```

# /etc/init.d/net.eth0 restart

 * Bringing up interface eth0

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd: version 5.1.4 starting

dhcpcd: eth0: rebinding lease of 192.168.1.107

dhcpcd: eth0: acknowledged 192.168.1.107 from 192.168.1.1

dhcpcd: eth0: checking for 192.168.1.107

dhcpcd: eth0: leased 192.168.1.107 for 86400 seconds

dhcpcd: forking to background                                                                                                                                                 [ ok ]

 *     received address 192.168.1.103/24                                                                                                                                      [ ok ]

darwin neil # ifconfig 

eth0      Link encap:Ethernet  HWaddr 00:1f:d0:20:79:79  

          inet addr:192.168.1.103  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::21f:d0ff:fe20:7979/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1924467 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2302940 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:961044432 (916.5 MiB)  TX bytes:2153421747 (2.0 GiB)

          Interrupt:30 Base address:0x6000 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:2295 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2295 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:239296 (233.6 KiB)  TX bytes:239296 (233.6 KiB)

darwin neil # mount -a

mount.nfs: access denied by server while mounting slug:/mnt/torrents

mount.nfs: access denied by server while mounting slug:/mnt/albums

mount.nfs: access denied by server while mounting slug:/mnt/music

mount.nfs: access denied by server while mounting slug:/mnt/video

mount.nfs: access denied by server while mounting slug:/mnt/pics

mount.nfs: access denied by server while mounting slug:/mnt/doc

mount.nfs: access denied by server while mounting slug:/mnt/work1

mount.nfs: access denied by server while mounting slug:/mnt/work2

mount.nfs: access denied by server while mounting slug:/mnt/ref

```

Back to square one!   :Sad: 

The IP address is still being reported as 192.168.1.103 as it was when manually set, but I can't mount the partitions (manually as above or using the /etc/init.d/netmount script).

Very strange?!?!?!

slack

----------

## BlueFusion

When you run the init script, it starts net.eth0 again, therefore setting your IP back to what it is set for.  If you leave net.eth0 started and just use ifconfig to change your IP address, the init script should work.  Although I prefer the nfsmount init script over netmount.

----------

## krinn

dhcpcd can and change dns settings (i think the option -R prevent that). so net.eth0 off = dhcpcd off and it work, when on it doesn't.

you should try

```
/etc/init.d/net.eth0 stop

ping -c1 slug

/etc/init.d/net.eth0 restart

ping -c1 slug
```

As stupid as it could be, slug could be someone and then be some other computer.

----------

## slackline

 *BlueFusion wrote:*   

> When you run the init script, it starts net.eth0 again, therefore setting your IP back to what it is set for.

 

That doesn't appear to be the case though unless ifconfig is mis-reporting.  In the above you can see that the computer is given 192.168.1.107 by the router (since I've configured it to assign IP addess' based on MAC address'), yet at the final step it indicates that its using 192.168.1.103 and that is what ifconfig reports.

 *BlueFusion wrote:*   

>   If you leave net.eth0 started and just use ifconfig to change your IP address, the init script should work.

 

Until I reboot because the router will assign it 192.168.1.107.

 *BlueFusion wrote:*   

>   Although I prefer the nfsmount init script over netmount.

 

Might try this out.

 *krinn wrote:*   

> dhcpcd can and change dns settings (i think the option -R prevent that). so net.eth0 off = dhcpcd off and it work, when on it doesn't.
> 
> you should try
> 
> ```
> ...

 

Will try this at home (can't stop and test over SSH), but currently the computer thinks slug is...

```

$ ping slug

PING slug (192.168.1.101) 56(84) bytes of data.

64 bytes from slug (192.168.1.101): icmp_seq=1 ttl=64 time=0.575 ms

64 bytes from slug (192.168.1.101): icmp_seq=2 ttl=64 time=0.267 ms

64 bytes from slug (192.168.1.101): icmp_seq=3 ttl=64 time=0.268 ms

^C

--- slug ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2000ms

rtt min/avg/max/mdev = 0.267/0.370/0.575/0.144 ms

```

I can ssh into slug using the name/alias of slug, I can scp files too and from it.  I just can't for the life of me get the damn NFS file systems mounted on this one computer (laptop fine, as is wife's that I've checked from).

Thanks for all the suggestions, much appreciated.  Will report back later,

Neil

----------

## krinn

if you can ssh to slug then my suggestion was stupid  :Very Happy: 

But considering how it works and then doesn't, you have a service that change conditions on how your nfs server see your client when net.restart is done.

----------

## f4u5t

That's odd. Am I understanding it correctly: you manually set the IP to 192.168.1.103 and NFS mounts work but when you run DHCP it receives .107 but doesn't change eth0's ip address to that but then the NFS mounts don't work?

I'm going back to my idea that it is a DNS problem and dhcp is messing up resolv.conf. Can you post the constents of /etc/resolv.conf on the desktop and NAS?

----------

## slackline

 *krinn wrote:*   

> if you can ssh to slug then my suggestion was stupid 
> 
> But considering how it works and then doesn't, you have a service that change conditions on how your nfs server see your client when net.restart is done.

 

Yep, thats the strange and confusing thing, never had a problem ssh'ing to slug.

Its nothing to do with DNS as far as I understand things, because slug is not being set to 192.168.1.101 by DNS, but rather by /etc/hosts.

 *f4u5t wrote:*   

> 
> 
> That's odd. Am I understanding it correctly: you manually set the IP to 192.168.1.103 and NFS mounts work but when you run DHCP it receives .107 but doesn't change eth0's ip address to that but then the NFS mounts don't work? 
> 
> 

 

As the above code was copied verbatim and executed sequentially thats exactly what is happening.

 *f4u5t wrote:*   

> 
> 
> I'm going back to my idea that it is a DNS problem and dhcp is messing up resolv.conf. Can you post the constents of /etc/resolv.conf on the desktop and NAS?

 

I don't think it is though, as both the NFS server, my desktop client and my laptop client all use my router for DNS and all three have the following...

```

$ more /etc/resolv.conf 

# Generated by resolvconf

nameserver 192.168.1.1

```

I'm game to try anything though, would debugging or increasing verbosity of init scripts be of any use?

----------

## krinn

maybe some log of the server (just the part where it refuse the connection), the reason might just be there.

----------

## slackline

 *krinn wrote:*   

> maybe some log of the server (just the part where it refuse the connection), the reason might just be there.

 

Just trying to suss out logging on the server.

Its running SlugOS and NFS doesn't seem to have been stripped down and doesn't have many options, have installed syslog-ng, but it shows nothing...

```

~$ nfsd --help

Usage:

nfsd [-H hostname] [-p|-P|--port port] [-N|--no-nfs-version version ] [-T|--no-tcp] [-U|--no-udp] nrservs

~$ man nfsd

No manual entry for nfsd

```

After unsuccessfully trying to mount from the desktop...

```

# grep -i nfs /opt/var/log/syslog 

# 

```

i.e. nothing.

slack

----------

## melinux

Another tip which may help.

In order to allow remoteClient.com to mount from the nfs server (orion) I

had to put this line in /etc/hosts.allow:

"mountd: nfsClient.com"

portmap: nfsClient.com no longer works in hosts.allow.

Hopefully this helps someone.

----------

