|
Focus on Linux
routing_based_on_port/services Oct 03 2005 09:41AM kucserak post sk (7 replies) Re: routing_based_on_port/services Oct 05 2005 09:43AM David Ballester - Kern Pharma (dballester kernpharma com) Re: routing_based_on_port/services Oct 04 2005 07:46PM Jose Luis Domingo Lopez (focus-linux 24x7linux com) |
|
Privacy Statement |
1) Use iptables to mark the outgoing traffic in the mangle PREROUTING chain:
iptables -t mangle -A PREROUTING -i eth0 -p tcp --dport 80 -j MARK --set-mark 1
2) Create routing table for the marked traffic, we will call the new table "http".
This table will contain default route to the ADSL provider.
echo 200 http >> /etc/iproute2/rt_tables
ip route add default via <adsl_ip> dev <adsl_dev> table http
3) Standard default route will point to the P2P provider.
ip route add default via <p2p_ip> dev <p2p_dev>
4) Add routing policy rule to use table "http" for marked traffic:
ip rule add fwmark 1 table http
This configuration is not perfect (e.g. port 80 on the router is not accessible)
but I hope it will help. More on multiple routing tables can be found at
http://lartc.org/howto/lartc.rpdb.html
Of course, you have to turn on appropriate options (e.g. "use fwmark as
a routing key") in your kernel config.
Regards,
Bendis
Dne po 3. Å?Ãjna 2005 11:41 kucserak (at) post (dot) sk [email concealed] napsal(a):
> Dear List!
>
> I just want to ask you a question.I have a linux(Secure platform) gateway
> server with 2 external ip address to the internet (one S/0 ADSl, second S/1
> Point to Point) and one internal ip eth0 for my LAN. I need to split up the
> outgoing traffic.HTTP/HTTPS want to route through the ADSL and the rest of
> traffic (SMTP,POP3,FTP) through the Point to Point.Can i solve this with
> Linux iptables or whatever else. Any suggestion help..
>
> regards,
>
> Chris
[ reply ]