Networking Forums

Networking Forums > Computer Networking > Linux Networking > Iptables and local nat

Reply
Thread Tools Display Modes

Iptables and local nat

 
 
Armin
Guest
Posts: n/a

 
      03-09-2005, 01:45 PM
Hey


I have 2 subnets 192.168.1.0/24 and 192.168.0.0/24.The 192.168.0.0/24
subnet is behind a ipsec vpn.In the second subnet 192.168.1.0/24 I have
aa server witch is running a special app. This app however doesnt
accept connections from any other subnet than it is in. So what I need
to do is
somehow masquerade the 192.168.0.0/24 subnet for the server with
iptables. The problem is that the server where the app is running is
also running iptables wich should do the masquerading. The app uses only
two ports. Can anyone help me create a rule for iptables to make this work

Thanks in advance!

Armin
 
Reply With Quote
 
 
 
 
Ken
Guest
Posts: n/a

 
      03-10-2005, 05:23 AM
Hi Armin -

On Wed, 09 Mar 2005 16:45:34 +0200, Armin <(E-Mail Removed)> wrote:

>The problem is that the server where the app is running is
>also running iptables wich should do the masquerading.


Other than this part, it's easy enough with a DNAT and SNAT pair. I
have a setup like this to connect to a device with a hard-coded IP
address which is on a different subnet from our LAN, and which cannot
have a gateway IP address specified.

I PREROUTING DNAT everything directed to a specific IP address which
is on my regular subnet to the address of the device. I POSTROUTING
SNAT everything to that destination to an IP address on the same
subnet as the device. Both of those IP addresses are aliases on the
same NIC as has the Linux system's main IP address. Besides only
needing one NIC, I can plug the device in anywhere on our LAN; it
doesn't have to be connected directly to the Linux system.

You could try the same thing running on the same system. I think you
would need three IP addresses, one for the clients to connect to (on
either subnet), one for the SNAT, and the one which the application
uses. They can all be aliases on one actual NIC. If IP address that
the clients connect is on the same subnet as the application, you
might not need three addresses, especially since this is limited to
two ports. If netfilter is smart enough and you code the rules
precisely enough, it might even be possible to do it all on one IP
address.

--
Ken
http://www.ke9nr.net/
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
disable local routing between eth0 and eth1 - iptables astonishs@yahoo.com Linux Networking 9 05-28-2008 02:34 AM
iptables port forwarding to non local ip addresses Raptolino Linux Networking 4 11-21-2007 07:12 PM
Route local traffic via Iptables Jacob Linux Networking 3 08-07-2006 10:20 PM
iptables forward to local different port Ross Linux Networking 13 06-17-2006 12:32 PM
iptables port forwarding blocked from local subnet Bart Linux Networking 2 10-16-2005 07:24 PM



1 2 3 4 5 6 7 8 9 10 11