Community discussions

MikroTik App
 
Stalker
just joined
Topic Author
Posts: 10
Joined: Tue Feb 15, 2011 11:37 am
Contact:

2 internet connections with different types

Wed May 30, 2012 5:37 pm

Hello, I have Mikrotik router (RB750), and 2 internet connections, I want to make router to balance load, or, if it's hard - simply switch WAN from first to second automatically (second one is very slow, but quite stable).

The first connection is PPPoE connection, and there can be many types of failure: no link, can't authorize, problem after PPPoE server. If there's one of the problems router should switch automatically to second connection, which is simple ADSL modem with own DHCP server, which is simply connected to routerboard.

I understand, that it's possible to configure, but i don't know the right way, or right keywords to google for..
 
User avatar
cbrown
Trainer
Trainer
Posts: 1842
Joined: Thu Oct 14, 2010 8:57 pm
Contact:

Re: 2 internet connections with different types

Wed May 30, 2012 8:13 pm

C.Brown

cbrown[at]cbrown.co
Telegram: @chris4brown
MTCNA - MTCRE - MTCWE - MTCTCE
MTCSE - TRAINER-0179
 
Stalker
just joined
Topic Author
Posts: 10
Joined: Tue Feb 15, 2011 11:37 am
Contact:

Re: 2 internet connections with different types

Thu May 31, 2012 3:16 pm

Thanks in advice, used solution "2 gateways failover", it fits better then PCC. Works good.
 
dbld
just joined
Posts: 10
Joined: Tue Dec 18, 2012 1:30 pm

Re: 2 internet connections with different types

Tue Dec 18, 2012 1:51 pm

Hi cbrown

I have following setup :

RB751G this connects via one Ethernet port to physical network on which two internet connections are available
1) ADSL modem [Here I use PPPOE on MT RB to establish connection/interface]
2) Static IP router [For this I simply have static route defined]

Simple fail over [your second link below] appears to work fine. Albeit I can not set check ping on the PPPOE Interface RB seems to know how to handle that part well.

So question is now if I wanted to actually load balance across those two one would use something like PCC to mark and route ...

What I'm not clear on is following, is the physical separation of the two connections necessary for PCC to be configured and work correctly?

 
User avatar
cbrown
Trainer
Trainer
Posts: 1842
Joined: Thu Oct 14, 2010 8:57 pm
Contact:

Re: 2 internet connections with different types

Wed Dec 19, 2012 3:07 pm

What I'm not clear on is following, is the physical separation of the two connections necessary for PCC to be configured and work correctly?
I'm not sure I understand what you are asking.
C.Brown

cbrown[at]cbrown.co
Telegram: @chris4brown
MTCNA - MTCRE - MTCWE - MTCTCE
MTCSE - TRAINER-0179
 
Robotics909
just joined
Posts: 18
Joined: Wed Oct 31, 2012 5:14 pm

Re: 2 internet connections with different types

Wed Dec 19, 2012 4:34 pm

/ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
add address=192.168.1.2/24 network=192.168.1.0 broadcast=192.168.1.255 interface=WAN1
add address=192.168.2.2/24 network=192.168.2.0 broadcast=192.168.2.255 interface=WAN2
/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=221.132.112.8,8.8.8.8
/ip firewall mangle
add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn
add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2
add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=Local
add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
add chain=prerouting connection-mark=WAN1_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN1
add chain=prerouting connection-mark=WAN2_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN2

/ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_WAN1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN2 check-gateway=ping

add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping
/ip firewall nat
add chain=srcnat out-interface=WAN1 action=masquerade
add chain=srcnat out-interface=WAN2 action=masquerade

All Done ! Now Test the link by putting user load, the more multiple users load you put on it, the better Load Balance result you will get
PCC WITH UN-EQUAL WAN LINKS

If you have Un-Equal WAN Links, for example WAN,1 is of 4MB and WAN,2 is of 8 Mb, and you want to force MT to use WAN42link more then other because of its capacity, Then you have to Add more PCC rules assigning the same two marks to a specific link i.e WAN2 , something like
Code:

add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
PCC WITH HOTSPOT (Reference)
/ip firewall nat add action=accept chain=pre-hotspot disabled=no dst-address-type=!local hotspot=auth

Who is online

Users browsing this forum: anav and 23 guests