Page 1 of 1

cobine two unequal lines

Posted: Mon Jun 28, 2010 12:51 pm
by namo
I have Mikrotik routerOS v4.10 with hotspot user accounts

I have one 10mbps ADSL and 3.2mbps 3G wireless internet(ethernet modem+router).

Is this code still OK for combining the two lines
/ip address
add address=192.168.1.60/24 disabled=no interface=outside1
add address=192.168.3.60/24 disabled=no interface=outside2
add address=192.168.2.1/24 disabled=no interface=hotspot

/ip firewall address-list
add address=192.168.2.0/24 disabled=no list=Local_NAT_Networks

/ip firewall mangle
add action=mark-connection chain=input connection-state=new disabled=no in-interface=outside1 new-connection-mark=outside1_connection passthrough=yes
add action=mark-connection chain=input connection-state=new disabled=no in-interface=outside2 new-connection-mark=outside2_connection passthrough=yes
add action=mark-routing chain=output connection-mark=outside1_connection disabled=no new-routing-mark=to_outside1 passthrough=yes
add action=mark-routing chain=output connection-mark=outside2_connection disabled=no new-routing-mark=to_outside2 passthrough=yes
add action=accept chain=prerouting disabled=no dst-address=192.168.1.0/24 src-address-list=Local_NAT_Networks
add action=accept chain=prerouting disabled=no dst-address=192.168.3.0/24 src-address-list=Local_NAT_Networks
add action=mark-connection chain=prerouting connection-state=new disabled=no dst-address-type=!local hotspot=auth new-connection-mark=outside1_connection passthrough=yes per-connection-classifier=src-address:2/0 src-address-list=Local_NAT_Networks
add action=mark-connection chain=prerouting connection-state=new disabled=no dst-address-type=!local hotspot=auth new-connection-mark=outside2_connection passthrough=yes per-connection-classifier=src-address:2/1 src-address-list=Local_NAT_Networks
add action=mark-routing chain=prerouting connection-mark=outside1_connection disabled=no new-routing-mark=to_outside1 passthrough=yes src-address-list=Local_NAT_Networks
add action=mark-routing chain=prerouting connection-mark=outside2_connection disabled=no new-routing-mark=to_outside2 passthrough=yes src-address-list=Local_NAT_Networks

/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.1.60 routing-mark=to_outside1 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.3.60 routing-mark=to_outside2 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=5 dst-address=0.0.0.0/0 gateway=192.168.1.60 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=10 dst-address=0.0.0.0/0 gateway=192.168.3.60 scope=30 target-scope=10

Re: cobine two unequal lines

Posted: Mon Jun 28, 2010 6:33 pm
by fewi
It'll work, but not optimally since the circuits have different bandwidth. You can make choosing the bigger bandwidth circuit more likely by adding more PCC lines but only assigning the same two marks. As the circuits are roughly 3:1 for bandwidth, you could use
add action=mark-connection chain=prerouting connection-state=new disabled=no dst-address-type=!local hotspot=auth new-connection-mark=outside1_connection passthrough=yes per-connection-classifier=src-address:4/0 src-address-list=Local_NAT_Networks
add action=mark-connection chain=prerouting connection-state=new disabled=no dst-address-type=!local hotspot=auth new-connection-mark=outside2_connection passthrough=yes per-connection-classifier=src-address:4/1 src-address-list=Local_NAT_Networks
add action=mark-connection chain=prerouting connection-state=new disabled=no dst-address-type=!local hotspot=auth new-connection-mark=outside2_connection passthrough=yes per-connection-classifier=src-address:4/2 src-address-list=Local_NAT_Networks
add action=mark-connection chain=prerouting connection-state=new disabled=no dst-address-type=!local hotspot=auth new-connection-mark=outside2_connection passthrough=yes per-connection-classifier=src-address:4/3 src-address-list=Local_NAT_Networks
instead of
add action=mark-connection chain=prerouting connection-state=new disabled=no dst-address-type=!local hotspot=auth new-connection-mark=outside1_connection passthrough=yes per-connection-classifier=src-address:2/0 src-address-list=Local_NAT_Networks
add action=mark-connection chain=prerouting connection-state=new disabled=no dst-address-type=!local hotspot=auth new-connection-mark=outside2_connection passthrough=yes per-connection-classifier=src-address:2/1 src-address-list=Local_NAT_Networks
That's assuming outside2_connection is for the 10 meg circuit. That way, 3 out of 4 times a connection will be put on the 10 meg circuit, and only 1 out of 4 times will it be put on the 3 meg circuit.

Re: cobine two unequal lines

Posted: Mon Jun 28, 2010 7:20 pm
by namo
thank you fewi. But what will happen to the speed if one of the internet connection drop out?

Re: cobine two unequal lines

Posted: Mon Jun 28, 2010 7:21 pm
by fewi
Sorry, I don't understand the question.

Re: cobine two unequal lines

Posted: Mon Jun 28, 2010 7:23 pm
by namo
Sorry, I don't understand the question.
what will happen to the speed if one of the internet connection drop out?

If there is no ADSL today, will I get 3.2mbps? Or, if there is no 3G, will I get 10mbps?

Re: cobine two unequal lines

Posted: Mon Jun 28, 2010 7:24 pm
by fewi
Yes, because the route for those routing marks will be unavailable, so packets will drop through to the default routes and saturate whichever interface is still up.

Re: cobine two unequal lines

Posted: Mon Jun 28, 2010 7:40 pm
by namo
Yes, because the route for those routing marks will be unavailable, so packets will drop through to the default routes and saturate whichever interface is still up.
in the line :
add check-gateway=ping disabled=no distance=5 dst-address=0.0.0.0/0 gateway=192.168.1.60 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=10 dst-address=0.0.0.0/0 gateway=192.168.3.60 scope=30 target-scope=10
1-why the distance is 5 for one and 10 for the other? should distance 5 be for 10mbps or 3.2mbps?

2-you said that to devide 3:1 so by this will i get minmum of (10/3,3.2) * 4 = 12.8mbps instead of 10+3.2=13.2 mbps?

Re: cobine two unequal lines

Posted: Mon Jun 28, 2010 7:56 pm
by fewi
The higher the distance, the less desirable the route is. If both routes are up the route with distance 5 will be chosen as the default route. It would make more sense to have the 10 meg circuit have the shorter distance.

PCC doesn't allow you to exactly balance bandwidth like that. It's not a matter of mbps, it's a matter of connections. Any connection could be taking any bandwidth. It might be a bittorrent connection downloading as fast as the peer will let it, or a telnet connection to a router slowly transmitting keystrokes. But in your original configuration any given connection had a 50/50 chance of ending up on either circuit. By skewing the odds in favor of the 10 meg circuit you'll make that circuit more likely to be chosen, which makes sense given that it has more bandwidth available. The more connections go through the router, the more traffic will be balanced approaching 3:1.

Re: cobine two unequal lines

Posted: Mon Jun 28, 2010 8:01 pm
by namo
I forget about the upload.

if ADSL has 10mbps download and 512kbps upload
and 3G has 3.2mbps download and 256kbps upload,

should I use balance 3:1 or 2:1?

Re: cobine two unequal lines

Posted: Thu Dec 09, 2010 3:36 pm
by namo
I tried the code but I couldn't combine the speed. I draw the internet from one line and it drop continuously. It was better with one line.

I have intel PC as my Mikrotik router with hotspot. I also have Routerboard 450 which I am not using. Is it good idea to use router board to only combine the two line without hotspot setting and use the intel PC for hotspot.

if this is good, what is a good code to make the routerboard combine two unequal lines only (no hotspot)?