Splitting traffic
david@dark.x.dtu.dk
david@dark.x.dtu.dk
Mon, 21 Jan 2002 17:12:11 +0100
On Fri, Jan 18, 2002 at 08:46:39AM +0700, Oki DZ wrote:
> Hi,
>
> I'd like to split my outgoing traffic (to the Net) depending on the
> protocols (http and the rest) via two devices (eth1 and ppp0). What kind
> of tools should I use?
First off you have to use NAT on at least one of the interfaces, to get
the returning packets go back through the right interface. And then you
can mark all the http packets in the mangle table, with something like
this:
iptables -t mangle -A PREROUTING -p TCP --dport=http -j MARK --set-mark 1
And then you can make a iproute rule to route differently based on that
mark.
ip rule add table 1 priority 2 fwmark 1
And then remember to create a route table named 1, with a different
default route.
ip route add table 1 default via <http device ip> dev <http device>
- David Darville