# Mounting an external network harddrive via NFS



## Sourav Chatterjee (Feb 21, 2015)

Hello all,

I am new to FreeBSD and NFS as well. I am at a fix and require urgent help from you.

I have a WD external network hard drive with a static IP. I am trying to mount it in a FreeBSD machine.

I tried
`sudo mount -t nfs (IP of harddisk):/nfs/Public /localfolder`

It says

```
udp 10.0.0.5:/nfs/Public: RPCPROG_NFS: RPC: Port mapper failure - RPC: Unable to send
```

The IP of the PC is in the allowed list of IPs for the NFS service in the hard disk.
Automounting is disabled as it was not allowing the system to boot. I want to mount it manually.

Every time I try, I get a message that:

```
10.0.0.5 is on bge1 but got reply from (mac id of hd) on bge0
```

Please help! Thanks in advance.


----------



## Oko (Feb 21, 2015)

Sourav Chatterjee said:


> udp 10.0.0.5:/nfs/Public: RPCPROG_NFS: RPC: Port mapper failure - RPC: Unable to send


You don't provide enough info for trouble shooting. Where does NFS server runs (OS version and NFS server version 3 or 4). Disable for now all the firewall on the NFS server and the client machine. Does your NFS server export via tcp or udp protocol. It looks from above that you might be running NFS server on some kind
Linux and many of them  foolishly use NFSv4 as default and export things via TCP. IIRC FreeBSD NFS client will try to bind via UDP protocol. Disable firewall on NFS client machine. Please provide the output of the following commands both from the server and client 

```
rpcinfo -p NFS-server-IP
showmount -a NFS-server-IP
```

Note that the NFS-server-IP address of the server should read 127.0.0.1 when you are on the server itself.


----------



## wblock@ (Feb 21, 2015)

Oko, it is a network hard drive with a built-in NFS server.

Sourav Chatterjee: you do not describe the network configuration, but it is fairly obvious that the computer has two network ports and the network drive is connected to the wrong one.  Please show the output of `ifconfig`.


----------



## Sourav Chatterjee (Feb 21, 2015)

Yes, wblock@. It is WD My Book, which has NFS server inbuilt.
Here is the output from `ifconfig`.


```
bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
   options=1b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING>
   inet 192.168.254.21 netmask 0xffffff00 broadcast 192.168.254.255
   ether 00:30:48:89:be:2c
   media: Ethernet autoselect (100baseTX <full-duplex>)
   status: active
bge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
   options=1b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING>
   inet 10.0.0.3 netmask 0xffffff00 broadcast 10.0.0.255
   ether 00:30:48:89:be:2d
   media: Ethernet autoselect (none)
   status: no carrier
fwe0: flags=108802<BROADCAST,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500
   options=8<VLAN_MTU>
   ether 02:11:06:55:56:07
   ch 1 dma -1
plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
   inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5
   inet6 ::1 prefixlen 128
   inet 127.0.0.1 netmask 0xff000000
```

NOTE: I mentioned the message regarding reply on beg0 in my first post. In the rc.conf file of my PC beg0 is 192.168.254.21 netmask 255.255.255.0 (which is the netmask given in the hard disk too). Is it causing problem?

For your convenience, I have a switch connected with a wifi modem. From the switch one port goes to HD and one to the PC.


----------



## wblock@ (Feb 21, 2015)

The 10.0.0.0/24 network is set up on bge1, but it should be on bge0.  You could remove that from bge1 and add an alias to bge0, or set the WD drive to an IP address in the 192.168.254.0/24 network that is already on bge0.

This still may not solve the NFS problem, but one thing at a time.


----------



## Sourav Chatterjee (Feb 21, 2015)

Okay. I have set the hard drive to an IP of that network.
Now I get no response on typing `sudo mount -t nfs 192.268.254.9:/nfs/Public /localfolder`
Even when I `df` to it, it hangs, gives no response.


----------



## Oko (Feb 22, 2015)

wblock@ said:


> Oko, it is a network hard drive with a built-in NFS server.


It is probably running some kind embedded Linux.


----------



## wblock@ (Feb 23, 2015)

Sourav Chatterjee said:


> Okay. I have set the hard drive to an IP of that network.
> Now I get no response on typing `sudo mount -t nfs 192.268.254.9:/nfs/Public /localfolder`
> Even when I `df` to it, it hangs, gives no response.



Does it respond to pings?  After that, I would check that the network drive settings allow the FreeBSD machine to connect.  Then make sure that access is not blocked by a firewall on the FreeBSD system, the network drive, or possibly a router between them.


----------



## Sourav Chatterjee (Feb 23, 2015)

Well. It is mounted now. It took a long time, not sure about the reason, but its mounted finally. Seems like it was problem with the wrong networking port only. Can you tell me how can I make an alias to beg0? Should I modify /etc/rc.conf?


----------



## Sourav Chatterjee (Feb 24, 2015)

I made an alias to bge0 through `ifconfig`. Then I gave that ip to the WD hard disk. But then it says:

```
[udp] 10.0.0.6:/nfs/Public: Permission denied
```
Any help?


----------



## jef (Mar 15, 2015)

Again, without knowing what `ifconfig` is showing for your configuration, it's hard to tell. Your /etc/rc.conf would be helpful as well.

bge1 doesn't seem to be connected to anything. Having it present with an unattached network is likely causing your routing table to be incorrect. I'm not sure why it's there, unless you have two, physical Ethernet connections on your machine.

What I believe you need to do is:

_Assuming there is a good reason to have the drive on the 10.0.0.0 network and you don't have a physical network associated with it
(because, if you did, it doesn't seem to be plugged in to the bge1 socket):_

Take bge1 off the 10.0.0.0 network (look at ifconfig())
Add an _alias _to bge0 for the 10.0.0.0 network
Confirm that the routing table is clean; `netstat -rn`
Confirm that you can `ping 10.0.0.6` (assuming that the drive still has that IP address)
_Assuming that there isn't 
(and this is probably the case, especially if you need to access the drive from other machines on the 192.168.254.0 network):_

Set the hard drive to an address in the 192.168.254.0 network
Take bge1 off the 10.0.0.0 network (look at ifconfig())
Confirm that the routing table is clean; `netstat -rn`

Confirm that you can `ping 192.168.254.nnn` (the IP address given to the hard drive in (1), just above)
After success here, you should reflect these changes in /etc/rc.conf (look at rc.conf())

Once you've done that, you should be able to move to confirming that you can use NFS with the drive.


----------



## junovitch@ (Mar 17, 2015)

Sourav Chatterjee said:


> I made an alias to bge0 through `ifconfig`. Then I gave that ip to the WD hard disk. But then it says:
> 
> ```
> [udp] 10.0.0.6:/nfs/Public: Permission denied
> ...



Do you have multiple IPs assigned now?  What's likely happening is the outbound UDP packet is probably using the 192.168.x.x address rather than the alias   So that won't match the ACL.  It's a bit confusing since there's been 10/8 and 192.168/16 addresses and some changes since the first post.  What addresses are currently on the host right now?  What about the NFS drive?  Can you show the `ifconfig` from the FreeBSD client, list the IPs on the NFS server, and show the current `showmount -e 10.0.0.6`?


----------

