NFS over linux server to another linux server

Posted on 2008-11-13
Last Modified: 2013-12-16
I have a server1 that is directly connect to another server2 with two nic cards.  The other nic on server2 is connected to the internet.  I would like to be able to connect nfs to the server1 from another server3 from the internet.  Since I can't mount nfs to nfs mount (I don't think there is a way?)  so I need another way.  I would like the most speed out of it I can since everything is on 100Mbit connections.

Can I setup port forwards with iptables on server2 to forward certain ports to server1?  if so can you should me an example.  NOTE:  I do know how to setup static ports in nfs.

Thank you.
Question by:W00dyW00d
    LVL 8

    Expert Comment

    Hi W00dyW00d,

    There is a little ambiguity in your question: which is the client, which is the server? Is server1 a server and server3 a client? Does server2 expose any NFS mounts currently (or will it)?

    Is your connection to the 'net via some sort of dedicated high-speed or do you have a cable modem (or some type of dynamic-based address)?

    If you can provide a little more info, it will be easier to provide you a solution.

    NFS to NFS is possible - but so dangerous, that it's not even worth considering!   =8^O



    Author Comment

    server1 ( server with nfs mounts)
      connects to server2 eth1 (

    server2 ( server with nfs mounts)
       connects to server1 eth1 (
       connect to internet with eth0 (

    server3 client for both nfs servers (321.321.321.321)
       currently connects to server2 with nfs mounts
       needs to connect to server1 with nfs mounts
    LVL 14

    Expert Comment

    How about putting OpenVPN on servers 2 and 3, and connect server 3 to the network that has server1 and 2 on it.  That'll give you a nice, encrypted tunnel, with full access in both directions.

    Author Comment

    Well that is interesting idea.  I was also thinking of ssh tunnel.  How would speed be when moving files sizing around 100MB to 1GB over vpn.  The line is 100Mbit between the server2 and server3 (client).

    Thank you for the help.
    LVL 14

    Expert Comment

    SSH would be fine if you just want nfs access occasionally, and you are able to log in manually each time and establish the ssh tunnel.  Certainly the easiest thing to do.

    OpenVPN or any VPN for that matter is better if you want a permanent tunnel between two networks, especially if you want to use more than one service.  With the VPN you could allow a while network behind server3 to access server1 if you wanted.  Might be over-kill for your scenario - thats up to you.

    Performance  is hard to tell.  The machines are certainly going to have to do some work to encrypt the data.  If the CPUs are fast, then it wouldn't be too bad.  If they are slow it might really slow you down.  Any modern CPU should be fine.  It is really going to depend on your internet connection between server1 and server3.  Residential lines are usually faster in one direction (downstream), so it would also matter what direction traffic is flowing.

    Hope that helps...
    LVL 14

    Accepted Solution

    Here's a good link on tunneling nfs over ssh - I'm sure  you found it too with some quick googling.

    Author Comment

    Okay thank you for the great replies.  I'm try to set it up over the weekend.  I'm going to leave this question open just in case i have questions.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
    The DROP (Spamhaus Don't Route Or Peer List) is a small list of IP address ranges that have been stolen or hijacked from their rightful owners. The DROP list is not a DNS based list.  It is designed to be downloaded as a file, with primary intention…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now