Community discussions

MikroTik App
 
karkoura
just joined
Topic Author
Posts: 3
Joined: Tue Sep 07, 2021 4:00 pm

Script Needed

Tue Sep 07, 2021 4:07 pm

Hello Experts

i have recently purchased the Hap Ac2 for my 2 DSL lines @ home
the current topology is :
ISP1 : 70 Mbps , 192.168.7.1 - Ether 1
ISP2 : 30 Mbps , 192.168.5.1 Ether 2
Local : Ether 3, 4 ,5 / WLAN

my requirements are :
1- want to use Ether 3 ,4,5 & Wlan2 (5GHZ) as local connection (home users) in same subnet , so they can reach each others.
2- specify certain users / Lan interface to specific ISP/WAN

anyone can support with a working script , which can satisfy my needs?
 
ConnyMercier
Forum Veteran
Forum Veteran
Posts: 723
Joined: Tue Dec 17, 2019 1:08 pm

Re: Script Needed

Fri Sep 10, 2021 11:10 am

A Quick Scrip to get you startet....
Per Default all Traffic will go to wan1
If you add a Client in the Addresslist (see step 6) it will only exit via chosen Interface
There are enough information in the Mikrotik-Manual and Forum to refine the Configuration !
P.S: Don't Forget to Secure your Router



Step 1: Create Bridge
/interface bridge
add comment=LOCAL name=bridge1
/interface bridge port
add bridge=bridge1 interface=ether3
add bridge=bridge1 interface=ether4
add bridge=bridge1 interface=ether5
add bridge=bridge1 edge=yes interface=wlan2
Step 2: Create Local-Network
/ip address
add address=10.10.10.254/24 interface=bridge1 network=10.10.10.0
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=bridge1 name=dhcp1
/ip dhcp-server network
add address=10.10.10.0/24 dns-server=192.168.178.254,10.10.10.254 gateway=10.10.10.254
/ip pool
add name=dhcp_pool0 ranges=10.10.10.1-10.10.10.199

Step 3: Configure WAN1
/ip dhcp-client
add default-route-distance=10 disabled=no interface=ether1
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether1
Step 4: Configure WAN2
/ip dhcp-client
add default-route-distance=20 disabled=no interface=ether2

/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether2

Step 5: Create Mangle
/ ip firewall mangle
add chain=prerouting in-interface=ether1 connection-mark=no-mark action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=ether2 connection-mark=no-mark action=mark-connection new-connection-mark=ISP2_conn

add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local in-interface=bridge1 new-connection-mark=ISP1_conn src-address-list=to_ISP1
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local in-interface=bridge1 new-connection-mark=ISP2_conn src-address-list=to_ISP2

add chain=prerouting connection-mark=ISP1_conn in-interface=bridge1 action=mark-routing new-routing-mark=to_ISP1
add chain=prerouting connection-mark=ISP2_conn in-interface=bridge1 action=mark-routing new-routing-mark=to_ISP2
add chain=output connection-mark=ISP1_conn action=mark-routing new-routing-mark=to_ISP1     
add chain=output connection-mark=ISP2_conn action=mark-routing new-routing-mark=to_ISP2
Step 6: Add Clients to AddressList
/ip firewall address-list
add address=10.10.10.6 list=to_ISP1
add address=10.10.10.9 list=to_ISP2
Step 7: Add Route
/ ip route
add dst-address=0.0.0.0/0 gateway=ether1 routing-mark=to_ISP1
add dst-address=0.0.0.0/0 gateway=ether2 routing-mark=to_ISP2

Who is online

Users browsing this forum: No registered users and 48 guests