All of lore.kernel.org
 help / color / mirror / Atom feed
* IP traffic rerouting
@ 2009-08-13 22:44 Daniel Huhardeaux
  2009-08-13 23:37 ` Jan Engelhardt
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Huhardeaux @ 2009-08-13 22:44 UTC (permalink / raw)
  To: netfilter-devel

Hi,

is there a solution to reroute all traffic (icmp, udp, tcp, ...) from
one IP address to another one?

I know xinetd can do this but that's only for tcp and for a specific
port. I'm looking for a global solution -if any-

Regards

-- 
Daniel Huhardeaux       _____ ____ ____ _____ _____ _
enum   +33 368 460 088 (_  __) _  ) _  (_  __) _  _(_)  +48 222 472 472
iaxtel  1-700-849-6983  / / / // / // / / / / /_/ / /  GIZMO,SKYPE,GTALK
sip/iax:callto 101@sip./_/ ( ___( ___/ /_/ (_/ (_/_/.net   tootaiNET



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

* Re: IP traffic rerouting
  2009-08-13 22:44 IP traffic rerouting Daniel Huhardeaux
@ 2009-08-13 23:37 ` Jan Engelhardt
  2009-08-14 10:57   ` Daniel Huhardeaux
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Engelhardt @ 2009-08-13 23:37 UTC (permalink / raw)
  To: Daniel Huhardeaux; +Cc: netfilter-devel


On Friday 2009-08-14 00:44, Daniel Huhardeaux wrote:
>
> is there a solution to reroute all traffic (icmp, udp, tcp, ...) from
> one IP address to another one?


Routing tables are controlled with iproute2. Replace the variables by 
something appropriate. The freely choosable $number usually wants to be  
>= 1 to avoid surprises.

ip rule add from $srcaddr table $number prio $prio
ip route add default via $toaddr table $number

(The main routing table has number 254, and is usually at the lowest 
prio of 32767. The "prio $prio" part is thus usually optional in 
practice.)

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

* Re: IP traffic rerouting
  2009-08-13 23:37 ` Jan Engelhardt
@ 2009-08-14 10:57   ` Daniel Huhardeaux
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Huhardeaux @ 2009-08-14 10:57 UTC (permalink / raw)
  To: netfilter-devel

Jan Engelhardt a écrit :
> On Friday 2009-08-14 00:44, Daniel Huhardeaux wrote:
>   
>> is there a solution to reroute all traffic (icmp, udp, tcp, ...) from
>> one IP address to another one?
>>     
>
>
> Routing tables are controlled with iproute2. Replace the variables by 
> something appropriate. The freely choosable $number usually wants to be  
>   
>> = 1 to avoid surprises.
>>     
>
> ip rule add from $srcaddr table $number prio $prio
> ip route add default via $toaddr table $number
>
> (The main routing table has number 254, and is usually at the lowest 
> prio of 32767. The "prio $prio" part is thus usually optional in 
> practice.)
>   
Thanks for your answer Jan.

This means that if I want to redirect all traffic to an IP to another 
one, and changing the sorce address as if packet came from the IP from 
redirected machine I would have to create:

ip rule add to $iptoredirect table $number prio $prio
ip route add default via $toaddr src $iptoredirect table $number

Without changing the source address it would be:

ip rule add to $iptoredirect table $number prio $prio
ip route add default via $toaddr table $number

Would be the NAT option not a possibility? Something like

ip route add nat $iptoredirect via $toaddr

Regards

-- 
Daniel Huhardeaux       _____ ____ ____ _____ _____ _
enum   +33 368 460 088 (_  __) _  ) _  (_  __) _  _(_)  +48 222 472 472
iaxtel  1-700-849-6983  / / / // / // / / / / /_/ / /  GIZMO,SKYPE,GTALK
sip/iax:callto 101@sip./_/ ( ___( ___/ /_/ (_/ (_/_/.net   tootaiNET

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-08-14 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-13 22:44 IP traffic rerouting Daniel Huhardeaux
2009-08-13 23:37 ` Jan Engelhardt
2009-08-14 10:57   ` Daniel Huhardeaux

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.