All of lore.kernel.org
 help / color / mirror / Atom feed
* Redirecting incoming packets to other port
@ 2006-10-11  8:09 Holger Kinkelin
  2006-10-11  8:48 ` Brent Clark
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Holger Kinkelin @ 2006-10-11  8:09 UTC (permalink / raw)
  To: netfilter

Hello everybody

how can I redirect packets sent to my computer to another port?

I tried: iptables -A PREROUTING -t nat -p udp --dport 5060 --sport
5060 -j DNAT --to-destination 192.168.0.21:5063

This rule is accepted but doesn't do anything. There are no other
rules that could cause side effects.

Regards,
Holger


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

* Re: Redirecting incoming packets to other port
  2006-10-11  8:09 Redirecting incoming packets to other port Holger Kinkelin
@ 2006-10-11  8:48 ` Brent Clark
  2006-10-11  9:44   ` Holger Kinkelin
  2006-10-11 10:04 ` Cedric Blancher
  2006-10-11 13:41 ` Mohammad Farooq
  2 siblings, 1 reply; 7+ messages in thread
From: Brent Clark @ 2006-10-11  8:48 UTC (permalink / raw)
  To: netfilter

Holger Kinkelin wrote:
> Hello everybody
> 
> how can I redirect packets sent to my computer to another port?
> 
> I tried: iptables -A PREROUTING -t nat -p udp --dport 5060 --sport
> 5060 -j DNAT --to-destination 192.168.0.21:5063
> 
> This rule is accepted but doesn't do anything. There are no other
> rules that could cause side effects.
> 
> Regards,
> Holger


http://www.linuxtopia.org/Linux_Firewall_iptables/x4508.html

HTH

Kind Regards
Brent Clark


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

* Re: Redirecting incoming packets to other port
  2006-10-11  8:48 ` Brent Clark
@ 2006-10-11  9:44   ` Holger Kinkelin
  2006-10-11 10:08     ` Brent Clark
  0 siblings, 1 reply; 7+ messages in thread
From: Holger Kinkelin @ 2006-10-11  9:44 UTC (permalink / raw)
  To: Brent Clark; +Cc: netfilter

Hello,
no this doesn't seem to work.

I can REDIRECT packets sent BY my computer, not packets sent TO it. Is
there maybe another posibility?

Regards,
Holger

PS: Thanks to Brent for his reply

2006/10/11, Brent Clark <bclark@eccotours.co.za>:
> Holger Kinkelin wrote:
> > Hello everybody
> >
> > how can I redirect packets sent to my computer to another port?
> >
> > I tried: iptables -A PREROUTING -t nat -p udp --dport 5060 --sport
> > 5060 -j DNAT --to-destination 192.168.0.21:5063
> >
> > This rule is accepted but doesn't do anything. There are no other
> > rules that could cause side effects.
> >
> > Regards,
> > Holger
>
>
> http://www.linuxtopia.org/Linux_Firewall_iptables/x4508.html
>
> HTH
>
> Kind Regards
> Brent Clark
>
>


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

* Re: Redirecting incoming packets to other port
  2006-10-11  8:09 Redirecting incoming packets to other port Holger Kinkelin
  2006-10-11  8:48 ` Brent Clark
@ 2006-10-11 10:04 ` Cedric Blancher
  2006-10-11 13:41 ` Mohammad Farooq
  2 siblings, 0 replies; 7+ messages in thread
From: Cedric Blancher @ 2006-10-11 10:04 UTC (permalink / raw)
  To: Holger Kinkelin; +Cc: netfilter

Le mercredi 11 octobre 2006 à 10:09 +0200, Holger Kinkelin a écrit :
> I tried: iptables -A PREROUTING -t nat -p udp --dport 5060 --sport
> 5060 -j DNAT --to-destination 192.168.0.21:5063
> This rule is accepted but doesn't do anything. There are no other
> rules that could cause side effects.

Is your filtering ruleset consistent with this ? I.e. are theses packets
allowed by a FORWARD or INPUT rule ? If you want to redirect traffic to
your host, you can give a try to REDIRECT target.


-- 
http://sid.rstack.org/
PGP KeyID: 157E98EE FingerPrint: FA62226DA9E72FA8AECAA240008B480E157E98EE
>> Hi! I'm your friendly neighbourhood signature virus.
>> Copy me to your signature file and help me spread!


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

* Re: Redirecting incoming packets to other port
  2006-10-11  9:44   ` Holger Kinkelin
@ 2006-10-11 10:08     ` Brent Clark
  2006-10-12  6:47       ` Holger Kinkelin
  0 siblings, 1 reply; 7+ messages in thread
From: Brent Clark @ 2006-10-11 10:08 UTC (permalink / raw)
  To: netfilter

Holger Kinkelin wrote:
> Hello,
> no this doesn't seem to work.
> 
> I can REDIRECT packets sent BY my computer, not packets sent TO it. Is
> there maybe another posibility?
> 
> Regards,
> Holger
> 
> PS: Thanks to Brent for his reply

Hi

Only a pleasure.

Lets take a working example.
When you want to create a Transparent Proxy. Traffic gets sent to port 80, to the site in question.

You, on your firewall /router redirect to port 3128, or what ever you choose to have squid to run on.

So are you sure you have your service running on port 5053 as opposed to 5060.

Is this really for SIP.

Brent

P.s. You may want to share your ruleset.


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

* Re: Redirecting incoming packets to other port
  2006-10-11  8:09 Redirecting incoming packets to other port Holger Kinkelin
  2006-10-11  8:48 ` Brent Clark
  2006-10-11 10:04 ` Cedric Blancher
@ 2006-10-11 13:41 ` Mohammad Farooq
  2 siblings, 0 replies; 7+ messages in thread
From: Mohammad Farooq @ 2006-10-11 13:41 UTC (permalink / raw)
  To: Holger Kinkelin; +Cc: netfilter

On Wed, 2006-10-11 at 10:09 +0200, Holger Kinkelin wrote:
> Hello everybody
> 
> how can I redirect packets sent to my computer to another port?
> 
> I tried: iptables -A PREROUTING -t nat -p udp --dport 5060 --sport
> 5060 -j DNAT --to-destination 192.168.0.21:5063
> 
> This rule is accepted but doesn't do anything. There are no other
> rules that could cause side effects.
> 
> Regards,
> Holger
> 
> 
Make sure forwarding is turn on on your box. Execute the following
command:
echo 1 > /proc/sys/net/ipv4/ip_forward

MF



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

* Re: Redirecting incoming packets to other port
  2006-10-11 10:08     ` Brent Clark
@ 2006-10-12  6:47       ` Holger Kinkelin
  0 siblings, 0 replies; 7+ messages in thread
From: Holger Kinkelin @ 2006-10-12  6:47 UTC (permalink / raw)
  To: Brent Clark; +Cc: netfilter

Hi Brent, hi others

> Is this really for SIP.
Yes, it's definately for SIP. I try to create some sort of transparent
sip proxy that I will use later for monitoring packets for a project /
for my thesis.

The thing I want to do is the following

1. redirect traffic from the client to my proxy
--> iptables -A OUTPUT -t nat -p udp --dport 5060 --sport 5060 -j
REDIRECT --to-ports 5061
The proxy waits on 5061 for this traffic, the packets do arrive. Step
1 is working.

2. Now the proxy collects some info from the packets and sends them
(unchanged) out on 5062 to the server. I need a second rule that
changes the source port from 5062 back to 5060 that the SIP server
doesn't notice the proxy
--> iptables -A POSTROUTING -t nat -p udp --dport 5060 --sport 5062 -j
SNAT --to-source 192.168.0.21:5060
192.168.0.21 is the IP of the PC where the client and proxy are
running on. That's working, too. The packets get sent to the server
using the correct ports, the server accepts the packets and replies
correctly. BUT NOW I think the problem occurs! When the reply from the
server arrives on the proxy computer, a "ICMP destination port
unreachable" is sent back to the server. Why? I don't get this.

Has anybody an idea how to fix this problem or how to do the whole
proxy differently?

Regards,
Holger


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

end of thread, other threads:[~2006-10-12  6:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-11  8:09 Redirecting incoming packets to other port Holger Kinkelin
2006-10-11  8:48 ` Brent Clark
2006-10-11  9:44   ` Holger Kinkelin
2006-10-11 10:08     ` Brent Clark
2006-10-12  6:47       ` Holger Kinkelin
2006-10-11 10:04 ` Cedric Blancher
2006-10-11 13:41 ` Mohammad Farooq

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.