Community discussions

MikroTik App
 
MoherPower
just joined
Topic Author
Posts: 2
Joined: Sat Mar 16, 2024 8:52 pm

How to exchange internet connection between 2 oficces.

Sat Mar 16, 2024 10:26 pm

Hi

I have real scenario that i can't force to work. Our company have 2 seperate oficces each with it's own internet access ISP-A and ISP-B. Oficces are connected with each other our own fiber cable. we want to configure mikrotik routers in both oficces that way that if ISP-A fails than all trafic will be passed through our fiber cable to second office and use ISP-B. and if ISP-B fails all trafic will be passed also through fiber and use ISP-A. we don't know how to do that becouse in first scenario side B of our fiber is gateway and side A is "client" and in second scenario side A is gateway and side B is client. we can set it manualy in the event of one ISP fails but we cant make it automatic failback. Can any one help in this config?
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19405
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: How to exchange internet connection between 2 oficces.

Sun Mar 17, 2024 2:03 am

Good question.
Trying to think conceptually.
Assuming you have one common cable over which to do this work, I would probably use two different VLANS.
At each Router, one of the vlans would be an incoming WAN connection from the other Router. Via a private subnet. on ETHERPORT XY.
At each Router the other vlan would be a LAN subnet providing DHCP service to the other router.

Something like, simplisitic, probably much more elegant ways. Create two private networks running over the common cable, and their only function is to act as a static private WANIP for the other router.
R1
/interface bridge
name=BR-WAN-LAN
/interface vlan
add name=vlan11 interface=BR-WAN-LAN vlanid=11
add name=vlan22 interface=BR-WAN-LAN vlanid=22 comment="backup wan"
/interface bridge port
add bridge=BR-WAN-LAN interface=port XY
/interface bridge vlan
add bridge=BR-WAN-LAN tagged=BR-WAN-LAN,etheportXY vlan-ids=11,22 Edit: corrected I had a type of 12 (instead of 22)
/ip address
add address=192.168.11.1/24 interface=vlan11 comment='local private subnet"
add address=192.168.22.2/24 interface=vlan22 comment="static wanip"
/ip dhcp-server
add address-pool=static-only interface=vlan11 name=dhcp11
/ip dhcp server-network
add 192.168.11.0/24 dns-server=192.168.11.1 gateway=192.168.11.1
/ip firewall nat
add chain=srcnat action=masquerade out-interface=vlan22
/ip interface list members
add interface=vlan22 list=WAN
/ip route
add distance=2 dst-address=0.0.0.0/0 gateway=192.168.22.1 routing-table=main


R2
/interface bridge
name=BR-WL
/interface vlan
add name=vlan11 interface=BR-WL vlanid=11 comment="backup wan"
add name=vlan22 interface=BR-WL vlanid=22
/interface bridge port
add bridge=BR-WL interface=port XY
/interface bridge vlan
add bridge=BR-WL tagged=BR-WL,etheportXY vlan-ids=11,12
/ip address
add address=192.168.11.2/24 interface=vlan11 comment="static WANIP"
add address=192.168.22.1/24 interface=vlan22 comment="local private subnet"
/ip dhcp-server
add address-pool=static-only interface=vlan22 name=dhcp22
/ip dhcp server-network
add 192.168.22.0/24 dns-server=192.168.22.1 gateway=192.168.22.1
/ip firewall nat
add chain=srcnat action=masquerade out-interface=vlan11
/ip interface list members
add interface=vlan11 list=WAN
/ip route
add distance=2 dst-address=0.0.0.0/0 gateway=192.168.11.1 routing-table=main
Last edited by anav on Sat Mar 23, 2024 3:46 am, edited 1 time in total.
 
MoherPower
just joined
Topic Author
Posts: 2
Joined: Sat Mar 16, 2024 8:52 pm

Re: How to exchange internet connection between 2 oficces.

Fri Mar 22, 2024 9:33 pm

Thank you very much !

We ware so close :) I totaly forget about vlans. Right now we try to tailor your idea to our needs and we will bet back when we finish.

BTW in your example is
/interface bridge vlan
add bridge=BR-WAN-LAN tagged=BR-WAN-LAN,etheportXY vlan-ids=11,12

shouldn't it be

/interface bridge vlan
add bridge=BR-WAN-LAN tagged=BR-WAN-LAN,etheportXY vlan-ids=11,22
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19405
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: How to exchange internet connection between 2 oficces.

Sat Mar 23, 2024 3:47 am

Correct on the typo, should be 22 not 12, fixed up top!! Thanks.

Who is online

Users browsing this forum: Amazon [Bot] and 19 guests