Skip to contentSkip to conversation

Getting crazy with marking packets

LARTC Raúl Alexis Betancort Santana 2 participants 3 messages Feb 13, 2004 – Feb 18, 2004

lore
Share & tools
lore
#0 lore raw

Hi all .. I'm getting crazy triying to undestand why my packets are not going by the ISP I want them to .. :S

I mark smtp and pop3 packets on PREROUTING with -j MARK setting it mark to 0x02 .. then with ip rule add fwmark table mail.traffic its supposed they will only go out by ISP1, but they are going out by a random provier from my list of ones ... :(

Any hit please ? ... what are I'm doing wrong? .. I have read the archives and searched at google with no success ...

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 11 lines · Raúl Alexis Betancort Santana

Hi all .. I'm getting crazy triying to undestand why my packets are not going by the ISP I want them to .. :S

I mark smtp and pop3 packets on PREROUTING with -j MARK setting it mark to 0x02 .. then with ip rule add fwmark table mail.traffic its supposed they will only go out by ISP1, but they are going out by a random provier from my list of ones ... :(

Any hit please ? ... what are I'm doing wrong? .. I have read the archives and searched at google with no success ...

Perhaps you need to add a default route for mail.traffic? ip route add default via <addr-on-if-ISP1> dev <if-ISP1> table \
mail.traffic

If that's not the problem, then you'll probably need to show us the commands/script you're using.

-Corey
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#2 lore raw
In reply to Raúl Alexis Betancort Santana
Quoted 9 lines · Corey Hickey
Quoted 8 lines · Raúl Alexis Betancort Santana

Hi all .. I'm getting crazy triying to undestand why my packets are not going by the ISP I want them to .. :S

I mark smtp and pop3 packets on PREROUTING with -j MARK setting it mark to 0x02 .. then with ip rule add fwmark table mail.traffic its supposed they will only go out by ISP1, but they are going out by a random provier from my list of ones ... :(

Quoted 6 lines
Quoted 2 lines

Any hit please ? ... what are I'm doing wrong? .. I have read the archives and searched at google with no success ...

Perhaps you need to add a default route for mail.traffic? ip route add default via <addr-on-if-ISP1> dev <if-ISP1> table \
mail.traffic

The mail.traffic table has a multipath route with diferent weights, I want
traffic to go by ISP1, but if it gets down, go by ISP2, but it is going out by the ISP it get at random ..

ip route add table mail.traffic default nexthop via <GWofISP1> dev eth1 weight 1 nexthop via <GWofISP2> dev eth1 weight 200

ip rule add fwmark 0x02 table mail.traffic

iptables -A PREROUTING -t mangle -p tcp --dport 25 -j MARK --set-mark 0x02 iptables -A PREROUTING -t mangle -p tcp --dport 110 -j MARK --set-mark 0x02

Also I have other problem now .. on my multiroute (it is called that way) table for the rest of traffic (the reverse order with weigths as on the mail.traffic table), when GW1 gets down, traffic go out by GW2, thats ok .. but when GW1 get online again traffic continues going by GW2, I have tryed with "ip route flush cache", but it continues the same ... going out by GW2, no matter the weights they have, no matter that GW1 is online again. Any way to solve this ?

Best Regards
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/