All of lore.kernel.org
 help / color / mirror / Atom feed
* SNAT
@ 2003-07-08  0:21 David Busby
  0 siblings, 0 replies; 29+ messages in thread
From: David Busby @ 2003-07-08  0:21 UTC (permalink / raw)
  To: netfilter

Dudes,
    I setup my SNAT like this:

iptables -t nat -I POSTROUTING 1 -s 10.0.0.0/24 -d 0/0 \
  -p tcp -m tcp --dport 80 \
  -j SNAT --to 1.2.3.66-1.2.3.126

So my lan outbound HTTP traffic gets shared over those 60 ip addresses.
Seems sweet, but I notice that netfilter doesn't always rotate the
addresses. And sometimes only switches a client between two addresses. Where
in the docs does it show me how to make this thing rotate addresses more
regularly, or if not in doc how would I do that?

David Busby
Systems Engineer
busby@pnts.com



^ permalink raw reply	[flat|nested] 29+ messages in thread
* SNAT
@ 2012-02-22  2:04 cc
  2012-02-22  7:47 ` SNAT SamLT
  0 siblings, 1 reply; 29+ messages in thread
From: cc @ 2012-02-22  2:04 UTC (permalink / raw)
  To: netfilter

Hi,

Long story short, I'm now rebuilding a netfilter firewall 
script as the original died with the firewall.  Well, died
in the sense that it got corrupted.

Instead of needing to specify the following for each required
port that needs to be used to connect to external sites,
how do I just let any traffic originating from the LAN
to connect?  (I'm feeling this isn't the right way of doing
things.  I appreciate any corrections.)

$IPT -t nat -A POSTROUTING -o $EXTETH -p tcp -s $LAN_NET \
           --dport 1025: -j SNAT --to-source $EXTIP

But the above rule 'looks' like it should work; but it
doesn't.  tcpdumping the traffic, it seems the traffic is
going one way and not the other.

So if I want to set the firewall to allow the following
situations: machine A in $LAN_NET  wants to RDP to an external
site,  it can.  If machine B wants to surf the net, it also
can.  I don't need to separately do the following:

  $IPT -A FORWARD -i $LANETH -o $EXTETH -p tcp -s $LAN_NET \
           --dport 3389 -j ACCEPT
  $IPT -A FORWARD -i $LANETH -o $EXTETH -p tcp -s $LAN_NET \
           --dport 80 -j ACCEPT
  $IPT -A FORWARD -i $LANETH -o $EXTETH -p tcp -s $LAN_NET \
           --dport 443 -j ACCEPT

  $IPT -t nat -A POSTROUTING -o $EXTETH -p tcp -s $LAN_NET \
          --dport 3389 -j SNAT --to-source $EXTIP
  $IPT -t nat -A POSTROUTING -o $EXTETH -p tcp -s $LAN_NET \
          --dport 80 -j SNAT --to-source $EXTIP
  $IPT -t nat -A POSTROUTING -o $EXTETH -p tcp -s $LAN_NET \
          --dport 443 -j SNAT --to-source $EXTIP



Now if I remembered, I used MASQUERADE when I was using 
a dynamic IP.  Now with a fixed IP, I shouldn't be using
MASQUERADE (seems less of a headache) as the manual says 
it's more appropriate to use SNAT for fixed IP.

Any help/clarifications/hints appreciated.

Ed

^ permalink raw reply	[flat|nested] 29+ messages in thread
* SNAT
@ 2007-10-09 18:47 Chad Eldridge
  2007-10-09 19:47 ` SNAT Grant Taylor
  0 siblings, 1 reply; 29+ messages in thread
From: Chad Eldridge @ 2007-10-09 18:47 UTC (permalink / raw)
  To: netfilter

I have a situation where I have packets coming into a server (we'll call 
it RTR) and getting routed to other servers depending on the ip address 
the packet is coming from. This part works great. The problem I am 
having is when the server (call it Responder) answers back to the 
original client (not going back through RTR), the client sees the 
traffic coming from an address it did not originally try to open a 
connection to and therefore rejects the packets and the connection is 
never established. I thought I could fix this by using SNAT to change 
the source ip on Responder.
iptables -t nat -A POSTROUTING -p tcp -m tcp --sport $PORT -j SNAT --to 
$RTR-IP
This however, seems to do nothing. The Responder still sends replies to 
the client, they make it to the client and show up as coming from the ip 
address of Responder.
It was suggested to me that I would need to turn off rp_filter (echo 0 > 
/proc/sys/net/ipv4/conf/all/rp_filter; echo 0 > 
/proc/sys/net/ipv4/conf/eth0/rp_filter) since the ip address I am trying 
to change the source to does not actually exist on the server. I tried 
that but it did not seem to help. Further more it was suggested that I 
could setup the $RTR-IP on a loopback and arptables it off and then it 
should work. This did not work either. If it is because iptables is 
trying to prevent spoofing I'm guessing it is stopping it because it's 
trying to send it out an interface that does not have the ip on it. Then 
again, all of this guessing could be wrong.
Is this even possible with iptables? If so, how can I accomplish it? 
Everything I have seen that seems like it should work has so far failed.
iptables v1.2.8
Redhat ES3
(Final box will probably be running ES4)

Thanks,

-- 
Chad Eldridge
Security | Web.com
celdridge@corp.web.com
404.260.2580


^ permalink raw reply	[flat|nested] 29+ messages in thread
* snat
@ 2005-05-02 15:32 Marco Berizzi
  2005-05-02 15:53 ` snat Jason Opperisano
  2005-05-02 16:07 ` snat Taylor, Grant
  0 siblings, 2 replies; 29+ messages in thread
From: Marco Berizzi @ 2005-05-02 15:32 UTC (permalink / raw)
  To: netfilter

Hello everybody.
I would like to better understand the SNAT target.
Man states:

"You can add several --to-source option. If you specify
more than one source address, either via an address range
or multiple --to-source options, a simple round-robin  (one
after another in cycle) takes place between these addresses.

I would like to know if this round-robin cycle is per packet
or per socket.

TIA



^ permalink raw reply	[flat|nested] 29+ messages in thread
* SNAT
@ 2004-07-09  3:57 Payal Rathod
  2004-07-09  4:58 ` SNAT John A. Sullivan III
  0 siblings, 1 reply; 29+ messages in thread
From: Payal Rathod @ 2004-07-09  3:57 UTC (permalink / raw)
  To: netfilter

Hi,
While reading man page of iptables I stumbled in MASQUERADE section,

| This  target  is only valid in the nat table, in the POSTROUTING chain.
|  It should only be used with dynamically assigned  IP  (dialup)  connec-
|  tions: if you have a static IP address, you should use the SNAT target.

Can someone explain please why this is not valid when I am using a
permanent conneciton terminating at say eth0 and also a small example
on how SNAT can be used in the place?

Thanks a lot in advance.
With warm regards,
Payal


^ permalink raw reply	[flat|nested] 29+ messages in thread
* SNAT
@ 2003-04-25 17:45 Andy Wood
  0 siblings, 0 replies; 29+ messages in thread
From: Andy Wood @ 2003-04-25 17:45 UTC (permalink / raw)
  To: netfilter

	There is no easy way to describe this, so I'll just start.

	I am running a Snort IDS/FW with 4 interfaces, but we'll just be
concerned with 2 (eth0 and eth2 + ipsec0).  Ipsec is functioning, so that is
not the problem.

Local subnet	10.10.41.0/24
Local GW		10.10.41.100

Remote Network:
Network		111.111.0.0/16
Eth0			111.111.3.160 (gw 111.111.3.129)
Eth2			111.111.3.163
Add. Route		route add 111.111.8.204 gw 111.111.3.129 dev eth2
(just cause I want to ensure it 			goes out eth2) and I
can ping that host; it does go out eth2

To ensure that there is no unintentional DROPping of packets there are only
3 rules:

iptables -A POSTROUTING -t nat -o ipsec0 -s 111.111.3.160 -d 10.10.41.0/24
-j SNAT --to 111.111.3.163
iptables -A POSTROUTING -t nat -o eth2 -s 10.10.41.0/24 -j SNAT --to
111.111.3.163
Iptables -A FORWARD -j ACCEPT

	Basically, I want to send a packet through the tunnel (ipsec0) and
out to system 111.111.8.204.  Because the packet will arrive as source
10.10.41.100, and I cannot control the route table of system 111.111.8.204,
I figured I would SNAT the packet from 10.10.41.100 to 111.111.3.163.  If I
do a tcpdump on ipsec0 I see the pachet coming in:

(Remote Side - Inbound) tcpdump -i ipsec0 -p -n -nn icmp
13:27:33.916290 10.10.41.100 > 111.111.8.204: icmp: echo request (DF)
13:27:34.919120 10.10.41.100 > 111.111.8.204: icmp: echo request (DF)
13:27:35.931122 10.10.41.100 > 111.111.8.204: icmp: echo request (DF)
13:27:36.923962 10.10.41.100 > 111.111.8.204: icmp: echo request (DF)

	However, (On the remote side) "tcpdump -i eth2 -p -n -nn icmp" or
"tcpdump -i eth0 -p -n -nn icmp" (just in case) do not show any packets
outbound (to 111.111.8.204).  I can't see anything wrong with my rules, but
sometimes I can't think outside the box.....any ideas?

Thanks,
Andy

	To verify the tunnel works:

[root@darkgate root]# ping 111.111.3.163

PING 111.111.3.163 (111.111.3.163) from 68.68.130.209 : 56(84) bytes of
data.
64 bytes from 111.111.3.163: icmp_seq=1 ttl=64 time=29.5 ms
64 bytes from 111.111.3.163: icmp_seq=2 ttl=64 time=31.7 ms
64 bytes from 111.111.3.163: icmp_seq=3 ttl=64 time=26.1 ms
64 bytes from 111.111.3.163: icmp_seq=4 ttl=64 time=26.7 ms



[root@testids root]# tcpdump -i ipsec0 -p -n -nn icmp

13:35:50.883841 10.10.41.100 > 111.111.3.163: icmp: echo request (DF)
13:35:50.884001 111.111.3.163 > 10.10.41.100: icmp: echo reply
13:35:51.832915 10.10.41.100 > 111.111.3.163: icmp: echo request (DF)
13:35:51.832976 111.111.3.163 > 10.10.41.100: icmp: echo reply
13:35:52.847691 10.10.41.100 > 111.111.3.163: icmp: echo request (DF)
13:35:52.847749 111.111.3.163 > 10.10.41.100: icmp: echo reply
13:35:53.859624 10.10.41.100 > 111.111.3.163: icmp: echo request (DF)
13:35:53.859684 111.111.3.163 > 10.10.41.100: icmp: echo reply



^ permalink raw reply	[flat|nested] 29+ messages in thread
* RE: SNAT
@ 2003-04-03 18:34 Daniel Chemko
  2003-04-06 10:52 ` SNAT Rio Martin.
  0 siblings, 1 reply; 29+ messages in thread
From: Daniel Chemko @ 2003-04-03 18:34 UTC (permalink / raw)
  To: Rio Martin., netfilter

1. You are using aliases, which IPTables does not use. Please use look
into IPRoute2 on the net on how to setup proper IPRoute2 bindings.

2. Add an SNAT rule on the postrouting -o <internet_iface> pointing to
64.1.1.2

-----Original Message-----
From: Rio Martin. [mailto:rio@martin.mu] 
Sent: Thursday, April 03, 2003 2:29 AM
To: netfilter@lists.netfilter.org
Subject: SNAT

Dear folks,
I need help to modify the source ip for every irc connection coming from
my
clients.

Eg:

eth0    = 64.1.1.1
eth0:1 = 64.1.1.2
eth0:2 = 192.168.1.1


My clients is in 192.168.1.0/24. Right now all connection to irc server
is
using ip 64.1.1.1
I want to modify, so all irc connection is using 64.1.1.2

Thanks for helping me ...

Regards,
Rio Martin.





^ permalink raw reply	[flat|nested] 29+ messages in thread
[parent not found: <20030403102302.5858.91445.Mailman@kashyyyk>]
* RE: SNAT
@ 2002-11-13 11:21 Rob Sterenborg
  2002-11-13 13:26 ` SNAT Breno Cardoso Perucchi
  0 siblings, 1 reply; 29+ messages in thread
From: Rob Sterenborg @ 2002-11-13 11:21 UTC (permalink / raw)
  To: Netfilter (E-mail)

> > > > iptables -t nat -I POSTROUTING -p udp -s 192.168.0.1 --sport 53 -j
> > > > SNAT --to-source 200.200.200.1:53

> > > I don't know if dns traffic is always sent *from* 53/udp, but I do
> > > know it is always sent *to* 53/udp.

> > Not *always* :-)   Sometimes it goes to 53/tcp...

> I think that the DNS traffic goes only on 53/tcp when transfering
> zones, and it uses the 53/udp for the queries.
>
> Also, if you use the BIND implementation of the DNS server, you
> can specify the source port, so the traffic can go from
> 53/udp to 53/udp

Of course you're right.
Anyway, I interpret the original question as how to SNAT normal dns traffic
because the rule he wrote was using the udp protocol for *source* port
53/udp, which doesn't have to match *all* dns traffic (if it does).
That's why I mentioned that I don't know if dns traffic always come *from*
port 53/udp (here it doesn't ; it uses some port above 1024), but I do know
it's going *to* port 53/udp.


Rob



^ permalink raw reply	[flat|nested] 29+ messages in thread
* MS Messenger
@ 2002-11-12 18:38 Aaron Clausen
  2002-11-12 19:53 ` SNAT Breno Cardoso Perucchi
  0 siblings, 1 reply; 29+ messages in thread
From: Aaron Clausen @ 2002-11-12 18:38 UTC (permalink / raw)
  To: netfilter

I'm running iptables, and have a user claiming that they cannot use MS
Messenger.  I have no other complaints, but I'm not exactly sure if any
other users are actually using MS Messenger?  Does there have to be special
connection tracking.

I'm also blocking the MS file sharing ports at the router.  Would this cause
the problem?

-- 
Aaron Clausen



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

end of thread, other threads:[~2012-02-22  7:47 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-08  0:21 SNAT David Busby
  -- strict thread matches above, loose matches on Subject: below --
2012-02-22  2:04 SNAT cc
2012-02-22  7:47 ` SNAT SamLT
2007-10-09 18:47 SNAT Chad Eldridge
2007-10-09 19:47 ` SNAT Grant Taylor
2005-05-02 15:32 snat Marco Berizzi
2005-05-02 15:53 ` snat Jason Opperisano
2005-05-03 13:58   ` snat Marco Berizzi
2005-05-02 16:07 ` snat Taylor, Grant
2005-05-02 16:14   ` snat Jason Opperisano
2005-05-02  2:52     ` snat Ken Hilliard
2005-05-02 18:04       ` snat Charlie Brady
2005-05-02 18:06       ` snat Jason Opperisano
2005-05-02  3:14         ` snat Ken Hilliard
2004-07-09  3:57 SNAT Payal Rathod
2004-07-09  4:58 ` SNAT John A. Sullivan III
2003-04-25 17:45 SNAT Andy Wood
2003-04-03 18:34 SNAT Daniel Chemko
2003-04-06 10:52 ` SNAT Rio Martin.
2003-04-06 21:49   ` SNAT Daniel Chemko
     [not found] <20030403102302.5858.91445.Mailman@kashyyyk>
2003-04-03 10:29 ` SNAT Rio Martin.
2002-11-13 11:21 SNAT Rob Sterenborg
2002-11-13 13:26 ` SNAT Breno Cardoso Perucchi
2002-11-13 13:48   ` SNAT Rob Sterenborg
2002-11-13 16:33   ` SNAT Luis Fernando Barrera
2002-11-12 18:38 MS Messenger Aaron Clausen
2002-11-12 19:53 ` SNAT Breno Cardoso Perucchi
2002-11-12 21:01   ` SNAT Rob Sterenborg
2002-11-12 21:29     ` SNAT Antony Stone
2002-11-12 21:47       ` SNAT Luis Fernando Barrera

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.