About sharing a folder with NFS which is already a NFS folder shared by another server

I have a server (named "head") which is linked to two networks, which are not inter-connected. On network-1, a folder is shared by server (named "server1") through NFS. This folder is then mounted on "head" as: /public/server1. I want to share folder: /public on "head" to machines on network-2, by which, collaterally, I intend all machines on network-2 be able to access contents on "server1" by mounting NFS folder head:/public and accessing folder: /public/server1. I tried this but failed. The machine on network-2 can only see a blank folder of /public/server1 without the content on "server1". How can I achieve what I wanted? Thanks.


What you're asking for is something of an NFS proxy. They exist, but the free ones are terrible and the commercial ones are ridiculously expensive. However, you don't really need what you've asked for.

If your "head" server is linked to two networks, you can simply have it act as a router for systems on network-1 to access systems on network-2. For example, if network-1 is 192.168.1.0/24 and network-2 is 192.168.2.0/24, and head is 192.168.1.10 on network-1 and 192.168.2.10 on network-2, and your filesystem on network-2 is 192.168.2.11, then your network-1 clients would have a route like this:

route add 192.168.2.11 gw 192.168.1.10

This would tell the clients to route access to 192.168.2.11 via 192.168.1.10 (aka "head"). This presumes that you have routing enabled on your head system.

With this solution, you don't need to worry about re-exporting anything; the clients are simply accessing the fileserver directly as you're already able to do from your head node.