Page 1 of 1

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

Posted: Wed Aug 10, 2011 12:01 am
by alfrqan
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???

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

Posted: Wed Aug 10, 2011 12:10 am
by fewi
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

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

Posted: Wed Aug 10, 2011 10:22 am
by alfrqan
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

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

Posted: Wed Aug 10, 2011 10:27 am
by dasiu
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 :).

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

Posted: Wed Aug 10, 2011 11:50 am
by alfrqan
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 >

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

Posted: Wed Aug 10, 2011 12:54 pm
by dasiu
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)

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

Posted: Thu Sep 08, 2011 12:33 pm
by alfrqan
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???

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

Posted: Thu Sep 08, 2011 12:36 pm
by janisk
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.

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

Posted: Thu Sep 08, 2011 6:36 pm
by alfrqan
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!!

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

Posted: Thu Dec 01, 2011 8:44 pm
by hngjared
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,