All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Huhardeaux <daniel.huhardeaux@tootai.com>
To: netfilter-devel@vger.kernel.org
Subject: Re: IP traffic rerouting
Date: Fri, 14 Aug 2009 12:57:38 +0200	[thread overview]
Message-ID: <4A854322.8050705@tootai.com> (raw)
In-Reply-To: <alpine.LSU.2.00.0908140126250.28623@fbirervta.pbzchgretzou.qr>

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

      reply	other threads:[~2009-08-14 10:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A854322.8050705@tootai.com \
    --to=daniel.huhardeaux@tootai.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.