How to create an NFS proxy by using kernel server & client?

7,361

The NFS protocol does not support proxies. What you could do though is use iptables NAT to connect your clients to the server that is reachable only via the Ubuntu server.

Assume the following network

       Ubuntu server eth0: x.x.x.x
       NFS server:         x.x.x.y
       Clients:            z.z.z.0/24
       Ubuntu server eth1: z.z.z.x

then you will need iptables rules of the kind:

  -t nat -A POSTROUTING -s z.z.z.0/255.255.255.0 -d x.x.x.y -o eth0 -j SNAT \
                --destination x.x.x.y --to-source z.z.z.x
  -t filter -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT  
Share:
7,361

Related videos on Youtube

Martin C. Martin
Author by

Martin C. Martin

Updated on September 18, 2022

Comments

  • Martin C. Martin
    Martin C. Martin almost 2 years

    I have a file server that exports as NFS. On an Ubuntu machine I mount that, then try to export it as an NFS volume. When I go to export it, I get the message:

    exportfs: /test/nfs-mount-point does not support NFS export
    

    How can I get this to work, or at least get more information as to what the problem is?

    Exact steps:

    Ubuntu 12.04

    mount -f nfs myfileserver.com:/server-dir /test/nfs-mount-point
    

    [Works fine, I can read & write files]

    /etc/exports contains:

    /test/nfs-mount-point *(rw,no_subtree_check)
    
    sudo /etc/init.d/nfs-kernel-server restart
    
     * Stopping NFS kernel daemon                                      [ OK ] 
     * Unexporting directories for NFS kernel daemon...                [ OK ] 
     * Exporting directories for NFS kernel daemon...           exportfs: /test/nfs-mount-point does not support NFS export
                                                                       [ OK ]
     * Starting NFS kernel daemon                                      [ OK ] 
    
  • rudolfbyker
    rudolfbyker over 2 years
    Also, why is destination specified twice? Aren't -d and --destination the same flag?