All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: NAT question
@ 2004-06-30 13:28 Kiran Kumar Immidi
  2004-06-30 14:02 ` Vijaya Chandra Vupputuri
  0 siblings, 1 reply; 21+ messages in thread
From: Kiran Kumar Immidi @ 2004-06-30 13:28 UTC (permalink / raw)
  To: immidi, netfilter-devel, Vijaya Chandra Vupputuri

[-- Attachment #1: Type: text/html, Size: 816 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread
* NAT question
@ 2012-01-25 16:16 Stephen Clark
  2012-01-25 17:30 ` Jan Engelhardt
  0 siblings, 1 reply; 21+ messages in thread
From: Stephen Clark @ 2012-01-25 16:16 UTC (permalink / raw)
  To: Netfilter Developer Mailing List

Can iptables do a network to network nat without having to write out a bunch of 
nat rules.
In other words translate  192.168.198.0/24 to 172.16.10.0/24 without having to 
write out
256 rules.

Also can iptables handle 1000 nat rules like above if they have to be written out on
a 1.66ghz intel dual core atom with 1gb of mem.

I know this isn't appropriate question for devel list but I didn't find anything 
googling.

Thanks,

-- 

"They that give up essential liberty to obtain temporary safety,
deserve neither liberty nor safety."  (Ben Franklin)

"The course of history shows that as a government grows, liberty
decreases."  (Thomas Jefferson)




^ permalink raw reply	[flat|nested] 21+ messages in thread
* RE: NAT question
@ 2005-03-11 15:15 Justin Piszcz
  0 siblings, 0 replies; 21+ messages in thread
From: Justin Piszcz @ 2005-03-11 15:15 UTC (permalink / raw)
  To: Jason Opperisano, netfilter

It is either that or what I took from this thread is that he wants the
actual public IP's behind his main machine.


Router ----------> MAINBOX (public ip#1) ---------> BOX1 (public ip#2)
                                         ---------> BOX2 (public ip#3)

Is this the case?

If so, it is possible but I have not personally tried it myself using an
arp daemon so you basically send/forward the traffic to the other hosts.

Check the networking options and help in the kernel configuration for
more information.

-----Original Message-----
From: netfilter-bounces@lists.netfilter.org
[mailto:netfilter-bounces@lists.netfilter.org] On Behalf Of Jason
Opperisano
Sent: Friday, March 11, 2005 10:13 AM
To: netfilter@lists.netfilter.org
Subject: Re: NAT question

On Fri, 2005-03-11 at 08:56, Dimitri Yioulos wrote:
> >> Hello, all.
> >>  
> >> I've recently set up iptables-1.2.8-12.3 on a CentOS 3.4 (RHEL AS
3) box.
> >> Among other things, I've created a DMZ where my Web and mail
servers
> >>live.
> >> My problem is that my Web and mail servers identify themselves with
the
> >> NAT
> >> ip address that I've assigned   Here's my NAT rule: 
> >> 
> >>  IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source 
> >> $INET_IP 
> >> 
> >> How can I get these two servers to identify themselves by their own
ip
> >> addresses and still provide NAT for my users?
> 
> >specify the source address so that only packets from the inside
network
> >match the SNAT rule:
> 
> >  iptables -t nat -A POSTROUTING -o $INET_IFACE -s $INSIDE_NET \
> >    -j SNAT --to-source $INET_IP
> 
> 
> Thanks to all for your replies!
> 
> I was hopeful about applying the above rule.  Internet connectivity is
fine;
> inbound mail is fine; outbound mail seems not to make it (if the list
> receives this, it's because I rolled back to the original rule).  Does
that
> make any sense?
> 
> Dimitri

are your web and mail servers NAT-ed as well?  it was unclear from your
original post, an i assumed that you were using Internet-routed IP space
in your DMZ.  if this is not the case--you need to put your rules in the
proper order.

if you have a static (one-to-one) NAT for a DMZ machine, and also want
to perform a hide NAT (many-to-one) NAT for your internal net's outbound
traffic--you'd have something like:

  # inbound one-to-one NAT for web server
  iptables -t nat -A PREROUTING -i $INET_IFACE -d $WEB_SRV_PUB_IP \
    -j DNAT --to-destination $WEB_SRV_PRIV_IP

  # outbound one-to-one NAT for web server
  iptables -t nat -A POSTROUTING -o $INET_IFACE -s $WEB_SRV_PRIV_IP \
    -j SNAT --to-source $WEB_SRV_PUB_IP

  # outbound many-to-one NAT for inside net
  iptables -t nat -A POSTROUTING -o $INET_IFACE -s $INSIDE_NET \
    -j SNAT --to-source $INET_IP

order matters--place the one-to-one SNAT rules before any many-to-one
SNAT rules.

in order for packets destined for $WEB_SRV_PUB_IP to make it to your
firewall's $INET_IFACE, it either needs to be routed that way by your
upstream Internet router, or you need to add it as an alias:

  ip addr add $WEB_SRV_PUB_IP dev $INET_IFACE

HTH...   any sorry for misleading before.

-j

--
"Do you want to change your name to Homer Junior? The kids can call
 you Hoju!"
	--The Simpsons




^ permalink raw reply	[flat|nested] 21+ messages in thread
* NAT question
@ 2005-03-11 12:43 Dimitri Yioulos
  2005-03-11 12:50 ` Jason Opperisano
  2005-03-11 13:06 ` John A. Sullivan III
  0 siblings, 2 replies; 21+ messages in thread
From: Dimitri Yioulos @ 2005-03-11 12:43 UTC (permalink / raw)
  To: netfilter

Hello, all.

 

I've recently set up iptables-1.2.8-12.3 on a CentOS 3.4 (RHEL AS 3) box.
Among other things, I've created a DMZ where my Web and mail servers live.
My problem is that my Web and mail servers identify themselves with the NAT
ip address that I've assigned   Here's my NAT rule:

 

 IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP

 

How can I get these two servers to identify themselves by their own ip
addresses and still provide NAT for my users?

 

Hope I've provided enough info., and my question isn't too lame.

 

Many thanks.

 

Dimitri


^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: NAT question
@ 2004-06-30 13:25 Kiran Kumar Immidi
  2004-06-30 14:21 ` Henrik Nordstrom
  0 siblings, 1 reply; 21+ messages in thread
From: Kiran Kumar Immidi @ 2004-06-30 13:25 UTC (permalink / raw)
  To: Kiran Kumar Immidi, netfilter-devel, Henrik Nordstrom

[-- Attachment #1: Type: text/html, Size: 1407 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread
* NAT question
@ 2004-06-30 11:36 Kiran Kumar Immidi
  2004-06-30 11:55 ` Henrik Nordstrom
  2004-06-30 12:26 ` Vijaya Chandra Vupputuri
  0 siblings, 2 replies; 21+ messages in thread
From: Kiran Kumar Immidi @ 2004-06-30 11:36 UTC (permalink / raw)
  To: netfilter-devel

Hi,
  When packets are being masqueraded from multiple machines through a NAT box,
how would the response be identified as part of a particular connection. So, if
we have (identical, as regards port numbers and dest ip address) packets from A
and B snatted at C, how is the reply (to C) identified as belonging to either A
or B? There does not seem to be any information in the packet to distinguish it.
Regards,
Kiran Kumar Immidi

---- Cool Things Happen When Mac Users Meet! Join the community in Boston this July: www.macworldexpo.com

^ permalink raw reply	[flat|nested] 21+ messages in thread
* NAT question
@ 2003-07-19 15:09 Ray Blair
  0 siblings, 0 replies; 21+ messages in thread
From: Ray Blair @ 2003-07-19 15:09 UTC (permalink / raw)
  To: netfilter, Ray Blair

I am trying to set up my NAT box to permit CORBA traffic.  I am running 
the demo programs provided by jacorb 1.4.1

If I have the server on the unprotected network and the client inside, 
the programs works fine. When I swap roles, I can't get the outside 
client to connect to the server on the protected network.

The inside address 192.168.10.X is translated to an unused address on 
the external network.  We are using the jacorb property "proxy host" to 
inform the external client to use the translated IP (1.1.1.1) to contact 
the server.  When the internal server tries to contact itself it uses 
the translated address (1.1.1.1) not the internal address and is not 
successful.

I can't seem to configure the NAT box to redirect the traffic from the 
inside IP that is destined for the translated address back to itself. 
Is there a kernel option that is preventing this from happening?  i 
think my rules are configured correctly.

thanks

ray






^ permalink raw reply	[flat|nested] 21+ messages in thread
* RE: NAT question
@ 2003-04-10 10:30 Philippe Dhont   (Sea-ro)
  0 siblings, 0 replies; 21+ messages in thread
From: Philippe Dhont   (Sea-ro) @ 2003-04-10 10:30 UTC (permalink / raw)
  To: netfilter

Hi,

1) Yesterday everything worked with the SNAT rule and today i moved the
firewall to it's new location, changed the ip-address and added some routes.
I test with a NT4 on the side of eth0 that pings to a location on the eth1
side.
now, sometimes i can see that it works, via tcpdump i see that the SNAT rule
works and when i then flush my tables and restart the firewall script, it's
not working anymore ?????
and then i can see via tcpdump that the firewall is just trying the
ip_forwarding ?????
So this means that the packet is not even coming to the SNAT rule ??? and
then sometimes it is, how is this possible ??

2) my ip_forwarding is enabled in the kernel but this should not be a
problem. yesterday everything worked on my test location.

3) do i need ip_forwarding for NATing ?

thnx for the help!

regards,

	--tronstr@xsomic--







Le mer 09/04/2003 à 11:51, Philippe Dhont (Sea-ro) a écrit :
> I added 
> $IPTABLES -t nat -A POSTROUTING -j SNAT --to-source 10.165.165.165 
> Now when i ping from 10.51.13.13 on eth0 side to 10.165.1.60 then i can
see
> via tcpdump that on eth1 the 10.165.1.60 is seeking the 10.165.165.165 
> "arp who-has 10.165.165.165 tell 10.165.1.60" is what i get.
> So i guess that this means that iptables changed the address ?

As far as I understand your configuration, eth0's side is NATed when
talking to eth1's side.

If so, yes, Netfilter as already changed the address. That's obvious.
Your echo request has crossed the box, and has been source NATed to
10.165.165.165. Then 10.165.1.60 receive it and tries to reply. It
replies to 10.165.165.165. Nothing special in there, everything's
normal.

But on eth1's side, nobody answers ARP requests for 10.165.165.165. So
you did not configured your firewall to answer them. That's the issue.

> So the firewall doesn't knows that it converted the ip number before and
> can't send a reply to the correct ip address where it originally came from

He knows about this. But it is not its job to answer ARP requests. It's
your job to configure it as such.

> How can i make this work so that if i ping to 10.165.1.60 that i can get a
> reply ?

	ip addr add 10.165.165.165 dev eth1

So your firewall answers ARP requests for 10.165.165.165.

> AND that the NAT thing did its work ?

It did it well.



^ permalink raw reply	[flat|nested] 21+ messages in thread
* NAT question
@ 2003-04-09  9:51 Philippe Dhont   (Sea-ro)
  2003-04-09 10:27 ` Cedric Blancher
  0 siblings, 1 reply; 21+ messages in thread
From: Philippe Dhont   (Sea-ro) @ 2003-04-09  9:51 UTC (permalink / raw)
  To: netfilter

I added 
$IPTABLES -t nat -A POSTROUTING -j SNAT --to-source 10.165.165.165 

Now when i ping from 10.51.13.13 on eth0 side to 10.165.1.60 then i can see
via tcpdump that on eth1 the 10.165.1.60 is seeking the 10.165.165.165 
"arp who-has 10.165.165.165 tell 10.165.1.60" is what i get.
So i guess that this means that iptables changed the address ?
So the firewall doesn't knows that it converted the ip number before and
can't send a reply to the correct ip address where it originally came from

How can i make this work so that if i ping to 10.165.1.60 that i can get a
reply ?
AND that the NAT thing did its work ?
And no, i can't use ipforwarding because of a security issue.

Regards,


	--tronstr@xsomic--




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

end of thread, other threads:[~2012-01-25 17:30 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-30 13:28 NAT question Kiran Kumar Immidi
2004-06-30 14:02 ` Vijaya Chandra Vupputuri
  -- strict thread matches above, loose matches on Subject: below --
2012-01-25 16:16 Stephen Clark
2012-01-25 17:30 ` Jan Engelhardt
2005-03-11 15:15 Justin Piszcz
2005-03-11 12:43 Dimitri Yioulos
2005-03-11 12:50 ` Jason Opperisano
2005-03-11 13:56   ` Dimitri Yioulos
2005-03-11 15:13     ` Jason Opperisano
2005-03-11 15:41       ` Dimitri Yioulos
2005-03-11 15:46         ` Jason Opperisano
2005-03-11 13:06 ` John A. Sullivan III
2004-06-30 13:25 Kiran Kumar Immidi
2004-06-30 14:21 ` Henrik Nordstrom
2004-06-30 11:36 Kiran Kumar Immidi
2004-06-30 11:55 ` Henrik Nordstrom
2004-06-30 12:26 ` Vijaya Chandra Vupputuri
2003-07-19 15:09 Ray Blair
2003-04-10 10:30 Philippe Dhont   (Sea-ro)
2003-04-09  9:51 Philippe Dhont   (Sea-ro)
2003-04-09 10:27 ` Cedric Blancher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.