Community discussions

MikroTik App
 
brainscan
just joined
Topic Author
Posts: 6
Joined: Tue Aug 23, 2011 3:31 pm

3 WAN - 1 LAN

Tue Aug 23, 2011 3:38 pm

Hi,

I`ve just brought a mikrotik router board 493AH..I have winbox but I dont really know how to do a setup...
I`ve a 3 WAN on my lan one is 192.168.1.254, 192.168.1.252 and 192.168.1.200 how can I setup up these gateways on my LAN...? I would like to IPs from 192.168.1.1 - 192.168.1.100 use the first gateway 192.168.1.101 - 192.168.1.200 to use the second one and the rest to use the third gateway. I hope someone can help me. Thank you.


edit:

If you can tell me how to do it under telnet that would be ok too.. Thanks again.
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: 3 WAN - 1 LAN

Tue Aug 23, 2011 3:50 pm

Look up and read on policy based routing. Several examples in the wiki and man examples in the forum. It is a question that comes up often.
 
User avatar
routik
Member Candidate
Member Candidate
Posts: 118
Joined: Wed Oct 14, 2009 5:40 pm
Location: Abuja-Nigeria
Contact:

Re: 3 WAN - 1 LAN

Wed Aug 24, 2011 1:21 am

If you're not using hotspot, this may help http://wiki.mikrotik.com/wiki/Load_Bala ... e_Gateways
 
brainscan
just joined
Topic Author
Posts: 6
Joined: Tue Aug 23, 2011 3:31 pm

Re: 3 WAN - 1 LAN

Tue Aug 30, 2011 1:29 pm

Thank you.
 
brainscan
just joined
Topic Author
Posts: 6
Joined: Tue Aug 23, 2011 3:31 pm

Re: 3 WAN - 1 LAN

Wed Aug 31, 2011 11:47 am

I cant even setup a basic router function ... how can I add only one gateway? For eth1 I add 192.168.1.254 one of my gateway ... eth2 goes to switch where is my rest of the LAN, I have added addresses to the ports ... I did setup the dns and the firewall too... :(
 
User avatar
MCT
Member Candidate
Member Candidate
Posts: 158
Joined: Wed Mar 03, 2010 5:53 pm

Re: 3 WAN - 1 LAN

Wed Aug 31, 2011 7:11 pm

A diagram would help people assist you.

What are the 3 WAN devices and how do they connect upstream?
How are they physically connected from the WAN devices to the Routerboard? Is there a switch?
 
brainscan
just joined
Topic Author
Posts: 6
Joined: Tue Aug 23, 2011 3:31 pm

Re: 3 WAN - 1 LAN

Wed Aug 31, 2011 9:07 pm

Thanks for the reply... This is the currently network diagramm
1.jpg
and this is what I would like to achieve
2.jpg
GW1 is a wireless link to the internet with fix public IP
GW2 is also a wireless link to the internet with fix public IP
GW3 is a simple ADSL connection
You do not have the required permissions to view the files attached to this post.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: 3 WAN - 1 LAN

Wed Aug 31, 2011 9:30 pm

That doesn't make any sense to me. Do you mean you want the 3 existing gateways so somehow connect to the Internet, the Mikrotik router to connect to those three gateways, and have the Mikrotik router be the only router on the LAN?
 
brainscan
just joined
Topic Author
Posts: 6
Joined: Tue Aug 23, 2011 3:31 pm

Re: 3 WAN - 1 LAN

Thu Sep 01, 2011 12:31 am

Exactly...The whole traffic should go through the Mikrotik...
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: 3 WAN - 1 LAN

Thu Sep 01, 2011 1:13 am

I'm bored so I'll type this out. All of this is documented in the manuals.

Connect gw1 to the Internet on its WAN port. Configure its LAN port as 172.31.255.254/30. Add a route to 192.168.1.0/24 via 172.31.255.253.
Connect gw2 to the Internet on its WAN port. Configure its LAN port as 172.31.255.250/30. Add a route to 192.168.1.0/24 via 172.31.255.249.
Connect gw3 to the Internet on its WAN port. Configure its LAN port as 172.31.255.246/30. Add a route to 192.168.1.0/24 via 172.31.255.245.

Connect gw1's LAN port to ether1 on the RouterBOARD. Configure an IP address of 172.31.255.253 on ether1.
Connect gw2's LAN port to ether1 on the RouterBOARD. Configure an IP address of 172.31.255.249 on ether2.
Connect gw3's LAN port to ether1 on the RouterBOARD. Configure an IP address of 172.31.255.245 on ether3.
Connect your LAN switch to ether4 on the RouterBOARD. Configure an IP address of 192.168.1.1 on ether4.
/ip address
add address=172.31.255.253 interface=ether1
add address=172.31.255.249 interface=ether2
add address=172.31.255.245 interface=ether3
add address=192.168.1.1/24 interface=ether4
Configure policy routing mangle rules that mark traffic going from the LAN to the Internet based on the LAN host source address, these marks assign traffic to one of the three gateways.
/ip firewall address-list
add list=rfc1918 address=192.168.0.0/16
add list=rfc1918 address=172.16.0.0/12
add list=rfc1918 address=10.0.0.0/8
/ip firewall mangle
add chain=prerouting src-address-list=rfc1918 dst-address-list=rfc1918 action=accept
add chain=prerouting src-address=192.168.1.2-192.168.1.100 action=mark-routing new-routing-mark=to-gw1
add chain=prerouting src-address=192.168.1.101-192.168.1.200 action=mark-routing new-routing-mark=to-gw2
add chain=prerouting src-address=192.168.1.201-192.168.1.154 action=mark-routing new-routing-mark=to-gw3
/ip route 
add dst-address=0.0.0.0/0 routing-mark=to-gw1 gateway=172.31.255.254 
add dst-address=0.0.0.0/0 routing-mark=to-gw2 gateway=172.31.255.250
add dst-address=0.0.0.0/0 routing-mark=to-gw3 gateway=172.31.255.246 
add dst-address=0.0.0.0/0 gateway=172.31.255.254 distance=1
add dst-address=0.0.0.0/0 gateway=172.31.255.250 distance=2
add dst-address=0.0.0.0/0 gateway=172.31.255.246 distance=3
If gw1-3 can't NAT networks not directly connected to them add NAT rules (though this will cause double NAT, which is fairly ugly):
/ip firewall nat
add chain=srcnat out-interface=ether1 action=src-nat to-address=172.31.255.253
add chain=srcnat out-interface=ether2 action=src-nat to-address=172.31.255.249
add chain=srcnat out-interface=ether3 action=src-nat to-address=172.31.255.245
Of course this doesn't cover things like DNS, or a DHCP server on the RouterBOARD. Those topics are fundamental and adequately covered by the manual.
 
brainscan
just joined
Topic Author
Posts: 6
Joined: Tue Aug 23, 2011 3:31 pm

Re: 3 WAN - 1 LAN

Thu Sep 01, 2011 9:55 am

Thank you, I`ll try this. I dont need dhcp we use only static IPs.
 
d33cktr4zy
just joined
Posts: 7
Joined: Tue Nov 17, 2009 9:38 am

Re: 3 WAN - 1 LAN

Thu Sep 01, 2011 3:34 pm

I'm bored so I'll type this out. All of this is documented in the manuals.

Connect gw1 to the Internet on its WAN port. Configure its LAN port as 172.31.255.254/30. Add a route to 192.168.1.0/24 via 172.31.255.253.
Connect gw2 to the Internet on its WAN port. Configure its LAN port as 172.31.255.250/30. Add a route to 192.168.1.0/24 via 172.31.255.249.
Connect gw3 to the Internet on its WAN port. Configure its LAN port as 172.31.255.246/30. Add a route to 192.168.1.0/24 via 172.31.255.245.

Connect gw1's LAN port to ether1 on the RouterBOARD. Configure an IP address of 172.31.255.253 on ether1.
Connect gw2's LAN port to ether1 on the RouterBOARD. Configure an IP address of 172.31.255.249 on ether2.
Connect gw3's LAN port to ether1 on the RouterBOARD. Configure an IP address of 172.31.255.245 on ether3.
Connect your LAN switch to ether4 on the RouterBOARD. Configure an IP address of 192.168.1.1 on ether4.
/ip address
add address=172.31.255.253 interface=ether1
add address=172.31.255.249 interface=ether2
add address=172.31.255.245 interface=ether3
add address=192.168.1.1/24 interface=ether4
Configure policy routing mangle rules that mark traffic going from the LAN to the Internet based on the LAN host source address, these marks assign traffic to one of the three gateways.
/ip firewall address-list
add list=rfc1918 address=192.168.0.0/16
add list=rfc1918 address=172.16.0.0/12
add list=rfc1918 address=10.0.0.0/8
/ip firewall mangle
add chain=prerouting src-address-list=rfc1918 dst-address-list=rfc1918 action=accept
add chain=prerouting src-address=192.168.1.2-192.168.1.100 action=mark-routing new-routing-mark=to-gw1
add chain=prerouting src-address=192.168.1.101-192.168.1.200 action=mark-routing new-routing-mark=to-gw2
add chain=prerouting src-address=192.168.1.201-192.168.1.154 action=mark-routing new-routing-mark=to-gw3
/ip route 
add dst-address=0.0.0.0/0 routing-mark=to-gw1 gateway=172.31.255.254 
add dst-address=0.0.0.0/0 routing-mark=to-gw2 gateway=172.31.255.250
add dst-address=0.0.0.0/0 routing-mark=to-gw3 gateway=172.31.255.246 
add dst-address=0.0.0.0/0 gateway=172.31.255.254 distance=1
add dst-address=0.0.0.0/0 gateway=172.31.255.250 distance=2
add dst-address=0.0.0.0/0 gateway=172.31.255.246 distance=3
If gw1-3 can't NAT networks not directly connected to them add NAT rules (though this will cause double NAT, which is fairly ugly):
/ip firewall nat
add chain=srcnat out-interface=ether1 action=src-nat to-address=172.31.255.253
add chain=srcnat out-interface=ether2 action=src-nat to-address=172.31.255.249
add chain=srcnat out-interface=ether3 action=src-nat to-address=172.31.255.245
Of course this doesn't cover things like DNS, or a DHCP server on the RouterBOARD. Those topics are fundamental and adequately covered by the manual.
Lol, @fewi. He can be bored to. (Its boring as it a repetitive question) Acctually, this topic has been scatteredly discussed on many thread and some mikrotik forum.

Try googling with "mikrotik load balancing multiple gateway" you'll see bunch discussion and tutorials.

More, if you would like to use multiple gateway, perhaps you can apply pcc load balancing.


Sent from my BlackBerry 9300 using Tapatalk