Community discussions

MikroTik App
 
forne
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 65
Joined: Tue Feb 15, 2011 3:18 pm

Load balancing after routing table lookup

Wed Feb 16, 2011 2:54 pm

I'm trying to set up load balancing over two ISPs, but only for those outgoing packets, for which there is no route in a routing table. I can't find how to apply PCC load balancing after routing table lookup was failed. Any suggestions would be appreciated.
 
User avatar
greencomputing
Frequent Visitor
Frequent Visitor
Posts: 95
Joined: Wed Jun 23, 2010 1:12 pm
Location: Italy

Re: Load balancing after routing table lookup

Fri Feb 18, 2011 1:46 am

Hi there

the idea is to use a mangle rule where you apply PCC to dst address NOT included in an ip address list containing the destination for which you had already defined a preferred rpute in the routing table.

Example :

if you have already the route for destination 192.168.1.0/24 well, add a new item in the

/ip firewall address-list add address=192.168.1.0/24 comment="already routed " disabled=no list=routed-destinations

and then you will use a mangle rule like this :
add action=mark-connection chain=prerouting comment="" connection-state=new disabled=no in-interface=ether1 new-connection-mark=ISP_1 passthrough=yes per-connection-classifier=\
dst-address:2/0 src-address-type=!local dst-address-list=!routed-destinations

and so on


where you get the goal to not use the PCC balancing with the condition dst-address-list=!routed-destinations


greencomputing
If answer was helpful to you why to not plan to... give me karma :)
greencomputing

--------------------
MTCNA / MTCRE certified Senior Mikrotik Consultant
 
forne
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 65
Joined: Tue Feb 15, 2011 3:18 pm

Re: Load balancing after routing table lookup

Sat Feb 19, 2011 2:28 pm

greencomputing, thank you for input. I achieved the same behaviour in a slightly different way. I apply PCC mangle rules to all packets before routing decision stage and then use custom route rules:
/ip firewall mangle
add action=mark-routing chain=prerouting disabled=no \
    in-interface=ether-local new-routing-mark=inet1 passthrough=no per-connection-classifier=\
    both-addresses:2/0
add action=mark-routing chain=prerouting disabled=no in-interface=ether-local \
    new-routing-mark=inet2 passthrough=no per-connection-classifier=both-addresses:2/1

/ip route rule
add action=lookup disabled=no table=main
add action=lookup-only-in-table disabled=no routing-mark=inet2 table=inet2
add action=lookup-only-in-table disabled=no table=inet1
If there is a route for some dst-address in the main routing table, the address will be resolved there and routing-marks will not be taken into account. Otherwise the address will be resolved in the routing table inet1 or inet2 according to its routing-mark.

Who is online

Users browsing this forum: serhan, sindy, tashbee and 105 guests