From: Peter Rabbitson <rabbit@rabbit.us>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Re: multiple routing tables for internal router programs
Date: Tue, 12 Jun 2007 09:01:45 +0000 [thread overview]
Message-ID: <466E60F9.4080606@rabbit.us> (raw)
In-Reply-To: <Pine.LNX.4.64.0706111505070.3751@tigger.tntechs.com>
Andrea wrote:
> This is the exact way that I used for managing traffic of my lan towards
> ISPs. But is this mode still valid if I want to manage services
> executed directly in the router?
>
> this rule:
>
> iptables -t mangle -A PREROUTING -p tcp --dport 80 -j MARK --set-mark 1
>
> capture all (web) traffic that crosses my router. Can I capture only the
> (web) traffic generated from my router and directed to internet?
>
> Anymore, I don't need it more: I've resolved my problem, the conflict
> between a "ping script" (that I'm writing for multiple gateway
> testing)and servers executed in router too: first version of my script
> sets a default gateway for testing it with ping, now I've discovered
> that I can use a specific route involving the gateway without setting
> default gateway, a much better solution.
>
It can and can not be done at the same time, depends on what you are
doing. Normally for bound services you have this:
o Service is bound to a specific IP 1.2.3.4
o Its outgoing packet has SRC of 1.2.3.4
o You mark it in the OUTPUT chain based on that SRC
o The routing (which occurs after OUTPUT) acts on the MARK
Now what happens when there is no specific binding (you send from 0.0.0.0):
o Program requests a socket from the kernel, supplying only a DST
o The kernel consults the _default_ routing table (because it does not
know any better, there are no marks yet), and _assigns_ a SRC that seems
the closest to this particular DST
o Everything else happens as in the scenario above
So depending on what you are doing it might help you or it might drive
you insane. In your case it plays out nicely - you can request a
specific interface (what you would do with the ping script), and you are
guaranteed that packets are going this direction. But if you want to
_balance_ locally generated traffic - you can not do anything short of
NATing local connections (ugly), because the routing sort of happens
before netfilter had a chance to play.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
next prev parent reply other threads:[~2007-06-12 9:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-11 19:06 [LARTC] Re: multiple routing tables for internal router programs Tom Diehl
2007-06-11 19:23 ` Javier Charne
2007-06-12 7:59 ` Andrea
2007-06-12 8:09 ` Salim S I
2007-06-12 9:01 ` Peter Rabbitson [this message]
2007-06-12 9:15 ` Andrea
2007-06-12 9:29 ` Peter Rabbitson
2007-06-12 9:49 ` Salim S I
2007-06-12 10:02 ` Peter Rabbitson
2007-06-12 10:10 ` Andrea
2007-06-12 10:20 ` Salim S I
2007-06-12 11:23 ` Peter Rabbitson
2007-06-13 4:08 ` Salim S I
2007-06-14 3:50 ` Salim S I
2007-06-14 4:23 ` Alex Samad
2007-06-14 7:26 ` Peter Rabbitson
2007-06-14 10:34 ` Salim S I
2007-06-15 3:26 ` Salim S I
2007-06-15 6:00 ` Peter Rabbitson
2007-06-15 6:01 ` Peter Rabbitson
2007-06-15 6:21 ` Salim S I
2007-06-15 6:29 ` Peter Rabbitson
2007-06-15 9:36 ` Salim S I
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=466E60F9.4080606@rabbit.us \
--to=rabbit@rabbit.us \
--cc=lartc@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.