Linux Netfilter discussions
 help / color / mirror / Atom feed
* NAT WAN IP to internal range?
@ 2011-12-19  3:20 Andrew Stone
  2011-12-21  9:07 ` Andrew Beverley
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Stone @ 2011-12-19  3:20 UTC (permalink / raw)
  To: netfilter

Hello,

I am having a bit of trouble following the documentation on assigning
a range of NATed IPs.
My router has a several External IP’s assigned to the WAN interface:

WANIF=`get_wanface`
ifconfig $WANIF:1 a.b.c.241 netmask 255.255.255.248 broadcast a.b.c.247
ifconfig $WANIF:2 a.b.c.242 netmask 255.255.255.248 broadcast a.b.c.247
ifconfig $WANIF:3 a.b.c.243 netmask 255.255.255.248 broadcast a.b.c.247

Then I have successfully configured a single internal machine natted
with the 241 address like so:

iptables -t nat -I PREROUTING -d a.b.c.241 -j DNAT --to-destination 192.168.1.69
iptables -t nat -I POSTROUTING -s 192.168.1.69 -j SNAT --to-source a.b.c.241

That works great, but I need the second IP (242) to be the external IP
for a _range_ of internal IPs

I have tried this however it does not appear to work:

iptables -t nat -A PREROUTING -d a.b.c.242 -j DNAT --to-destination
192.168.1.100-192.168.1.150
iptables -t nat -A POSTROUTING -s 192.168.1.100-192.168.1.150 -j SNAT
--to-source 150.101.194.242

This article suggests (at least to me) that this is possible:
http://www.cyberciti.biz/tips/linux-iptables-how-to-specify-a-range-of-ip-addresses-or-ports.html

The ‘Nat how to docs’ seem to suggest that a range can be specified,
but I suspect my usage is wrong?
http://www.netfilter.org/documentation/HOWTO//NAT-HOWTO-6.html#ss6.2


How do I NAT a WAN IP to a range of internal IPs?

Thanks and kind regards,
Andrew Stone.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-12-29 13:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-19  3:20 NAT WAN IP to internal range? Andrew Stone
2011-12-21  9:07 ` Andrew Beverley
2011-12-29  9:42   ` Andrew Stone
2011-12-29 10:54     ` Vigneswaran R
2011-12-29 11:07       ` Vigneswaran R
2011-12-29 11:10         ` Andrew Stone
2011-12-29 11:35           ` Vigneswaran R
2011-12-29 13:38             ` Andrew Stone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox