From: David Liontooth <liontooth@cogweb.net>
To: nfs@lists.sourceforge.net
Subject: Re: NFS using iptables PREROUTING?
Date: Sun, 08 Jul 2007 23:25:00 -0700 [thread overview]
Message-ID: <4691D4BC.2010007@cogweb.net> (raw)
In-Reply-To: <46910E50.2020000@cogweb.net>
David Liontooth wrote:
> Is it possible to access an NFS server on a private network from a
> machine on a public network?
>
It turns out to be a lot simpler than I thought -- no need to worry
about lockd, portmap, or statd.
On the host A, set the mountd port in /etc/default/nfs-kernel-server:
RPCMOUNTDOPTS="--port 4000"
In the gateway G's /etc/network/if-up.d/00-firewall, forward the NFS and
the mountd ports
# NFS: Forward udp on port 2049 to A on the private network
iptables -t nat -A PREROUTING -p udp -d 128.65.183.178 --dport 9101
-j DNAT --to 192.168.0.3:2049
# Forward tcp and udp for mountd on A (port assigned in
A:/etc/default/nfs-common)
iptables -t nat -A PREROUTING -p tcp -d 128.65.183.178 --dport 9201
-j DNAT --to 192.168.0.3:4000
iptables -t nat -A PREROUTING -p udp -d 128.65.183.178 --dport 9201
-j DNAT --to 192.168.0.3:4000
In the client B's /etc/hosts, define an alias for the NFS host behind
the firewall, using the IP address of the gateway:
128.65.183.178 a.fully.qualified.domain.name A
And in the client B's /etc/fstab, define the mount, adding the gateway's
ports that forward NFS and mountd to the host:
A:/db1 /mnt/a1 nfs
noauto,user,exec,rw,rsize=16k,wsize=16k,hard,intr,port=9101,mountport=9201
0 0
Works beautifully and transparently. Or does someone spot a potential
problem?
Cheers,
Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
next prev parent reply other threads:[~2007-07-09 6:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-08 16:18 NFS using iptables PREROUTING? David Liontooth
2007-07-09 6:25 ` David Liontooth [this message]
2007-07-09 10:39 ` Jeff Layton
2007-07-09 18:37 ` David Liontooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4691D4BC.2010007@cogweb.net \
--to=liontooth@cogweb.net \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox