From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: netfilter@lists.netfilter.org
Subject: Re: Routing Incoming and Outgoing Packets Differently
Date: Thu, 20 Jul 2006 20:34:49 +0200 [thread overview]
Message-ID: <44BFCCC9.2070806@plouf.fr.eu.org> (raw)
In-Reply-To: <44BF98B9.5020101@tavve.com>
Hello,
Jim Doble a écrit :
> Is there a way to use one set of routing rules for incoming packets and
> a different set of routing rules for outgoing packets?
Yes, with advanced routing.
Quote from ip manpage (http://lartc.org/manpages/ip.txt) :
ip rule add - insert a new rule
[...]
iif NAME
select the incoming device to match. If the inter-
face is loopback, the rule only matches packets
originating from this host. This means that you
may create separate routing tables for forwarded
and local packets and, hence, completely segregate
them.
[end of quote]
So you can create an alternate routing table for locally-generated
packets. Incoming packets will use the default "main" routing table.
ip rule add iif lo lookup <output_table_number> prio 32765
ip route add <destination1> gw <gateway> table <output_table_number>
ip route add <destination2> dev <interface> table <output_table_number>
...
You need to have the following options enabled in your kernel to use
this feature.
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
prev parent reply other threads:[~2006-07-20 18:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-20 14:52 Routing Incoming and Outgoing Packets Differently Jim Doble
2006-07-20 18:34 ` Pascal Hambourg [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=44BFCCC9.2070806@plouf.fr.eu.org \
--to=pascal.mail@plouf.fr.eu.org \
--cc=netfilter@lists.netfilter.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.