Community discussions

MikroTik App
 
alfrqan
newbie
Topic Author
Posts: 29
Joined: Fri Jun 19, 2009 2:44 pm

How to seperate 2 wan for 2 differnt hotspot!!?

Wed Aug 10, 2011 12:01 am

Hi

i actually need help
i have to internet adsl line (2wan)
i have install 2 hotspots in Lan
I want only Wan1 to go in Lan1
and Wan2 to go in Lan2

any help???
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: How to seperate 2 wan for 2 differnt hotspot!!?

Wed Aug 10, 2011 12:10 am

Prevent Hotspot traffic from being proxied, then assign routing marks based on in-interface, then add default routes out the appropriate WAN provider as per the routing marks, then have fall through default routes in case a provider goes down. This assumes a whole bunch of stuff, but given that you're providing virtually no details that's all anyone can do at this point.
/ip firewall nat
add chain=pre-hotspot action=accept dst-address-type=!local hotspot=auth
/ip firewall mangle 
add chain=prerouting in-interface=lan1 action=mark-routing new-routing-mark=to-wan1
add chain=prerouting in-interface=lan2 action=mark-routing new-routing-mark=to-wan2
/ip route
add dst-address=0.0.0.0/0 routing-mark=to-wan1 gateway=1.1.1.1 distance=0
add dst-address=0.0.0.0/0 routing-mark=to-wan2 gateway=2.2.2.2 distance=0
add dst-address=0.0.0.0/0 gateway=1.1.1.1 distance=1
add dst-address=0.0.0.0/0 gateway=2.2.2.2 distance=2
 
alfrqan
newbie
Topic Author
Posts: 29
Joined: Fri Jun 19, 2009 2:44 pm

Re: How to seperate 2 wan for 2 differnt hotspot!!?

Wed Aug 10, 2011 10:22 am

Prevent Hotspot traffic from being proxied, then assign routing marks based on in-interface, then add default routes out the appropriate WAN provider as per the routing marks, then have fall through default routes in case a provider goes down. This assumes a whole bunch of stuff, but given that you're providing virtually no details that's all anyone can do at this point.
/ip firewall nat
add chain=pre-hotspot action=accept dst-address-type=!local hotspot=auth
/ip firewall mangle 
add chain=prerouting in-interface=lan1 action=mark-routing new-routing-mark=to-wan1
add chain=prerouting in-interface=lan2 action=mark-routing new-routing-mark=to-wan2
/ip route
add dst-address=0.0.0.0/0 routing-mark=to-wan1 gateway=1.1.1.1 distance=0
add dst-address=0.0.0.0/0 routing-mark=to-wan2 gateway=2.2.2.2 distance=0
add dst-address=0.0.0.0/0 gateway=1.1.1.1 distance=1
add dst-address=0.0.0.0/0 gateway=2.2.2.2 distance=2
Thankx for reply

i have one douts:!
add dst-address=0.0.0.0/0 routing-mark=to-wan1 gateway=GATEWAY OF LAN OR WAN? distance=0
 
User avatar
dasiu
Trainer
Trainer
Posts: 231
Joined: Fri Jan 30, 2009 11:41 am
Location: Reading, UK
Contact:

Re: How to seperate 2 wan for 2 differnt hotspot!!?

Wed Aug 10, 2011 10:27 am

i have one douts:!
add dst-address=0.0.0.0/0 routing-mark=to-wan1 gateway=GATEWAY OF LAN OR WAN? distance=0
Wan, of course :).
 
alfrqan
newbie
Topic Author
Posts: 29
Joined: Fri Jun 19, 2009 2:44 pm

Re: How to seperate 2 wan for 2 differnt hotspot!!?

Wed Aug 10, 2011 11:50 am

Thankx again!!

But when i tried this
add dst-address=0.0.0.0/0 routing-mark=to-wan1 gateway=1.1.1.1 distance=0 ////=== distance it cant be = 0 >
 
User avatar
dasiu
Trainer
Trainer
Posts: 231
Joined: Fri Jan 30, 2009 11:41 am
Location: Reading, UK
Contact:

Re: How to seperate 2 wan for 2 differnt hotspot!!?

Wed Aug 10, 2011 12:54 pm

Thankx again!!

But when i tried this
add dst-address=0.0.0.0/0 routing-mark=to-wan1 gateway=1.1.1.1 distance=0 ////=== distance it cant be = 0 >
Oh, really - in older versions of RouterOS distance could be 0.
Anyway - just add 1 to everything ;-).
Or - I would do it this way:
/ip route
add dst-address=0.0.0.0/0 routing-mark=to-wan1 gateway=1.1.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 routing-mark=to-wan1 gateway=2.2.2.2 distance=2
add dst-address=0.0.0.0/0 routing-mark=to-wan2 gateway=2.2.2.2 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 routing-mark=to-wan2 gateway=1.1.1.1 distance=2
(or check-gateway=arp if it doesn't respond to ping)
 
alfrqan
newbie
Topic Author
Posts: 29
Joined: Fri Jun 19, 2009 2:44 pm

Re: How to seperate 2 wan for 2 differnt hotspot!!?

Thu Sep 08, 2011 12:33 pm

soory to be noob
when i used this
/ip firewall nat
add chain=pre-hotspot action=accept dst-address-type=!local hotspot=auth
later i cant access to my dns server for example www.xxx.com = 192.168.1.10
when i type www.xxx.com it will not come but when i type 192.168.1.10 it works!!
any help???
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: How to seperate 2 wan for 2 differnt hotspot!!?

Thu Sep 08, 2011 12:36 pm

to change host where http request goes you have to redirect requests to proxy, and then within the proxy redirect that request to other host, in your case 192.168.1.10

NAT does not know anything about domain names.
 
alfrqan
newbie
Topic Author
Posts: 29
Joined: Fri Jun 19, 2009 2:44 pm

Re: How to seperate 2 wan for 2 differnt hotspot!!?

Thu Sep 08, 2011 6:36 pm

yah

when i enable this rule the internet is tacken from both 2 wans butwhen i disable this rule the internet is tacken only by one wan.
so as i said with this rule i can get to my dns of my hotspots after login!
i only can check status page of hotspot by using hotspot ip not domine!!
 
hngjared
Frequent Visitor
Frequent Visitor
Posts: 77
Joined: Thu Dec 01, 2011 8:36 pm
Location: NYC USA

Re: How to seperate 2 wan for 2 differnt hotspot!!?

Thu Dec 01, 2011 8:44 pm

Thanks for the information! Everything works great when authentication is disabled. I have two seperate Hotspots going through 2 seperate WANs. When authntication is on, Hotspot1 works flawlessly going out through DGW1. When I plug into Hotspot2 with authentication on I can see in the Radius server that I am still going out through DGW1. When authentication is off everything works great. Traffic from hotspot1 goes out of DGW1 and traffic from Hospot2 goes out of DGW2. Is there something else that needs to be done in order to apply these rules with authentication?

Thank you,