How to configure Load balancing between two WAN link and 1 LAN link on Mikrotik Router through command.
Today we will learn how to configure and setup Load balancing between 2 ADSL+Router/WAN Links in Mikrotik Router using PCC technology by command. Mikrotik 2 WAN Load Balancing using PCC technology. Please follow complete step by step for Mikrotik to load balance between 2 ADSL+Router links.
Two ports were connected for WAN link with two difference ADSL+Router Routers and third port was connected with LAN.
Load balancing between 2 WAN link on Mikrotik Router |
Make sure that both link should be same speed such as 8 Mbps.
WAN_1 IP Address = 172.12.15.8
WAN_2 IP Address = 61.95.235.77
LAN IP Address = 192.168.0.1
Step 1: Assign IP address on Interface:
/ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=LAN
add address=172.12.15.8/24 network=172.12.15.0 broadcast=172.12.15.255 interface=WAN_1
add address=61.95.235.77/24 network=61.95.235.0 broadcast=61.95.235.255 interface=WAN_2
Step 2: Put Global DNS IP address in DNS Server:
/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=8.8.4.4,4.4.2.2,8.8.8.8.
Step 3: Create Routing Policy:
/ip firewall mangle
add chain=input in-interface=WAN_1 action=mark-connection new-connection-mark=WAN_1_conn
add chain=input in-interface=WAN_2 action=mark-connection new-connection-mark=WAN_2_conn
add chain=output connection-mark=WAN_1_conn action=mark-routing new-routing-mark=to_WAN_1
add chain=output connection-mark=WAN_2_conn action=mark-routing new-routing-mark=to_WAN_2
add chain=prerouting dst-address=172.12.15.0/24 action=accept in-interface=LAN
add chain=prerouting dst-address=61.95.235.0/24 action=accept in-interface=LAN
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN_2_conn passthrough=yes
add chain=prerouting connection-mark=WAN_1_conn in-interface=LAN action=mark-routing new-routing-mark=to_WAN_1
add chain=prerouting connection-mark=WAN_2_conn in-interface=LAN action=mark-routing new-routing-mark=to_WAN_2
Step 4: Assign Routing Policy on WAN interface:
/ip route
add dst-address=0.0.0.0/0 gateway=172.12.15.1 routing-mark=to_WAN_1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=61.95.235.1 routing-mark=to_WAN_2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=172.12.15.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=61.95.235.1 distance=2 check-gateway=ping
Step 5: Create NAT Policy
/ip firewall nat
add chain=srcnat out-interface=WAN_1 action=masquerade
add chain=srcnat out-interface=WAN_2 action=masquerade
Note:-
If your both un-equal WAN links, such as WAN_1 is 6 MB and WAN_2 is 8 MB using PCC method and you want to force Mikrotik to use WAN_2 link rather than WAN_1 link so you have to add more PCC rules assigning the same two marks to specific link such as WAN_2.
/ip firewall mangle
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN_1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN_2_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN_2_conn passthrough=yes
For Hotspot with PCC rules so please configure more one step.
/ip firewall nat add action=accept chain=pre-hotspot disabled=no dst-address-type=!local hotspot=auth
Hope this will help to all of you and resolved your all query if you have any query or question so you may ask to send email on our email account (onlinenetworkssolution@gmail.com) or leave comment on page.
0 comments:
Post a Comment